Class URLTextAreaButton

All Implemented Interfaces:
ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, SwingConstants

public class URLTextAreaButton extends JButton
Button to display a URLTextAreaPane. There are several protected methods that can be used to interact with an application: The methods whose names start with input are called when the button is pushed and before a dialog box appears. The methods whose names start with output are called after the dialog box is closed. Whether input or output methods are called at all depends on a mode provided in a constructor. The default when a constructor does not provide a mode is to use both the input and output methods.
See Also:
  • Constructor Details

    • URLTextAreaButton

      public URLTextAreaButton(String label, int rows, int cols, Component frame, String title, String errorTitle, URLTextAreaButton.Mode mode)
      Constructor with mode.
      Parameters:
      label - the button label
      rows - the number of rows for text
      cols - the number of columns for text
      frame - the frame on which to center a dialog box; null if none
      title - the title of the dialog box
      errorTitle - the title of dialog boxes used when handling errors
      mode - the enumeration values are USE_OUTPUT_NO_STATE when inputs and outputs are set using protected methods, USE_OUTPUT_WITH_STATE when outputs but not inputs are set by protected methods, and NO_OUTPUT_WITH_STATE when protected methods for setting inputs and outputs are not used at all.
      See Also:
    • URLTextAreaButton

      public URLTextAreaButton(String label, int rows, int cols, Component frame, String title, String titleError)
      Constructor with default mode.
      Parameters:
      label - the button label
      rows - the number of rows for text
      cols - the number of columns for text
      frame - the frame on which to center a dialog box; null if none
      title - the title of the dialog box
      titleError - the title of dialog boxes used when handling errors
  • Method Details

    • outputURLInUse

      protected void outputURLInUse(boolean inUse)
      Called to indicate whether a URL was used to create the text. Users should override it to perform any necessary actions based on whether the URL is valid or not (e.g., to store a flag permanently). This is called before outputText and outputURL is called.
      Parameters:
      inUse - true if it was; false otherwise.
      See Also:
    • outputText

      protected void outputText(String value)
      Called to write text from this component. This is called when the dialog box is dismissed. Users should override it to perform any necessary actions based on that text.
      Parameters:
      value - the new text.
      See Also:
    • outputURL

      protected void outputURL(String url)
      Called to write the URL used to load this component. This is called when the dialog box is dismissed. Users should override it to perform any necessary actions based on that URL (e.g., to store it permanently).
      Parameters:
      url - the URL
      See Also:
    • inputText

      protected String inputText()
      Obtain input text when a URL does not specify the location of the text.
      Returns:
      the text of the component
      See Also:
    • inputURL

      protected String inputURL()
      Obtain the URL when a URL specifies the location of the text.
      Returns:
      the URL
      See Also:
    • inputURLInUse

      protected boolean inputURLInUse()
      Indicate if a URL will specify the location of the text. This is called when the button is pushed before inputText or inputURL.
      Returns:
      true if a URL will specify the location of the text; false otherwise
      See Also:
    • getTextAreaText

      public String getTextAreaText()
      Get Text.
      Returns:
      the text associated with the component
    • getURL

      public String getURL()
      Get the URL.
      Returns:
      the URL for the component's text; a null string if there is none
    • getURLInUse

      public boolean getURLInUse()
      Determine URL status.
      Returns:
      true if the text was loaded from a resource given by a URL; false otherwise