Added F4 hot key for 'End Turn' action

This commit is contained in:
magenoxx 2012-07-08 18:42:28 +04:00
parent ecfc58b131
commit 7d1bdfb0ce
2 changed files with 12 additions and 22 deletions

View file

@ -56,10 +56,7 @@ import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.*;
import java.io.Serializable;
import java.util.*;
import java.util.concurrent.CancellationException;
@ -736,6 +733,17 @@ public class GamePanel extends javax.swing.JPanel {
}
});
int c = JComponent.WHEN_IN_FOCUSED_WINDOW;
KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0);
this.getInputMap(c).put(ks, "PRESS");
this.getActionMap().put("PRESS", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
btnEndTurnActionPerformed(null);
}
});
btnSwitchHands.setText("Switch Hands");
btnSwitchHands.addMouseListener(new MouseAdapter() {
@Override

View file

@ -73,14 +73,8 @@ public class HelperPanel extends JPanel {
textArea = new MageTextArea();
textArea.setText("<Empty>");
//jScrollPane1 = new javax.swing.JScrollPane();
//jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//jScrollPane1.setViewportView(textArea);
//jScrollPane1.setBorder(null);
jPanel.setOpaque(false);
jPanel.setBackground(new Color(0, 0, 0, 80));
//jPanel.add(jScrollPane1);
jPanel.add(textArea);
add(jPanel);
@ -96,18 +90,6 @@ public class HelperPanel extends JPanel {
btnRight.setVisible(false);
container.add(btnRight);
//btnStopTimer = new JButton("Stop timer");
//btnStopTimer.setToolTipText("Stop auto phase skipping timer");
//add(btnStopTimer);
/*
btnEndTurn = new JButton("End Turn");
btnEndTurn.setToolTipText("End The Turn");
btnEndTurn.setFocusable(false);
btnEndTurn.setVisible(false);
container.add(btnEndTurn);
*/
btnLeft.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (linkLeft != null) {{