Module is.codion.swing.common.ui
Class TextComponents
java.lang.Object
is.codion.swing.common.ui.component.text.TextComponents
A utility class for JTextComponents.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Makes the given document convert all upper case input to lower case, supportsSizedDocument
andAbstractDocument
static void
maximumLength
(Document document, int maximumLength) Sets the maximum length for the given document, supportsSizedDocument
andAbstractDocument
static int
static Dimension
static <T extends JTextComponent>
TselectAllOnFocusGained
(T textComponent) Selects all text in the given component when it gains focus and clears the selection when focus is loststatic <T extends JTextComponent>
TselectNoneOnFocusGained
(T textComponent) Reverts the functionality added viaselectAllOnFocusGained(JTextComponent)
.static void
Makes the given document convert all lower case input to upper case, supportsSizedDocument
andAbstractDocument
-
Method Details
-
maximumLength
Sets the maximum length for the given document, supportsSizedDocument
andAbstractDocument
- Parameters:
document
- the documentmaximumLength
- the maximum string length
-
upperCase
Makes the given document convert all lower case input to upper case, supportsSizedDocument
andAbstractDocument
- Parameters:
document
- the document
-
lowerCase
Makes the given document convert all upper case input to lower case, supportsSizedDocument
andAbstractDocument
- Parameters:
document
- the document
-
selectAllOnFocusGained
Selects all text in the given component when it gains focus and clears the selection when focus is lost- Type Parameters:
T
- the component type- Parameters:
textComponent
- the text component- Returns:
- the component
-
selectNoneOnFocusGained
Reverts the functionality added viaselectAllOnFocusGained(JTextComponent)
.- Type Parameters:
T
- the component type- Parameters:
textComponent
- the text component- Returns:
- the text component
- See Also:
-
preferredTextFieldSize
- Returns:
- the preferred size of a JTextField
-
preferredTextFieldHeight
public static int preferredTextFieldHeight()- Returns:
- the preferred height of a JTextField
-