From f0e585d22c24eec3a723c6f0ea2a18252c570303 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Wed, 16 Nov 2016 11:22:33 -0500 Subject: Documentation update --- .../java/bjc/utils/gui/SimpleInternalFrame.java | 16 ++++++++++++++- .../java/bjc/utils/gui/TextAreaOutputStream.java | 6 ++++++ .../bjc/utils/gui/panels/DropdownListPanel.java | 24 +++++++++++++++++++--- .../bjc/utils/gui/panels/SimpleInputPanel.java | 13 ++++++++++++ .../java/bjc/utils/gui/panels/SimpleListPanel.java | 20 +++++++++++++++++- .../bjc/utils/gui/panels/SimpleSpinnerPanel.java | 13 ++++++++++++ 6 files changed, 87 insertions(+), 5 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/gui') diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalFrame.java b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalFrame.java index 61c6702..a7f2183 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalFrame.java +++ b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalFrame.java @@ -2,13 +2,28 @@ package bjc.utils.gui; import javax.swing.JInternalFrame; +/** + * A simple internal frame class + * + * @author ben + * + */ public class SimpleInternalFrame extends JInternalFrame { private static final long serialVersionUID = -2966801321260716617L; + /** + * Create a new blank internal frame + */ public SimpleInternalFrame() { super(); } + /** + * Create a new blank internal frame with a specific title + * + * @param title + * The title of the internal frame + */ public SimpleInternalFrame(String title) { super(title); } @@ -22,5 +37,4 @@ public class SimpleInternalFrame extends JInternalFrame { setMaximizable(true); setIconifiable(true); } - } \ No newline at end of file diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/TextAreaOutputStream.java b/BJC-Utils2/src/main/java/bjc/utils/gui/TextAreaOutputStream.java index e512d6b..6080462 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/gui/TextAreaOutputStream.java +++ b/BJC-Utils2/src/main/java/bjc/utils/gui/TextAreaOutputStream.java @@ -13,6 +13,12 @@ public class TextAreaOutputStream extends OutputStream { private JTextArea textArea; + /** + * Create a new output stream attached to a textarea + * + * @param console + * The textarea to write to + */ public TextAreaOutputStream(JTextArea console) { this.textArea = console; } diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/DropdownListPanel.java b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/DropdownListPanel.java index 2231760..c98eea3 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/DropdownListPanel.java +++ b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/DropdownListPanel.java @@ -13,10 +13,27 @@ import bjc.utils.funcdata.IList; import bjc.utils.gui.layout.AutosizeLayout; import bjc.utils.gui.layout.HLayout; +/** + * A panel that allows you to select choices from a dropdown list + * + * @author ben + * + */ public class DropdownListPanel extends JPanel { private static final long serialVersionUID = 2719963952350133541L; - @SuppressWarnings("unchecked") + /** + * Create a new dropdown list panel + * + * @param + * The type of items in the dropdown list + * @param itemType + * The label of the type of items in the list + * @param listModel + * The model to put items into + * @param choices + * The items to choose from + */ public DropdownListPanel(String itemType, DefaultListModel listModel, IList choices) { setLayout(new AutosizeLayout()); @@ -41,7 +58,8 @@ public class DropdownListPanel extends JPanel { JButton removeItemButton = new JButton("Remove " + itemType); addItemButton.addActionListener((ev) -> { - listModel.addElement((T) addItemBox.getSelectedItem()); + listModel.addElement( + addItemBox.getItemAt(addItemBox.getSelectedIndex())); }); removeItemButton.addActionListener((ev) -> { @@ -54,4 +72,4 @@ public class DropdownListPanel extends JPanel { add(itemInputPanel); } -} +} \ No newline at end of file diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleInputPanel.java b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleInputPanel.java index fd981ec..eb900aa 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleInputPanel.java +++ b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleInputPanel.java @@ -6,11 +6,24 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +/** + * A simple component for text input + * @author ben + * + */ public class SimpleInputPanel extends JPanel { private static final long serialVersionUID = -4734279623645236868L; + /** + * The text field containing the input value + */ public final JTextField inputValue; + /** + * Create a new input panel + * @param label The label for the field + * @param columns The number of columns of text input to take + */ public SimpleInputPanel(String label, int columns) { setLayout(new BorderLayout()); diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleListPanel.java b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleListPanel.java index 62aac0d..e034b48 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleListPanel.java +++ b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleListPanel.java @@ -15,6 +15,12 @@ import javax.swing.ListSelectionModel; import bjc.utils.gui.layout.AutosizeLayout; import bjc.utils.gui.layout.HLayout; +/** + * A simple list of strings + * + * @author ben + * + */ public class SimpleListPanel extends JPanel { private static final long serialVersionUID = 2719963952350133541L; @@ -33,6 +39,18 @@ public class SimpleListPanel extends JPanel { addItemField.setText(""); } + /** + * Create a new list panel + * + * @param itemType + * The type of things in the list + * @param listModel + * The model to put items into + * @param itemVerifier + * The predicate to use to verify items + * @param onVerificationFailure + * The function to call when an item doesn't verify + */ public SimpleListPanel(String itemType, DefaultListModel listModel, Predicate itemVerifier, @@ -78,4 +96,4 @@ public class SimpleListPanel extends JPanel { add(itemInputPanel); } -} +} \ No newline at end of file diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleSpinnerPanel.java b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleSpinnerPanel.java index 7bbf83e..7b138c5 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleSpinnerPanel.java +++ b/BJC-Utils2/src/main/java/bjc/utils/gui/panels/SimpleSpinnerPanel.java @@ -7,11 +7,24 @@ import javax.swing.JPanel; import javax.swing.JSpinner; import javax.swing.SpinnerModel; +/** + * A simple spinner control + * @author ben + * + */ public class SimpleSpinnerPanel extends JPanel { private static final long serialVersionUID = -4734279623645236868L; + /** + * The spinner being used + */ public final JSpinner inputValue; + /** + * Create a new spinner panel + * @param label The label for the spinner + * @param model The model to attach to the spinner + */ public SimpleSpinnerPanel(String label, SpinnerModel model) { setLayout(new BorderLayout()); -- cgit v1.2.3