Package ca.corbett.forms.fields
Class LongTextField
java.lang.Object
ca.corbett.forms.fields.FormField
ca.corbett.forms.fields.LongTextField
A FormField implementation specifically for long (multi-line) text input.
The wrapped component is a JTextArea, which you can access directly
if needed via the getTextArea() method.
- Author:
- scorbo2
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class ca.corbett.forms.fields.FormField
DEFAULT_FONT, defaultFont, extraAttributes, fieldComponent, fieldLabel, fieldValidators, helpLabel, identifier, isEnabled, isVisible, margins, validationLabel, valueChangedListeners -
Method Summary
Modifier and TypeMethodDescriptionReturns the JScrollPane if direct access is required.getText()Returns the text currently in this field.Returns the underlying JTextArea for this field if direct access is required..booleanReports whether a NonBlankFieldValidator has been added to this TextField.booleanWhether to show a button to allow a popup dialog with a much larger text edit option.booleanBy default, FormFields occupy a single "line", or row, on the form.static LongTextFieldofDynamicSizingMultiLine(String label, int rows) Creates a JTextArea with dynamic width and with the specified number of rows.static LongTextFieldofFixedPixelSizeMultiLine(String label, int width, int height) Creates a JTextArea whose scroll pane will be fixed to the given pixel dimensions.static LongTextFieldofFixedSizeMultiLine(String label, int rows, int cols) Creates a JTextArea with the specified number of rows and columns.setAllowBlank(boolean allow) By default, TextField will allow blank values (empty text) to pass validation.setAllowPopoutEditing(boolean allow) Whether to show a button to allow a popup dialog with a much larger text edit option.voidsetEnabled(boolean enabled) Overridden here so we can also enable or disable our text area.Sets the text in this field.booleanBy default, FormPanel will allocate only the space that the field component requires.Methods inherited from class ca.corbett.forms.fields.FormField
addAllExtraAttributes, addFieldValidator, addValueChangedListener, clearExtraAttribute, clearExtraAttributes, clearValidationResults, equals, fireValueChangedEvent, getDefaultFont, getExtraAttribute, getFieldComponent, getFieldLabel, getHelpLabel, getHelpText, getIdentifier, getMargins, getValidationLabel, hasFieldLabel, hashCode, hasHelpLabel, hasValidationLabel, isEnabled, isValid, isVisible, preRender, removeAllFieldValidators, removeFieldValidator, removeValueChangedListener, setAllExtraAttributes, setDefaultFont, setExtraAttribute, setFieldLabelFont, setHelpText, setIdentifier, setMargins, setVisible, validate
-
Method Details
-
ofFixedSizeMultiLine
Creates a JTextArea with the specified number of rows and columns. -
ofFixedPixelSizeMultiLine
Creates a JTextArea whose scroll pane will be fixed to the given pixel dimensions. Usage of explicit pixel dimensions is discouraged, as it doesn't play with with font size changes or with certain Look and Feels. -
ofDynamicSizingMultiLine
Creates a JTextArea with dynamic width and with the specified number of rows. The width of the text area will expand to fill the available width in the container panel. -
setEnabled
public void setEnabled(boolean enabled) Overridden here so we can also enable or disable our text area.- Overrides:
setEnabledin classFormField- Parameters:
enabled- whether to enable or disable the components.
-
getText
Returns the text currently in this field.- Returns:
- The current text value.
-
setText
Sets the text in this field. Will overwrite any previous text.- Parameters:
text- The new text.
-
isAllowBlank
public boolean isAllowBlank()Reports whether a NonBlankFieldValidator has been added to this TextField. -
setAllowBlank
By default, TextField will allow blank values (empty text) to pass validation. You can disallow that with this method - passing false will add a NonBlankFieldValidator to this TextField. Passing true will remove the NonBlankFieldValidator if one is present. -
isAllowPopoutEditing
public boolean isAllowPopoutEditing()Whether to show a button to allow a popup dialog with a much larger text edit option. -
setAllowPopoutEditing
Whether to show a button to allow a popup dialog with a much larger text edit option. -
getScrollPane
Returns the JScrollPane if direct access is required. -
getTextArea
Returns the underlying JTextArea for this field if direct access is required.. -
isMultiLine
public boolean isMultiLine()Description copied from class:FormFieldBy default, FormFields occupy a single "line", or row, on the form. However, some FormFields may have a field component that spans multiple lines, like a multi-line text box, or a list, or a custom panel. Descendant classes can override the default false value here. It controls the placement of the field label. For tall form fields, the field label will be anchored to the top-left of its area.- Overrides:
isMultiLinein classFormField
-
shouldExpand
public boolean shouldExpand()Description copied from class:FormFieldBy default, FormPanel will allocate only the space that the field component requires. Descendant classes can override the default false value here to indicate that their field component should be allowed to expand as much space as is available to it. For example: PanelField.- Overrides:
shouldExpandin classFormField
-