diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-02-29 10:41:17 -0500 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-02-29 10:41:17 -0500 |
| commit | 82951e37e10b282d9a7c89f4662990b64949c943 (patch) | |
| tree | f84770bf755c4d187ef46e137082248c2709fed9 /BJC-Utils2/src/main/java/bjc/utils/gui | |
| parent | 68faea64a4b1ef23acba209ad502e4458eb16290 (diff) | |
General code cleanup
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/gui')
4 files changed, 35 insertions, 21 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/FileNotChosenException.java b/BJC-Utils2/src/main/java/bjc/utils/gui/FileNotChosenException.java index b972596..2876b1d 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/gui/FileNotChosenException.java +++ b/BJC-Utils2/src/main/java/bjc/utils/gui/FileNotChosenException.java @@ -4,10 +4,24 @@ import java.io.IOException; /** * Represents the user failing to choose a file. + * * @author ben * */ public class FileNotChosenException extends IOException { private static final long serialVersionUID = -8753348705210831096L; + + public FileNotChosenException() { + super(); + } + /** + * Create a new exception with the given cause + * + * @param cause + * The cause of why the exception was thrown + */ + public FileNotChosenException(String cause) { + super(cause); + } } diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/ListParameterPanel.java b/BJC-Utils2/src/main/java/bjc/utils/gui/ListParameterPanel.java index 3cdfd47..6272b5f 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/gui/ListParameterPanel.java +++ b/BJC-Utils2/src/main/java/bjc/utils/gui/ListParameterPanel.java @@ -72,15 +72,14 @@ public class ListParameterPanel<E> extends JPanel { buttonPanel.setLayout(new HLayout(3)); JButton addParam = new JButton("Add..."); + JButton editParam = new JButton("Edit..."); + JButton removeParam = new JButton("Remove..."); + addParam.addActionListener( (ev) -> ((DefaultListModel<E>) list.getModel()) .addElement(addAct.get())); - - JButton editParam = new JButton("Edit..."); editParam.addActionListener( (ev) -> editAct.accept(list.getSelectedValue())); - - JButton removeParam = new JButton("Remove..."); removeParam.addActionListener((ev) -> removeAct .accept(((DefaultListModel<E>) list.getModel()) .remove(list.getSelectedIndex()))); diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleDialogs.java b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleDialogs.java index ea48977..0acbd65 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleDialogs.java +++ b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleDialogs.java @@ -78,8 +78,9 @@ public class SimpleDialogs { JPanel buttonPane = new JPanel(); JButton okButton = new JButton("Ok"); - okButton.addActionListener(e -> jd.dispose()); JButton cancelButton = new JButton("Cancel"); + + okButton.addActionListener(e -> jd.dispose()); cancelButton.addActionListener(e -> jd.dispose()); buttonPane.add(cancelButton); diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java b/BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java index 2e13949..c12119f 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java +++ b/BJC-Utils2/src/main/java/bjc/utils/gui/awt/SimpleFileDialog.java @@ -23,6 +23,19 @@ public class SimpleFileDialog { * The parent of the file picker * @param title * The title of the file picker + * @return The file the user picked + */ + public static File getOpenFile(Frame par, String title) { + return getOpenFile(par, title, (String[]) null); + } + + /** + * Prompt the user to pick a file to open + * + * @param par + * The parent of the file picker + * @param title + * The title of the file picker * @param extensions * The extensions to accept as valid * @return The file the user picked @@ -48,7 +61,7 @@ public class SimpleFileDialog { } /** - * Prompt the user to pick a file to open + * Prompt the user to pick a file to save * * @param par * The parent of the file picker @@ -56,8 +69,8 @@ public class SimpleFileDialog { * The title of the file picker * @return The file the user picked */ - public static File getOpenFile(Frame par, String title) { - return getOpenFile(par, title, (String[]) null); + public static File getSaveFile(Frame par, String title) { + return getSaveFile(par, title, (String[]) null); } /** @@ -90,17 +103,4 @@ public class SimpleFileDialog { return fd.getFiles()[0]; } - - /** - * Prompt the user to pick a file to save - * - * @param par - * The parent of the file picker - * @param title - * The title of the file picker - * @return The file the user picked - */ - public static File getSaveFile(Frame par, String title) { - return getSaveFile(par, title, (String[]) null); - } } |
