diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/gui/GuiTricks.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/gui/GuiTricks.java | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/src/main/java/cuchaz/enigma/gui/GuiTricks.java b/src/main/java/cuchaz/enigma/gui/GuiTricks.java deleted file mode 100644 index 9208455..0000000 --- a/src/main/java/cuchaz/enigma/gui/GuiTricks.java +++ /dev/null | |||
| @@ -1,42 +0,0 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * <p> | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | |||
| 12 | package cuchaz.enigma.gui; | ||
| 13 | |||
| 14 | import javax.swing.*; | ||
| 15 | import java.awt.*; | ||
| 16 | import java.awt.event.ActionListener; | ||
| 17 | |||
| 18 | public class GuiTricks { | ||
| 19 | |||
| 20 | public static JLabel unboldLabel(JLabel label) { | ||
| 21 | Font font = label.getFont(); | ||
| 22 | label.setFont(font.deriveFont(font.getStyle() & ~Font.BOLD)); | ||
| 23 | return label; | ||
| 24 | } | ||
| 25 | |||
| 26 | public static void deactivateButton(JButton button) { | ||
| 27 | button.setEnabled(false); | ||
| 28 | button.setText(""); | ||
| 29 | for (ActionListener listener : button.getActionListeners()) { | ||
| 30 | button.removeActionListener(listener); | ||
| 31 | } | ||
| 32 | } | ||
| 33 | |||
| 34 | public static void activateButton(JButton button, String text, ActionListener newListener) { | ||
| 35 | button.setText(text); | ||
| 36 | button.setEnabled(true); | ||
| 37 | for (ActionListener listener : button.getActionListeners()) { | ||
| 38 | button.removeActionListener(listener); | ||
| 39 | } | ||
| 40 | button.addActionListener(newListener); | ||
| 41 | } | ||
| 42 | } | ||