Package io.github.jonestimd.swing
Class ComponentFactory
- java.lang.Object
-
- io.github.jonestimd.swing.ComponentFactory
-
public class ComponentFactory extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ACCELERATOR_DELIMITER
static int
LABEL_GAP
static char
NO_MNEMONIC
static java.lang.String
TOOLBAR_BUTTON_ACTION_KEY
-
Constructor Summary
Constructors Constructor Description ComponentFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static javax.swing.JCheckBox
newCheckBox(java.util.ResourceBundle bundle, java.lang.String mnemonicAndNameKey)
static <T extends java.lang.Enum<T>>
BeanListComboBox<T>newComboBox(java.lang.Class<T> enumClass, java.lang.String requiredMessage)
static <T extends java.lang.Enum<T>>
BeanListComboBox<T>newComboBox(java.util.List<T> items, java.lang.String requiredMessage)
javax.swing.JTextField
newFilterField()
<T> FilterField<T>
newFilterField(java.util.function.Function<java.lang.String,java.util.function.Predicate<T>> predicateFactory, int paddingTop, int paddingBottom)
static javax.swing.JComponent
newFormSeparator(java.lang.String label)
static javax.swing.JMenu
newMenu(java.util.ResourceBundle bundle, java.lang.String mnemonicAndNameKey)
static javax.swing.JSeparator
newMenuBarSeparator()
static javax.swing.JToolBar
newMenuToolBar()
static javax.swing.JRadioButton[]
newRadioButtonGroup(java.util.ResourceBundle bundle, java.lang.String... mnemonicAndNameKeys)
static javax.swing.JComponent
newTableSummaryPanel(java.lang.String mnemonicAndName, javax.swing.JComponent summary)
Create a component for displaying a summary (e.g.static javax.swing.JButton
newToolbarButton(javax.swing.Action action)
Creates a button for a toolbar.static javax.swing.JToggleButton
newToolbarToggleButton(javax.swing.Action action)
Creates a toggle button for a toolbar.static javax.swing.JTextArea
newValidationStatusArea(int rows, java.util.ResourceBundle bundle)
-
-
-
Field Detail
-
NO_MNEMONIC
public static final char NO_MNEMONIC
- See Also:
- Constant Field Values
-
ACCELERATOR_DELIMITER
public static final java.lang.String ACCELERATOR_DELIMITER
-
TOOLBAR_BUTTON_ACTION_KEY
public static final java.lang.String TOOLBAR_BUTTON_ACTION_KEY
- See Also:
- Constant Field Values
-
LABEL_GAP
public static final int LABEL_GAP
- See Also:
- Constant Field Values
-
-
Method Detail
-
newRadioButtonGroup
public static javax.swing.JRadioButton[] newRadioButtonGroup(java.util.ResourceBundle bundle, java.lang.String... mnemonicAndNameKeys)
-
newCheckBox
public static javax.swing.JCheckBox newCheckBox(java.util.ResourceBundle bundle, java.lang.String mnemonicAndNameKey)
-
newValidationStatusArea
public static javax.swing.JTextArea newValidationStatusArea(int rows, java.util.ResourceBundle bundle)
-
newFormSeparator
public static javax.swing.JComponent newFormSeparator(java.lang.String label)
-
newMenuBarSeparator
public static javax.swing.JSeparator newMenuBarSeparator()
-
newMenuToolBar
public static javax.swing.JToolBar newMenuToolBar()
-
newToolbarToggleButton
public static javax.swing.JToggleButton newToolbarToggleButton(javax.swing.Action action)
Creates a toggle button for a toolbar. Sets the button's tooltip text using the button's text and accelerator.- Parameters:
action
- the button action (should have text and an icon)- Returns:
- the new button
- See Also:
Action.ACCELERATOR_KEY
-
newToolbarButton
public static javax.swing.JButton newToolbarButton(javax.swing.Action action)
Creates a button for a toolbar. Sets the button's tooltip text using the action's text and accelerator key.- Parameters:
action
- the button action (should have text and an icon)- Returns:
- a new non-focusable button with
null
text - See Also:
Action.ACCELERATOR_KEY
-
newMenu
public static javax.swing.JMenu newMenu(java.util.ResourceBundle bundle, java.lang.String mnemonicAndNameKey)
-
newFilterField
public javax.swing.JTextField newFilterField()
-
newFilterField
public <T> FilterField<T> newFilterField(java.util.function.Function<java.lang.String,java.util.function.Predicate<T>> predicateFactory, int paddingTop, int paddingBottom)
- Parameters:
predicateFactory
- filter string parserpaddingTop
- padding between top of border and input fieldpaddingBottom
- padding between bottom of border and input field
-
newTableSummaryPanel
public static javax.swing.JComponent newTableSummaryPanel(java.lang.String mnemonicAndName, javax.swing.JComponent summary)
Create a component for displaying a summary (e.g. total) at the bottom of a table. The right border will provide an offset to account for a vertical scroll bar on the table.- Parameters:
mnemonicAndName
- label for the summarysummary
- the summary information- Returns:
- a component with the label and summary on the right
-
newComboBox
public static <T extends java.lang.Enum<T>> BeanListComboBox<T> newComboBox(java.lang.Class<T> enumClass, java.lang.String requiredMessage)
-
newComboBox
public static <T extends java.lang.Enum<T>> BeanListComboBox<T> newComboBox(java.util.List<T> items, java.lang.String requiredMessage)
-
-