Skip to content

Commit

Permalink
PMD: LongVariable
Browse files Browse the repository at this point in the history
  • Loading branch information
aterai committed Dec 8, 2017
1 parent 5dbb615 commit 49906fd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions AuditoryCues/src/java/example/MainPanel.java
Expand Up @@ -14,7 +14,7 @@
// Magic with Merlin: Swinging audio
// https://www.ibm.com/developerworks/java/library/j-mer0730/
public final class MainPanel extends JPanel {
private static final String[] OPTION_PANE_AUDITORY_CUES = {
private static final String[] AUDITORY_CUES = {
"OptionPane.errorSound", "OptionPane.informationSound",
"OptionPane.questionSound", "OptionPane.warningSound"
};
Expand All @@ -32,7 +32,7 @@ private MainPanel() {
UIManager.put("AuditoryCues.playList", UIManager.get("AuditoryCues.noAuditoryCues"));
loadAndPlayAudio("notice2.wav");
JOptionPane.showMessageDialog(panel, "showMessageDialog2");
UIManager.put("AuditoryCues.playList", OPTION_PANE_AUDITORY_CUES);
UIManager.put("AuditoryCues.playList", AUDITORY_CUES);
});

panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
Expand Down Expand Up @@ -117,7 +117,7 @@ public static void createAndShowGUI() {
// UIManager.put("AuditoryCues.playList", UIManager.get("AuditoryCues.allAuditoryCues"));
// UIManager.put("AuditoryCues.playList", UIManager.get("AuditoryCues.defaultCueList"));
// UIManager.put("AuditoryCues.playList", UIManager.get("AuditoryCues.noAuditoryCues"));
UIManager.put("AuditoryCues.playList", OPTION_PANE_AUDITORY_CUES);
UIManager.put("AuditoryCues.playList", AUDITORY_CUES);
// UIManager.put("OptionPane.informationSound", "/example/notice2.wav");
// UIManager.put("OptionPane.informationSound", "sounds/OptionPaneError.wav");
// System.out.println(UIManager.get("AuditoryCues.actionMap"));
Expand Down
8 changes: 4 additions & 4 deletions ComboBoxCellEditor/src/java/example/MainPanel.java
Expand Up @@ -78,17 +78,17 @@ public static void createAndShowGUI() {
class PluginNode {
protected final String name;
protected final String[] plugins;
private int selectedPluginIndex;
private int pluginIndex;

protected PluginNode(String name, String... plugins) {
this.name = name;
this.plugins = plugins;
}
public int getSelectedPluginIndex() {
return selectedPluginIndex;
return pluginIndex;
}
public void setSelectedPluginIndex(int selectedPluginIndex) {
this.selectedPluginIndex = selectedPluginIndex;
public void setSelectedPluginIndex(int pluginIndex) {
this.pluginIndex = pluginIndex;
}
@Override public String toString() {
return name;
Expand Down
4 changes: 2 additions & 2 deletions ComboBoxDropdownSelection/src/java/example/MainPanel.java
Expand Up @@ -36,7 +36,7 @@ private MainPanel() {
removePopupMenuListener(handler);
getActionMap().put(ENTER_PRESSED, null);
super.updateUI();
Action defaultEnterPressedAction = getActionMap().get(ENTER_PRESSED);
Action defaultAction = getActionMap().get(ENTER_PRESSED);
Action a = new AbstractAction() {
@Override public void actionPerformed(ActionEvent e) {
boolean isPopupVisible = isPopupVisible();
Expand All @@ -52,7 +52,7 @@ private MainPanel() {
setSelectedIndex(0);
setPopupVisible(isPopupVisible);
} else {
defaultEnterPressedAction.actionPerformed(e);
defaultAction.actionPerformed(e);
}
}
};
Expand Down
10 changes: 5 additions & 5 deletions ComponentSizeVariant/src/java/example/MainPanel.java
Expand Up @@ -72,17 +72,17 @@ private SizeVariantUtil() { /* Singleton */ }

public static JMenu createSizeVariantMenu() {
JMenu menu = new JMenu("Resizing a Component");
ButtonGroup sizeVariantRadioGroup = new ButtonGroup();
ButtonGroup bg = new ButtonGroup();
for (String key: Arrays.asList("regular", "mini", "small", "large")) {
menu.add(createSizeVariantItem(key, sizeVariantRadioGroup));
menu.add(createSizeVariantItem(key, bg));
}
return menu;
}
private static JRadioButtonMenuItem createSizeVariantItem(String key, ButtonGroup sizeVariantRadioGroup) {
private static JRadioButtonMenuItem createSizeVariantItem(String key, ButtonGroup bg) {
JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(key, "regular".equals(key));
menuItem.addActionListener(e -> setSizeVariant(sizeVariantRadioGroup.getSelection().getActionCommand()));
menuItem.addActionListener(e -> setSizeVariant(bg.getSelection().getActionCommand()));
menuItem.setActionCommand(key);
sizeVariantRadioGroup.add(menuItem);
bg.add(menuItem);
return menuItem;
}
private static void setSizeVariant(String key) {
Expand Down

0 comments on commit 49906fd

Please sign in to comment.