Package fr.esrf.tangoatk.widget.util
Class JAutoScrolledText
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.text.JTextComponent
javax.swing.JTextField
fr.esrf.tangoatk.widget.util.JAutoScrolledText
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible,Scrollable,SwingConstants
- Direct Known Subclasses:
SimpleEnumScalarViewer,SimpleScalarViewer,StateStatusViewer
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JTextField
JTextField.AccessibleJTextFieldNested classes/interfaces inherited from class javax.swing.text.JTextComponent
JTextComponent.AccessibleJTextComponent, JTextComponent.DropLocation, JTextComponent.KeyBindingNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intSpecifies alignment to the center of the component.static intComputes font size and return the minimun size to the layout managerstatic intSpecifies alignment to the left side of the component.static intDoes not compute font size and let the layout manager size the componentstatic intSpecifies alignment to the right side of the component.static final intContinuous scrollingstatic final intScroll the text until the end of the text is reached and restartFields inherited from class javax.swing.JTextField
notifyActionFields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEYFields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields 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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the specified JAutoScrolledTextListener ListenersintintintGets the sizing behavior.intgetText()intintstatic voidvoidPaint the component.voidRemove the specified JAutoScrolledTextListener ListenersvoidsetAutoScroll(int time) Set the autoscroll mode.voidsetHorizontalAlignment(int a) Sets alignment policiy (when no scroll)voidsetHorizontalOffset(int y) Sets the text horizontal offset in pixel.voidSets the margin of this components.voidsetScrollingMode(int scrollingMode) Set the scrolling mode.voidsetSizingBehavior(int s) Sets the sizing behavior.voidsetSleepTime(int sleepTime) voidSets the text of this component.voidsetValueOffsets(int x, int y) Deprecated.voidsetVerticalOffset(int y) Sets the text vertical offset in pixel.voidsetWaitTime(int ms) Sets the half time between scroll animations.Methods inherited from class javax.swing.JTextField
actionPropertyChanged, 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, setScrollOffsetMethods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, modelToView2D, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, restoreComposedText, saveComposedText, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, viewToModel2D, writeMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, updateMethods 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, transferFocusDownCycle, validate, validateTreeMethods 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
CENTER_ALIGNMENT
public static int CENTER_ALIGNMENTSpecifies alignment to the center of the component. -
LEFT_ALIGNMENT
public static int LEFT_ALIGNMENTSpecifies alignment to the left side of the component. -
RIGHT_ALIGNMENT
public static int RIGHT_ALIGNMENTSpecifies alignment to the right side of the component. -
CLASSIC_BEHAVIOR
public static int CLASSIC_BEHAVIORComputes font size and return the minimun size to the layout manager -
MATRIX_BEHAVIOR
public static int MATRIX_BEHAVIORDoes not compute font size and let the layout manager size the component -
SCROLL_TO_SEE_END
public static final int SCROLL_TO_SEE_ENDScroll the text until the end of the text is reached and restart- See Also:
-
SCROLL_LOOP
public static final int SCROLL_LOOPContinuous scrolling- See Also:
-
-
Constructor Details
-
JAutoScrolledText
public JAutoScrolledText()Constructs an empty text.
-
-
Method Details
-
setMargin
Sets the margin of this components.- Overrides:
setMarginin classJTextComponent- Parameters:
i- Margin value
-
getMargin
- Overrides:
getMarginin classJTextComponent- 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
- Overrides:
getPreferredSizein classJTextField
-
getMinimumSize
- Overrides:
getMinimumSizein classJComponent
-
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
Sets the text of this component.- Overrides:
setTextin classJTextComponent- Parameters:
txt- Text to display
-
getText
- Overrides:
getTextin classJTextComponent
-
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 usedy- Not used- See Also:
-
setHorizontalAlignment
public void setHorizontalAlignment(int a) Sets alignment policiy (when no scroll)- Overrides:
setHorizontalAlignmentin classJTextField- Parameters:
a- Alignment mode- See Also:
-
paint
Paint the component.- Overrides:
paintin classJComponent
-
addTextListener
Add the specified JAutoScrolledTextListener Listeners- Parameters:
l- Listener to add
-
removeTextListener
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
- Throws:
Exception
-