Class MultiFormatTextField

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

public class MultiFormatTextField extends JTextField
Overrides the JTextField mainly to allow hint painting for the current input format. It also handles processing control-M to switch modes.
See Also:
  • Constructor Details

  • Method Details

    • addTextChangedCallback

      public void addTextChangedCallback(Callback c)
      Uses the given callback to notify the client when the text has changed in this text field.
      Parameters:
      c - the callback to be notified when the text changes in this field
    • getHint

      protected String getHint()
    • setToolTipAppendix

      public void setToolTipAppendix(String appendix)
    • getToolTipText

      public String getToolTipText(MouseEvent event)
      Overrides:
      getToolTipText in class JTextComponent
    • getHintToolTipText

      protected String getHintToolTipText()
    • setFormat

      public void setFormat(IntegerFormat format)
      Sets the IntegerFormat that will be used to format and parse the text in this field.
      Parameters:
      format - the number format that will be used to format and parse the text in this field
    • setShowInputFormatHint

      public void setShowInputFormatHint(boolean show)
      Turns on or off the faded hint text that displays the field's current format (i.e., hex, decimal).
      Parameters:
      show - true to show the input format.
    • paintComponent

      protected void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent