Class LongTextField

java.lang.Object
ca.corbett.forms.fields.FormField
ca.corbett.forms.fields.LongTextField

public class LongTextField extends FormField
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
  • Method Details

    • ofFixedSizeMultiLine

      public static LongTextField ofFixedSizeMultiLine(String label, int rows, int cols)
      Creates a JTextArea with the specified number of rows and columns.
    • ofFixedPixelSizeMultiLine

      public static LongTextField ofFixedPixelSizeMultiLine(String label, int width, int height)
      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

      public static LongTextField ofDynamicSizingMultiLine(String label, int rows)
      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:
      setEnabled in class FormField
      Parameters:
      enabled - whether to enable or disable the components.
    • getText

      public String getText()
      Returns the text currently in this field.
      Returns:
      The current text value.
    • setText

      public LongTextField setText(String text)
      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

      public LongTextField setAllowBlank(boolean allow)
      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

      public LongTextField setAllowPopoutEditing(boolean allow)
      Whether to show a button to allow a popup dialog with a much larger text edit option.
    • getScrollPane

      public JScrollPane getScrollPane()
      Returns the JScrollPane if direct access is required.
    • getTextArea

      public JTextArea getTextArea()
      Returns the underlying JTextArea for this field if direct access is required..
    • isMultiLine

      public boolean isMultiLine()
      Description copied from class: FormField
      By 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:
      isMultiLine in class FormField
    • shouldExpand

      public boolean shouldExpand()
      Description copied from class: FormField
      By 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:
      shouldExpand in class FormField