diff --git a/Mage.Client/src/main/java/mage/client/components/KeyboundButton.java b/Mage.Client/src/main/java/mage/client/components/KeyboundButton.java new file mode 100644 index 00000000000..dd4b8bd896c --- /dev/null +++ b/Mage.Client/src/main/java/mage/client/components/KeyboundButton.java @@ -0,0 +1,46 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.client.components; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics; +import javax.swing.JButton; +import mage.client.dialog.PreferencesDialog; + +/** + * + * @author Campbell Suter + */ +public class KeyboundButton extends JButton { + + private final String key; + private static final Font keyFont = new Font(Font.SANS_SERIF, Font.BOLD, 13); + + public KeyboundButton(String key) { + this.key = key; + } + + @Override + protected void paintComponent(Graphics g) { + if (ui != null && g != null) { + Graphics sg = g.create(); + try { + ui.update(sg, this); + sg.setColor(Color.white); + sg.setFont(keyFont); + + String text = PreferencesDialog.getCachedKeyText(key); + int textWidth = sg.getFontMetrics(keyFont).stringWidth(text); + int centerX = (getWidth() - textWidth) / 2; + + sg.drawString(text, centerX, 28); + } finally { + sg.dispose(); + } + } + } +} diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index 6f745e3aaa8..729ab26b029 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -90,6 +90,7 @@ import mage.client.cards.BigCard; import mage.client.chat.ChatPanelBasic; import mage.client.combat.CombatManager; import mage.client.components.HoverButton; +import mage.client.components.KeyboundButton; import mage.client.components.MageComponents; import mage.client.components.ext.dlg.DialogManager; import mage.client.components.layout.RelativeLayout; @@ -1353,13 +1354,13 @@ public final class GamePanel extends javax.swing.JPanel { txtHoldPriority.setToolTipText("Holding priority after the next spell cast or ability activation"); txtHoldPriority.setVisible(false); - btnCancelSkip = new javax.swing.JButton(); // F3 - btnSkipToNextTurn = new javax.swing.JButton(); // F4 - btnSkipToEndTurn = new javax.swing.JButton(); // F5 - btnSkipToNextMain = new javax.swing.JButton(); // F7 - btnSkipStack = new javax.swing.JButton(); // F8 - btnSkipToYourTurn = new javax.swing.JButton(); // F9 - btnSkipToEndStepBeforeYourTurn = new javax.swing.JButton(); // F11 + btnCancelSkip = new KeyboundButton(KEY_CONTROL_CANCEL_SKIP); // F3 + btnSkipToNextTurn = new KeyboundButton(KEY_CONTROL_NEXT_TURN); // F4 + btnSkipToEndTurn = new KeyboundButton(KEY_CONTROL_END_STEP); // F5 + btnSkipToNextMain = new KeyboundButton(KEY_CONTROL_MAIN_STEP); // F7 + btnSkipStack = new KeyboundButton(KEY_CONTROL_SKIP_STACK); // F10 + btnSkipToYourTurn = new KeyboundButton(KEY_CONTROL_YOUR_TURN); // F9 + btnSkipToEndStepBeforeYourTurn = new KeyboundButton(KEY_CONTROL_PRIOR_END); // F11 btnConcede = new javax.swing.JButton(); btnSwitchHands = new javax.swing.JButton(); @@ -2410,13 +2411,13 @@ public final class GamePanel extends javax.swing.JPanel { private mage.client.cards.BigCard bigCard; // private JPanel cancelSkipPanel; - private javax.swing.JButton btnCancelSkip; - private javax.swing.JButton btnSkipToNextTurn; // F4 - private javax.swing.JButton btnSkipToEndTurn; // F5 - private javax.swing.JButton btnSkipToNextMain; // F7 - private javax.swing.JButton btnSkipStack; // F8 - private javax.swing.JButton btnSkipToYourTurn; // F9 - private javax.swing.JButton btnSkipToEndStepBeforeYourTurn; // F11 + private KeyboundButton btnCancelSkip; + private KeyboundButton btnSkipToNextTurn; // F4 + private KeyboundButton btnSkipToEndTurn; // F5 + private KeyboundButton btnSkipToNextMain; // F7 + private KeyboundButton btnSkipStack; // F8 + private KeyboundButton btnSkipToYourTurn; // F9 + private KeyboundButton btnSkipToEndStepBeforeYourTurn; // F11 private javax.swing.JButton btnConcede; private javax.swing.JButton btnSwitchHands; diff --git a/Mage.Client/src/main/resources/buttons/cancel_skip.png b/Mage.Client/src/main/resources/buttons/cancel_skip.png index 30755df9317..4df1d6db2f7 100644 Binary files a/Mage.Client/src/main/resources/buttons/cancel_skip.png and b/Mage.Client/src/main/resources/buttons/cancel_skip.png differ diff --git a/Mage.Client/src/main/resources/buttons/skip_all.png b/Mage.Client/src/main/resources/buttons/skip_all.png index 53c01378ade..2120e016d97 100644 Binary files a/Mage.Client/src/main/resources/buttons/skip_all.png and b/Mage.Client/src/main/resources/buttons/skip_all.png differ diff --git a/Mage.Client/src/main/resources/buttons/skip_stack.png b/Mage.Client/src/main/resources/buttons/skip_stack.png index 06816b1f393..2ddce1c39b3 100644 Binary files a/Mage.Client/src/main/resources/buttons/skip_stack.png and b/Mage.Client/src/main/resources/buttons/skip_stack.png differ diff --git a/Mage.Client/src/main/resources/buttons/skip_to_end.png b/Mage.Client/src/main/resources/buttons/skip_to_end.png index 86df3bcf7c4..4a609a06252 100644 Binary files a/Mage.Client/src/main/resources/buttons/skip_to_end.png and b/Mage.Client/src/main/resources/buttons/skip_to_end.png differ diff --git a/Mage.Client/src/main/resources/buttons/skip_to_main.png b/Mage.Client/src/main/resources/buttons/skip_to_main.png index 0d1b2bf1155..d1bbef6b864 100644 Binary files a/Mage.Client/src/main/resources/buttons/skip_to_main.png and b/Mage.Client/src/main/resources/buttons/skip_to_main.png differ diff --git a/Mage.Client/src/main/resources/buttons/skip_to_previous_end.png b/Mage.Client/src/main/resources/buttons/skip_to_previous_end.png index 2e93fd55bbb..03043c96b7c 100644 Binary files a/Mage.Client/src/main/resources/buttons/skip_to_previous_end.png and b/Mage.Client/src/main/resources/buttons/skip_to_previous_end.png differ diff --git a/Mage.Client/src/main/resources/buttons/skip_turn.png b/Mage.Client/src/main/resources/buttons/skip_turn.png index c7c3bfe393b..8f9ad5432ae 100644 Binary files a/Mage.Client/src/main/resources/buttons/skip_turn.png and b/Mage.Client/src/main/resources/buttons/skip_turn.png differ