jclass
Class TextScrollerCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--jclass.TextScrollerCanvas

public class TextScrollerCanvas
extends java.awt.Canvas

A canvas that scrolls a text from left to right ...
The font that is used on the canvas has to set before scrolling.

Written: Radu Sion
Version: 0.12
Source: TextScrollerCanvas.java

Visit Smart Software 

See Also:
Serialized Form

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
TextScrollerCanvas(java.lang.String scrolltext, int pixelinc)
          Creates a new scroller canvas that should scroll the specified text by using the specified increment in pixels between moves.
 
Method Summary
 void paint(java.awt.Graphics gr)
          Does a scroll step.
 void setText(java.lang.String scrolltext)
          Sets a new text to be displayed from now on.
 void update(java.awt.Graphics g)
          The update method uses an off-screen drawing area to reduce text fliker
 
Methods inherited from class java.awt.Canvas
addNotify
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, ist, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextScrollerCanvas

public TextScrollerCanvas(java.lang.String scrolltext,
                          int pixelinc)
Creates a new scroller canvas that should scroll the specified text by using the specified increment in pixels between moves. No parameter checkings performed.
Parameters:
scrolltext - Text to scroll
pixelinc - How many pixels to shift the text from one move to another
Method Detail

setText

public void setText(java.lang.String scrolltext)
Sets a new text to be displayed from now on. Resets the step counter.
Parameters:
scrolltext - New text to scroll

paint

public void paint(java.awt.Graphics gr)
Does a scroll step.
Overrides:
paint in class java.awt.Canvas

update

public void update(java.awt.Graphics g)
The update method uses an off-screen drawing area to reduce text fliker
Overrides:
update in class java.awt.Component