summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/gui/panels
diff options
context:
space:
mode:
Diffstat (limited to 'base/src/main/java/bjc/utils/gui/panels')
-rw-r--r--base/src/main/java/bjc/utils/gui/panels/DropdownListPanel.java8
-rw-r--r--base/src/main/java/bjc/utils/gui/panels/FormattedInputPanel.java12
-rw-r--r--base/src/main/java/bjc/utils/gui/panels/HolderOutputPanel.java6
-rw-r--r--base/src/main/java/bjc/utils/gui/panels/ListParameterPanel.java36
-rw-r--r--base/src/main/java/bjc/utils/gui/panels/SimpleInputPanel.java6
-rw-r--r--base/src/main/java/bjc/utils/gui/panels/SimpleListPanel.java10
-rw-r--r--base/src/main/java/bjc/utils/gui/panels/SimpleSpinnerPanel.java4
-rw-r--r--base/src/main/java/bjc/utils/gui/panels/SliderInputPanel.java37
8 files changed, 60 insertions, 59 deletions
diff --git a/base/src/main/java/bjc/utils/gui/panels/DropdownListPanel.java b/base/src/main/java/bjc/utils/gui/panels/DropdownListPanel.java
index 4f71d38..6c57c5a 100644
--- a/base/src/main/java/bjc/utils/gui/panels/DropdownListPanel.java
+++ b/base/src/main/java/bjc/utils/gui/panels/DropdownListPanel.java
@@ -26,13 +26,13 @@ public class DropdownListPanel extends JPanel {
* Create a new dropdown list panel
*
* @param <T>
- * The type of items in the dropdown list
+ * The type of items in the dropdown list
* @param type
- * The label of the type of items in the list
+ * The label of the type of items in the list
* @param model
- * The model to put items into
+ * The model to put items into
* @param choices
- * The items to choose from
+ * The items to choose from
*/
public <T> DropdownListPanel(final String type, final DefaultListModel<T> model, final IList<T> choices) {
setLayout(new AutosizeLayout());
diff --git a/base/src/main/java/bjc/utils/gui/panels/FormattedInputPanel.java b/base/src/main/java/bjc/utils/gui/panels/FormattedInputPanel.java
index 2cecf0c..96f0487 100644
--- a/base/src/main/java/bjc/utils/gui/panels/FormattedInputPanel.java
+++ b/base/src/main/java/bjc/utils/gui/panels/FormattedInputPanel.java
@@ -15,7 +15,7 @@ import bjc.utils.gui.layout.HLayout;
* @author ben
*
* @param <InputVal>
- * The type of value being formatted
+ * The type of value being formatted
*/
public class FormattedInputPanel<InputVal> extends JPanel {
private static final long serialVersionUID = 5232016563558588031L;
@@ -26,13 +26,13 @@ public class FormattedInputPanel<InputVal> extends JPanel {
* Create a new formatted input panel
*
* @param label
- * The label for this panel
+ * The label for this panel
* @param length
- * The length of this panel
+ * The length of this panel
* @param formatter
- * The formatter to use for input
+ * The formatter to use for input
* @param reciever
- * The action to call whenever the value changes
+ * The action to call whenever the value changes
*/
@SuppressWarnings("unchecked")
public FormattedInputPanel(final String label, final int length, final AbstractFormatter formatter,
@@ -58,7 +58,7 @@ public class FormattedInputPanel<InputVal> extends JPanel {
* Reset the value in this panel to a specified value
*
* @param value
- * The value to set the panel to
+ * The value to set the panel to
*/
public void resetValues(final InputVal value) {
field.setValue(value);
diff --git a/base/src/main/java/bjc/utils/gui/panels/HolderOutputPanel.java b/base/src/main/java/bjc/utils/gui/panels/HolderOutputPanel.java
index 653dace..1cf3d88 100644
--- a/base/src/main/java/bjc/utils/gui/panels/HolderOutputPanel.java
+++ b/base/src/main/java/bjc/utils/gui/panels/HolderOutputPanel.java
@@ -25,11 +25,11 @@ public class HolderOutputPanel extends JPanel {
* Create a new display panel, backed by a holder
*
* @param lab
- * The label to attach to this field
+ * The label to attach to this field
* @param valueHolder
- * The holder to get the value from
+ * The holder to get the value from
* @param nDelay
- * The delay in ms between value updates
+ * The delay in ms between value updates
*/
public HolderOutputPanel(final String lab, final IHolder<String> valueHolder, final int nDelay) {
this.val = valueHolder;
diff --git a/base/src/main/java/bjc/utils/gui/panels/ListParameterPanel.java b/base/src/main/java/bjc/utils/gui/panels/ListParameterPanel.java
index cca73d5..f8d9b72 100644
--- a/base/src/main/java/bjc/utils/gui/panels/ListParameterPanel.java
+++ b/base/src/main/java/bjc/utils/gui/panels/ListParameterPanel.java
@@ -20,7 +20,7 @@ import bjc.utils.gui.layout.VLayout;
* @author ben
*
* @param <E>
- * The type of data stored in the list
+ * The type of data stored in the list
*/
public class ListParameterPanel<E> extends JPanel {
// Version id for serialization
@@ -30,11 +30,11 @@ public class ListParameterPanel<E> extends JPanel {
* Create a new panel using the specified actions for doing things
*
* @param add
- * The action that provides items
+ * The action that provides items
* @param edit
- * The action that edits items
+ * The action that edits items
* @param remove
- * The action that removes items
+ * The action that removes items
*/
public ListParameterPanel(final Supplier<E> add, final Consumer<E> edit, final Consumer<E> remove) {
this(add, edit, remove, null);
@@ -44,13 +44,13 @@ public class ListParameterPanel<E> extends JPanel {
* Create a new panel using the specified actions for doing things
*
* @param add
- * The action that provides items
+ * The action that provides items
* @param edit
- * The action that edits items
+ * The action that edits items
* @param remove
- * The action that removes items
+ * The action that removes items
* @param defaults
- * The default values to put in the list
+ * The default values to put in the list
*/
public ListParameterPanel(final Supplier<E> add, final Consumer<E> edit, final Consumer<E> remove,
final IList<E> defaults) {
@@ -58,7 +58,7 @@ public class ListParameterPanel<E> extends JPanel {
JList<E> list;
- if (defaults != null) {
+ if(defaults != null) {
list = SimpleJList.buildFromList(defaults.toIterable());
} else {
list = new JList<>(new DefaultListModel<>());
@@ -70,15 +70,15 @@ public class ListParameterPanel<E> extends JPanel {
int numButtons = 0;
- if (add != null) {
+ if(add != null) {
numButtons++;
}
- if (edit != null) {
+ if(edit != null) {
numButtons++;
}
- if (remove != null) {
+ if(remove != null) {
numButtons++;
}
@@ -86,7 +86,7 @@ public class ListParameterPanel<E> extends JPanel {
JButton addParam = null;
- if (add != null) {
+ if(add != null) {
addParam = new JButton("Add...");
addParam.addActionListener((event) -> {
final DefaultListModel<E> model = (DefaultListModel<E>) list.getModel();
@@ -97,7 +97,7 @@ public class ListParameterPanel<E> extends JPanel {
JButton editParam = null;
- if (edit != null) {
+ if(edit != null) {
editParam = new JButton("Edit...");
editParam.addActionListener((event) -> {
edit.accept(list.getSelectedValue());
@@ -106,7 +106,7 @@ public class ListParameterPanel<E> extends JPanel {
JButton removeParam = null;
- if (remove != null) {
+ if(remove != null) {
removeParam = new JButton("Remove...");
removeParam.addActionListener((event) -> {
final DefaultListModel<E> model = (DefaultListModel<E>) list.getModel();
@@ -115,15 +115,15 @@ public class ListParameterPanel<E> extends JPanel {
});
}
- if (add != null) {
+ if(add != null) {
buttonPanel.add(addParam);
}
- if (edit != null) {
+ if(edit != null) {
buttonPanel.add(editParam);
}
- if (remove != null) {
+ if(remove != null) {
buttonPanel.add(removeParam);
}
diff --git a/base/src/main/java/bjc/utils/gui/panels/SimpleInputPanel.java b/base/src/main/java/bjc/utils/gui/panels/SimpleInputPanel.java
index 65c533d..301a183 100644
--- a/base/src/main/java/bjc/utils/gui/panels/SimpleInputPanel.java
+++ b/base/src/main/java/bjc/utils/gui/panels/SimpleInputPanel.java
@@ -24,16 +24,16 @@ public class SimpleInputPanel extends JPanel {
* Create a new input panel
*
* @param label
- * The label for the field
+ * The label for the field
* @param columns
- * The number of columns of text input to take
+ * The number of columns of text input to take
*/
public SimpleInputPanel(final String label, final int columns) {
setLayout(new BorderLayout());
final JLabel inputLabel = new JLabel(label);
- if (columns < 1) {
+ if(columns < 1) {
inputValue = new JTextField();
} else {
inputValue = new JTextField(columns);
diff --git a/base/src/main/java/bjc/utils/gui/panels/SimpleListPanel.java b/base/src/main/java/bjc/utils/gui/panels/SimpleListPanel.java
index edc1797..628d146 100644
--- a/base/src/main/java/bjc/utils/gui/panels/SimpleListPanel.java
+++ b/base/src/main/java/bjc/utils/gui/panels/SimpleListPanel.java
@@ -28,7 +28,7 @@ public class SimpleListPanel extends JPanel {
final Consumer<String> onFailure, final JTextField addItemField) {
final String potentialItem = addItemField.getText();
- if (verifier == null || verifier.test(potentialItem)) {
+ if(verifier == null || verifier.test(potentialItem)) {
model.addElement(potentialItem);
} else {
onFailure.accept(potentialItem);
@@ -41,13 +41,13 @@ public class SimpleListPanel extends JPanel {
* Create a new list panel
*
* @param type
- * The type of things in the list
+ * The type of things in the list
* @param model
- * The model to put items into
+ * The model to put items into
* @param verifier
- * The predicate to use to verify items
+ * The predicate to use to verify items
* @param onFailure
- * The function to call when an item doesn't verify
+ * The function to call when an item doesn't verify
*/
public SimpleListPanel(final String type, final DefaultListModel<String> model,
final Predicate<String> verifier, final Consumer<String> onFailure) {
diff --git a/base/src/main/java/bjc/utils/gui/panels/SimpleSpinnerPanel.java b/base/src/main/java/bjc/utils/gui/panels/SimpleSpinnerPanel.java
index 6106182..2628c39 100644
--- a/base/src/main/java/bjc/utils/gui/panels/SimpleSpinnerPanel.java
+++ b/base/src/main/java/bjc/utils/gui/panels/SimpleSpinnerPanel.java
@@ -25,9 +25,9 @@ public class SimpleSpinnerPanel extends JPanel {
* Create a new spinner panel
*
* @param label
- * The label for the spinner
+ * The label for the spinner
* @param model
- * The model to attach to the spinner
+ * The model to attach to the spinner
*/
public SimpleSpinnerPanel(final String label, final SpinnerModel model) {
setLayout(new BorderLayout());
diff --git a/base/src/main/java/bjc/utils/gui/panels/SliderInputPanel.java b/base/src/main/java/bjc/utils/gui/panels/SliderInputPanel.java
index e6a6da4..ff4c161 100644
--- a/base/src/main/java/bjc/utils/gui/panels/SliderInputPanel.java
+++ b/base/src/main/java/bjc/utils/gui/panels/SliderInputPanel.java
@@ -38,12 +38,13 @@ public class SliderInputPanel extends JPanel {
try {
final int val = Integer.parseInt(text);
- if (val < minValue)
+ if(val < minValue)
throw new ParseException("Value must be greater than " + minValue, 0);
- else if (val > maxValue)
+ else if(val > maxValue)
throw new ParseException("Value must be smaller than " + maxValue, 0);
- else return val;
- } catch (final NumberFormatException nfex) {
+ else
+ return val;
+ } catch(final NumberFormatException nfex) {
final ParseException pex = new ParseException("Value must be a valid integer", 0);
pex.initCause(nfex);
@@ -54,7 +55,7 @@ public class SliderInputPanel extends JPanel {
@Override
public String valueToString(final Object value) throws ParseException {
- if (value == null) return Integer.toString(initValue);
+ if(value == null) return Integer.toString(initValue);
return Integer.toString((Integer) value);
}
@@ -86,9 +87,9 @@ public class SliderInputPanel extends JPanel {
* middle
*
* @param min
- * The minimum value of the slider
+ * The minimum value of the slider
* @param max
- * The maximum value of the slider
+ * The maximum value of the slider
*/
public SliderSettings(final int min, final int max) {
this(min, max, (min + max) / 2);
@@ -98,11 +99,11 @@ public class SliderInputPanel extends JPanel {
* Create a new set of slider sttings
*
* @param min
- * The minimum slider value
+ * The minimum slider value
* @param max
- * The maximum slider value
+ * The maximum slider value
* @param init
- * Th initial slider value
+ * Th initial slider value
*/
public SliderSettings(final int min, final int max, final int init) {
minValue = min;
@@ -120,15 +121,15 @@ public class SliderInputPanel extends JPanel {
* Create a new slider input panel
*
* @param lab
- * The label for the field
+ * The label for the field
* @param settings
- * The settings for slider values
+ * The settings for slider values
* @param majorTick
- * The setting for where to place big ticks
+ * The setting for where to place big ticks
* @param minorTick
- * The setting for where to place small ticks
+ * The setting for where to place small ticks
* @param action
- * The action to execute for a given value
+ * The action to execute for a given value
*/
public SliderInputPanel(final String lab, final SliderSettings settings, final int majorTick,
final int minorTick, final Consumer<Integer> action) {
@@ -145,7 +146,7 @@ public class SliderInputPanel extends JPanel {
slider.setPaintLabels(true);
slider.addChangeListener((event) -> {
- if (slider.getValueIsAdjusting()) {
+ if(slider.getValueIsAdjusting()) {
// Do nothing
} else {
final int val = slider.getValue();
@@ -161,7 +162,7 @@ public class SliderInputPanel extends JPanel {
field.addPropertyChangeListener("value", (event) -> {
final Object value = field.getValue();
- if (value == null) {
+ if(value == null) {
// Do nothing
} else {
slider.setValue((Integer) value);
@@ -177,7 +178,7 @@ public class SliderInputPanel extends JPanel {
* Reset the values in this panel to a specified value
*
* @param value
- * The value to reset the fields to
+ * The value to reset the fields to
*/
public void resetValues(final int value) {
slider.setValue(value);