From 0710ba4ea37e5fc6bf7c72d9bc67af8b78aaa7d3 Mon Sep 17 00:00:00 2001 From: lantzelot-swe <75668734+lantzelot-swe@users.noreply.github.com> Date: Sun, 12 Nov 2023 21:29:09 +0100 Subject: [PATCH] fix: change "Joystick" to "controller" in the UI --- .../se/lantz/gui/CombinedJoystickPanel.java | 2 +- src/main/java/se/lantz/gui/JoystickPanel.java | 11 +++++++---- src/main/java/se/lantz/gui/MenuManager.java | 18 +++++++++--------- .../gui/preferences/PreferencesTabPanel.java | 4 ++-- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/main/java/se/lantz/gui/CombinedJoystickPanel.java b/src/main/java/se/lantz/gui/CombinedJoystickPanel.java index 1392980..e07910f 100644 --- a/src/main/java/se/lantz/gui/CombinedJoystickPanel.java +++ b/src/main/java/se/lantz/gui/CombinedJoystickPanel.java @@ -21,7 +21,7 @@ public class CombinedJoystickPanel extends JPanel public CombinedJoystickPanel(MainViewModel model) { - setBorder(new TitledBorder(null, "Joystick configuration", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + setBorder(new TitledBorder(null, "Controller configuration", TitledBorder.LEADING, TitledBorder.TOP, null, null)); this.model = model; GridBagLayout gridBagLayout = new GridBagLayout(); setLayout(gridBagLayout); diff --git a/src/main/java/se/lantz/gui/JoystickPanel.java b/src/main/java/se/lantz/gui/JoystickPanel.java index 0f6a486..40b4956 100644 --- a/src/main/java/se/lantz/gui/JoystickPanel.java +++ b/src/main/java/se/lantz/gui/JoystickPanel.java @@ -11,18 +11,17 @@ import java.awt.event.FocusListener; import java.beans.Beans; import javax.swing.ImageIcon; +import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingConstants; -import se.lantz.gui.exports.ExportGamesDialog; import se.lantz.gui.gamepad.GamePadDialog; import se.lantz.model.JoystickModel; import se.lantz.util.CustomUndoPlainDocument; import se.lantz.util.TextComponentSupport; -import javax.swing.JButton; public class JoystickPanel extends JPanel { @@ -151,13 +150,14 @@ public class JoystickPanel extends JPanel getConfigTextField().setText(model.getConfigString()); } getImageLabel().setIcon(model.isMouse() ? mouseImage : joyImage); + getGamepadButton().setEnabled(!model.isMouse()); } private JCheckBox getPrimaryJoyCheckBox() { if (primaryJoyCheckBox == null) { - String text = "Use port " + portnumber + " as Primary joystick"; + String text = "Use port " + portnumber + " as primary controller"; primaryJoyCheckBox = new JCheckBox(text); primaryJoyCheckBox.addItemListener((e) -> model.setPrimary(primaryJoyCheckBox.isSelected())); } @@ -344,7 +344,10 @@ public class JoystickPanel extends JPanel { String text = "Use mouse"; mouseCheckBox = new JCheckBox(text); - mouseCheckBox.addItemListener((e) -> model.setMouse(mouseCheckBox.isSelected())); + mouseCheckBox.addItemListener((e) -> { + model.setMouse(mouseCheckBox.isSelected()); + getGamepadButton().setEnabled(!mouseCheckBox.isSelected()); + }); } return mouseCheckBox; } diff --git a/src/main/java/se/lantz/gui/MenuManager.java b/src/main/java/se/lantz/gui/MenuManager.java index 3dae663..f57c2d7 100644 --- a/src/main/java/se/lantz/gui/MenuManager.java +++ b/src/main/java/se/lantz/gui/MenuManager.java @@ -943,9 +943,9 @@ public class MenuManager { if (resetJoystickConfigItem == null) { - resetJoystickConfigItem = new JMenuItem("Reset joystick configs for current gamelist view"); + resetJoystickConfigItem = new JMenuItem("Reset controller configs for current gamelist view"); resetJoystickConfigItem.setMnemonic('j'); - resetJoystickConfigItem.addActionListener(e -> resetJoystickConfigs()); + resetJoystickConfigItem.addActionListener(e -> resetControllerConfigs()); } return resetJoystickConfigItem; } @@ -1528,23 +1528,23 @@ public class MenuManager } - private void resetJoystickConfigs() + private void resetControllerConfigs() { - String message = "Do you want to reset the joystick configurations for all games in the current gamelist view?\n" + - "Only the mappings are reset to the default (defined in preferences), primary joystick is preserved.\n" + - "The second joystick is also reset with the default mappings."; + String message = "Do you want to reset the controller configurations for all games in the current gamelist view?\n" + + "Only the mappings are reset to the default (defined in preferences), primary controller port is preserved.\n" + + "The second controller is also reset with the default mappings."; int option = JOptionPane.showConfirmDialog(MainWindow.getInstance().getMainPanel(), message, - "Reset joystick configurations", + "Reset controller configurations", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (option == JOptionPane.YES_OPTION) { uiModel.resetJoystickConfigsForCurrentView(); JOptionPane.showMessageDialog(MainWindow.getInstance().getMainPanel(), - "Joystick configurations updated.", - "Reset joystick configurations", + "Controller configurations updated.", + "Reset controller configurations", JOptionPane.INFORMATION_MESSAGE); MainWindow.getInstance().reloadCurrentGameView(); } diff --git a/src/main/java/se/lantz/gui/preferences/PreferencesTabPanel.java b/src/main/java/se/lantz/gui/preferences/PreferencesTabPanel.java index 6347de2..45e115a 100644 --- a/src/main/java/se/lantz/gui/preferences/PreferencesTabPanel.java +++ b/src/main/java/se/lantz/gui/preferences/PreferencesTabPanel.java @@ -44,7 +44,7 @@ public class PreferencesTabPanel extends JPanel tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.addTab("Misc.", null, getMiscPanel(), null); tabbedPane.addTab("Favorites", null, getFavPanel(), null); - tabbedPane.addTab("Joystick", null, getJoystickBackgroundPanel(), null); + tabbedPane.addTab("Controller", null, getJoystickBackgroundPanel(), null); tabbedPane.addTab("Infoslot", null, getInfoSlotBackgroundPanel(), null); } return tabbedPane; @@ -148,7 +148,7 @@ public class PreferencesTabPanel extends JPanel if (infoLabel == null) { infoLabel = - new JLabel("Specify the default joystick configuration to use when adding new games. Port 1 and Port 2 uses the same mapping."); + new JLabel("Specify the default controller configuration to use when adding new games. Port 1 and Port 2 uses the same mapping."); } return infoLabel; }