fr.esrf.tangoatk.widget.util
Class JAutoScrolledText

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JTextField
                      extended by fr.esrf.tangoatk.widget.util.JAutoScrolledText
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable, javax.swing.SwingConstants
Direct Known Subclasses:
SimpleEnumScalarViewer, SimpleScalarViewer

public class JAutoScrolledText
extends javax.swing.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:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JTextField
javax.swing.JTextField.AccessibleJTextField
 
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int CENTER_ALIGNMENT
          Specifies alignment to the center of the component.
static int CLASSIC_BEHAVIOR
          Computes font size and return the minimun size to the layout manager
static int LEFT_ALIGNMENT
          Specifies alignment to the left side of the component.
static int MATRIX_BEHAVIOR
          Does not compute font size and let the layout manager size the component
static int RIGHT_ALIGNMENT
          Specifies alignment to the right side of the component.
static int SCROLL_LOOP
          Continuous scrolling
static int SCROLL_TO_SEE_END
          Scroll the text until the end of the text is reached and restart
 
Fields inherited from class javax.swing.JTextField
notifyAction
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
Fields inherited from class javax.swing.JComponent
accessibleContext, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JAutoScrolledText()
          Constructs an empty text.
 
Method Summary
 void addTextListener(JAutoScrolledTextListener l)
          Add the specified JAutoScrolledTextListener Listeners
 int getHorizontalOffset()
          Returns the current text horizontal offset.
 java.awt.Insets getMargin()
          Returns the margin of this components.
 java.awt.Dimension getMinimumSize()
           
 java.awt.Dimension getPreferredSize()
           
 int getScrollingMode()
          Returns the scrolling mode.
 int getSizingBehavior()
          Gets the sizing behavior.
 int getSleepTime()
           
 java.lang.String getText()
           
 int getVerticalOffset()
          Returns the current text vertical offset.
 int getWaitTime()
           
static void main(java.lang.String[] args)
          Test function.
 void paint(java.awt.Graphics g)
          Paint the component.
 void removeTextListener(JAutoScrolledTextListener l)
          Remove the specified JAutoScrolledTextListener Listeners
 void setAutoScroll(int time)
          Set the autoscroll mode.
 void setHorizontalAlignment(int a)
          Sets alignment policiy (when no scroll)
 void setHorizontalOffset(int y)
          Sets the text horizontal offset in pixel.
 void setMargin(java.awt.Insets i)
          Sets the margin of this components.
 void setScrollingMode(int scrollingMode)
          Set the scrolling mode.
 void setSizingBehavior(int s)
          Sets the sizing behavior.
 void setSleepTime(int sleepTime)
           
 void setText(java.lang.String txt)
          Sets the text of this component.
 void setValueOffsets(int x, int y)
          Deprecated.  
 void setVerticalOffset(int y)
          Sets the text vertical offset in pixel.
 void setWaitTime(int ms)
          Sets the half time between scroll animations.
 
Methods inherited from class javax.swing.JTextField
addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setDocument, setFont, setScrollOffset
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getNavigationFilter, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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:
Constant Field Values

SCROLL_LOOP

public static final int SCROLL_LOOP
Continuous scrolling

See Also:
Constant Field Values
Constructor Detail

JAutoScrolledText

public JAutoScrolledText()
Constructs an empty text.

Method Detail

setMargin

public void setMargin(java.awt.Insets i)
Sets the margin of this components.

Overrides:
setMargin in class javax.swing.text.JTextComponent
Parameters:
i - Margin value

getMargin

public java.awt.Insets getMargin()
Returns the margin of this components.

Overrides:
getMargin in class javax.swing.text.JTextComponent

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:
CLASSIC_BEHAVIOR, MATRIX_BEHAVIOR

getSizingBehavior

public int getSizingBehavior()
Gets the sizing behavior.

Returns:
Actual sizing behavior
See Also:
setSizingBehavior(int)

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JTextField

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class javax.swing.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(java.lang.String txt)
Sets the text of this component.

Overrides:
setText in class javax.swing.text.JTextComponent
Parameters:
txt - Text to display

getText

public java.lang.String getText()
Overrides:
getText in class javax.swing.text.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.

See Also:
setVerticalOffset(int), setHorizontalOffset(int)

setHorizontalAlignment

public void setHorizontalAlignment(int a)
Sets alignment policiy (when no scroll)

Overrides:
setHorizontalAlignment in class javax.swing.JTextField
Parameters:
a - Alignment mode
See Also:
CENTER_ALIGNMENT, RIGHT_ALIGNMENT, LEFT_ALIGNMENT

paint

public void paint(java.awt.Graphics g)
Paint the component.

Overrides:
paint in class javax.swing.JComponent

addTextListener

public void addTextListener(JAutoScrolledTextListener l)
Add the specified JAutoScrolledTextListener Listeners


removeTextListener

public void removeTextListener(JAutoScrolledTextListener l)
Remove the specified JAutoScrolledTextListener Listeners


getScrollingMode

public int getScrollingMode()
Returns the scrolling mode.

See Also:
setScrollingMode(int)

setScrollingMode

public void setScrollingMode(int scrollingMode)
Set the scrolling mode.

Parameters:
scrollingMode - Scrolling mode
See Also:
SCROLL_TO_SEE_END, SCROLL_LOOP

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Test function.

Parameters:
args - Not used
Throws:
java.lang.Exception