Class JAutoScrolledText

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, SwingConstants
Direct Known Subclasses:
SimpleEnumScalarViewer, SimpleScalarViewer, StateStatusViewer

public class JAutoScrolledText extends JTextField
Text component which supports antialiased font and autoscrolling. When autoscroll is enabled and when the text cannot be totaly displayed, JAutoScrolledText automagicaly scrolls the text from right to left.
See Also:
  • Field Details

    • CENTER_ALIGNMENT

      public static int CENTER_ALIGNMENT
      Specifies alignment to the center of the component.
    • LEFT_ALIGNMENT

      public static int LEFT_ALIGNMENT
      Specifies alignment to the left side of the component.
    • RIGHT_ALIGNMENT

      public static int RIGHT_ALIGNMENT
      Specifies alignment to the right side of the component.
    • CLASSIC_BEHAVIOR

      public static int CLASSIC_BEHAVIOR
      Computes font size and return the minimun size to the layout manager
    • MATRIX_BEHAVIOR

      public static int MATRIX_BEHAVIOR
      Does not compute font size and let the layout manager size the component
    • SCROLL_TO_SEE_END

      public static final int SCROLL_TO_SEE_END
      Scroll the text until the end of the text is reached and restart
      See Also:
    • SCROLL_LOOP

      public static final int SCROLL_LOOP
      Continuous scrolling
      See Also:
  • Constructor Details

    • JAutoScrolledText

      public JAutoScrolledText()
      Constructs an empty text.
  • Method Details

    • setMargin

      public void setMargin(Insets i)
      Sets the margin of this components.
      Overrides:
      setMargin in class JTextComponent
      Parameters:
      i - Margin value
    • getMargin

      public Insets getMargin()
      Overrides:
      getMargin in class JTextComponent
      Returns:
      the margin of this components.
    • setWaitTime

      public void setWaitTime(int ms)
      Sets the half time between scroll animations.
      Parameters:
      ms - Half wait time (in millisecs)
    • setSizingBehavior

      public void setSizingBehavior(int s)
      Sets the sizing behavior.
      Parameters:
      s - Sizing behavior
      See Also:
    • getSizingBehavior

      public int getSizingBehavior()
      Gets the sizing behavior.
      Returns:
      Actual sizing behavior
      See Also:
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JTextField
    • getMinimumSize

      public Dimension getMinimumSize()
      Overrides:
      getMinimumSize in class JComponent
    • setAutoScroll

      public void setAutoScroll(int time)
      Set the autoscroll mode. When autoscroll is enabled and when the text cannot be totaly displayed, JAutoScrolledText automagicaly scrolls the text from right to left.
      Parameters:
      time - Scrolling refresh rate (millisec), 0 will disable scrolling.
    • getSleepTime

      public int getSleepTime()
    • setSleepTime

      public void setSleepTime(int sleepTime)
    • getWaitTime

      public int getWaitTime()
    • setText

      public void setText(String txt)
      Sets the text of this component.
      Overrides:
      setText in class JTextComponent
      Parameters:
      txt - Text to display
    • getText

      public String getText()
      Overrides:
      getText in class JTextComponent
    • setVerticalOffset

      public void setVerticalOffset(int y)
      Sets the text vertical offset in pixel.
      Parameters:
      y - Offset value
    • getVerticalOffset

      public int getVerticalOffset()
      Returns:
      the current text vertical offset.
    • setHorizontalOffset

      public void setHorizontalOffset(int y)
      Sets the text horizontal offset in pixel.
      Parameters:
      y - Offset value
    • getHorizontalOffset

      public int getHorizontalOffset()
      Returns:
      the current text horizontal offset.
    • setValueOffsets

      public void setValueOffsets(int x, int y)
      Deprecated.
      Has no longer effects.
      Parameters:
      x - Not used
      y - Not used
      See Also:
    • setHorizontalAlignment

      public void setHorizontalAlignment(int a)
      Sets alignment policiy (when no scroll)
      Overrides:
      setHorizontalAlignment in class JTextField
      Parameters:
      a - Alignment mode
      See Also:
    • paint

      public void paint(Graphics g)
      Paint the component.
      Overrides:
      paint in class JComponent
    • addTextListener

      public void addTextListener(JAutoScrolledTextListener l)
      Add the specified JAutoScrolledTextListener Listeners
      Parameters:
      l - Listener to add
    • removeTextListener

      public void removeTextListener(JAutoScrolledTextListener l)
      Remove the specified JAutoScrolledTextListener Listeners
      Parameters:
      l - Listener to remove
    • getScrollingMode

      public int getScrollingMode()
      Returns:
      the scrolling mode.
      See Also:
    • setScrollingMode

      public void setScrollingMode(int scrollingMode)
      Set the scrolling mode.
      Parameters:
      scrollingMode - Scrolling mode
      See Also:
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception