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 voidMakes the given document convert all upper case input to lower case, supportsSizedDocumentandAbstractDocumentstatic voidmaximumLength(Document document, int maximumLength) Sets the maximum length for the given document, supportsSizedDocumentandAbstractDocumentstatic intstatic Dimensionstatic <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 voidMakes the given document convert all lower case input to upper case, supportsSizedDocumentandAbstractDocument
-
Method Details
-
maximumLength
Sets the maximum length for the given document, supportsSizedDocumentandAbstractDocument- Parameters:
document- the documentmaximumLength- the maximum string length
-
upperCase
Makes the given document convert all lower case input to upper case, supportsSizedDocumentandAbstractDocument- Parameters:
document- the document
-
lowerCase
Makes the given document convert all upper case input to lower case, supportsSizedDocumentandAbstractDocument- 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
-