java.lang.Object
com.marginallyclever.ro3.PanelHelper
PanelHelper
is a collection of static methods to help build panels.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addColorChooser
(JPanel parent, String title, Color startColor, Consumer<Color> consumer, GridBagConstraints gbc) static void
addLabelAndComponent
(JPanel pane, String labelText, JComponent component) A convenience method to add a label and component to a panel that is built withGridLayout
.static void
addLabelAndComponent
(JPanel pane, String labelText, JComponent component, GridBagConstraints gbc) A convenience method to add a label and component to a panel that is built withGridBagLayout
.static void
addLimit
(JPanel pane, GridBagConstraints gbc, String label, double value, Consumer<Double> consumer, double infinite) static <T extends Node>
NodeSelector<T> addNodeSelector
(JPanel pane, String label, NodePath<T> nodePath, GridBagConstraints gbc) A convenience method to add a label and component to a panel that is expected to be built with GridBagConstraint.static JFormattedTextField
addNumberField
(String label, double value) static void
addSelector
(JPanel pane, GridBagConstraints gbc, String label, NodePath<ODEBody> originalValue, Consumer<ODEBody> consumer) static void
enableLimit
(boolean isSelected, JSpinner spinner, Consumer<Double> consumer, double infinite)
-
Constructor Details
-
PanelHelper
public PanelHelper()
-
-
Method Details
-
addLabelAndComponent
A convenience method to add a label and component to a panel that is built with
GridLayout
.- Parameters:
pane
- the panel to add tolabelText
- the text for the labelcomponent
- the component to add
-
addLabelAndComponent
public static void addLabelAndComponent(JPanel pane, String labelText, JComponent component, GridBagConstraints gbc) A convenience method to add a label and component to a panel that is built with
GridBagLayout
.- Parameters:
pane
- the panel to add tolabelText
- the text for the labelcomponent
- the component to addgbc
- the GridBagConstraints to use
-
addNodeSelector
public static <T extends Node> NodeSelector<T> addNodeSelector(JPanel pane, String label, NodePath<T> nodePath, GridBagConstraints gbc) A convenience method to add a label and component to a panel that is expected to be built with GridBagConstraint.- Type Parameters:
T
- the type filter for theNodeSelector
.- Parameters:
pane
- the panel to add tolabel
- the text for the labelnodePath
- the NodePath to usegbc
- theGridBagConstraints
to use- Returns:
- the NodeSelector
-
addColorChooser
-
addNumberField
-
addLimit
public static void addLimit(JPanel pane, GridBagConstraints gbc, String label, double value, Consumer<Double> consumer, double infinite) -
enableLimit
-
addSelector
-