Skip to content

Commit

Permalink
Extracted method from RemoteFileChooser.java
Browse files Browse the repository at this point in the history
  • Loading branch information
LaplacesCat committed Nov 27, 2024
1 parent 33c6e0a commit c1dd28c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/main/java/org/fife/rtext/RemoteFileChooser.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,10 @@ public RemoteFileChooser(RText owner) {

// Make a panel containing the OK and Cancel buttons.
JPanel buttonPanel = new JPanel(new GridLayout(1,3, 5,5));
okButton = UIUtil.newButton(msg, "OK", "OKMnemonic");
okButton.setActionCommand("OK");
okButton.addActionListener(this);
JButton cancelButton = UIUtil.newButton(msg, "Cancel",
"CancelMnemonic");
cancelButton.setActionCommand("Cancel");
cancelButton.addActionListener(this);
okButton = createButton(msg, "OK",
"OKMnemonic", "OK", this);
JButton cancelButton = createButton(msg, "Cancel",
"CancelMnemonic", "Cancel", this);
advancedButton = new JToggleButton(msg.getString("Advanced"));
advancedButton.setMnemonic((int)msg.getString("AdvancedMnemonic").
charAt(0));
Expand Down Expand Up @@ -576,5 +573,13 @@ public void updateUI() {
}
}

public JButton createButton(ResourceBundle msg, String textKey, String mnemonicKey,
String actionCommand, ActionListener actionListener) {
JButton button = UIUtil.newButton(msg, textKey, mnemonicKey);
button.setActionCommand(actionCommand);
button.addActionListener(actionListener);

return button;
}

}

0 comments on commit c1dd28c

Please sign in to comment.