com.objectplanet
Class Ticker

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended bycom.objectplanet.Ticker
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
HNewsTicker, NewsTicker

public abstract class Ticker
extends java.applet.Applet

This class is the abstract superclass of all tickers.

Author:
Bjorn J. Kvande.
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  int border
          The border style.
protected static int BORDER_DOWN
           
protected static int BORDER_EMBOSSED
           
protected static int BORDER_GROOVED
           
protected static int BORDER_NONE
           
protected static int BORDER_SOLID
           
protected static int BORDER_UP
           
protected  java.awt.Color borderColor
           
protected  java.lang.Object currentCursor
           
protected  java.lang.Object CURSOR_DEFAULT
          The different cursors used (default and one for a link).
protected  java.lang.Object CURSOR_LINK
           
protected  java.awt.Color focusColor
          The color used for a focused news body.
protected  int focusIndex
          The index of the focused news item.
protected  int headerHeight
          The header height.
protected  int horzOffset
          The offset position where the news should be painted.
protected  java.util.Vector linkPositions
          We keep the position of news bodies so we can select it with the mouse.
protected  java.awt.Point mousePosition
          Keeps track of the mouse position.
protected  java.awt.Color newsColor
          The color used for the news body text.
protected  java.awt.Font newsFont
          The font used for the news item.
protected  java.awt.Color newsHeaderColor
          The color of the news header.
protected  java.awt.Font newsHeaderFont
          The font of the news header.
protected  java.util.Vector newsItems
          Contains any array of three strings for each news item.
protected  java.awt.Image offscreen
          Paint everything on an offscreen image to avoid flicker.
protected  int scrollSpeed
          The scrolling speed.
protected  java.lang.String target
          The name of the target window where the news item is opened.
protected  boolean waitNextNews
          This is set to true when the scrolling should pause before showing the next news.
protected  int vertOffset
          The offset position where the news should be painted.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Ticker()
          Constructs the news ticker.
 
Method Summary
protected  java.lang.String convertLineBreaks(java.lang.String label)
          Converts the characters \ and n to '\n'.
protected static java.awt.Color createColor(java.lang.String color)
          Creates a color based on the string.
protected static java.awt.Font createFont(java.lang.String value, java.lang.String name, int type, int size)
          Creates a font based on the information in the specified string.
protected  java.net.URL createURL(java.lang.String urlString)
          Creates a URL from the specified string.
 void init()
          Initializes the news ticker, reading the news parameters.
 void paint(java.awt.Graphics g)
          Renders the news ticker.
 void processEvent(java.awt.AWTEvent event)
          Processes the mouse events.
 void setParameter(java.lang.String name, java.lang.String value)
          Sets a parameter.
 void start()
          Starts the news ticker scroller.
 void stop()
          Stops the news ticker scroller.
 void update(java.awt.Graphics g)
          Overridden to avoid flickering.
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, 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

border

protected int border
The border style.


BORDER_DOWN

protected static final int BORDER_DOWN
See Also:
Constant Field Values

BORDER_EMBOSSED

protected static final int BORDER_EMBOSSED
See Also:
Constant Field Values

BORDER_GROOVED

protected static final int BORDER_GROOVED
See Also:
Constant Field Values

BORDER_NONE

protected static final int BORDER_NONE
See Also:
Constant Field Values

BORDER_SOLID

protected static final int BORDER_SOLID
See Also:
Constant Field Values

BORDER_UP

protected static final int BORDER_UP
See Also:
Constant Field Values

borderColor

protected java.awt.Color borderColor

currentCursor

protected java.lang.Object currentCursor

CURSOR_DEFAULT

protected java.lang.Object CURSOR_DEFAULT
The different cursors used (default and one for a link).


CURSOR_LINK

protected java.lang.Object CURSOR_LINK

focusColor

protected java.awt.Color focusColor
The color used for a focused news body.


focusIndex

protected int focusIndex
The index of the focused news item.


headerHeight

protected int headerHeight
The header height.


horzOffset

protected int horzOffset
The offset position where the news should be painted. Used when scrolling the news items horizontally.


linkPositions

protected java.util.Vector linkPositions
We keep the position of news bodies so we can select it with the mouse.


mousePosition

protected java.awt.Point mousePosition
Keeps track of the mouse position.


newsColor

protected java.awt.Color newsColor
The color used for the news body text.


newsFont

protected java.awt.Font newsFont
The font used for the news item.


newsHeaderColor

protected java.awt.Color newsHeaderColor
The color of the news header.


newsHeaderFont

protected java.awt.Font newsHeaderFont
The font of the news header. The news header is a header for each news item, such as a date or title.


newsItems

protected java.util.Vector newsItems
Contains any array of three strings for each news item. The first entry is the header, second is body, and third is link.


offscreen

protected java.awt.Image offscreen
Paint everything on an offscreen image to avoid flicker.


scrollSpeed

protected int scrollSpeed
The scrolling speed.


target

protected java.lang.String target
The name of the target window where the news item is opened.


waitNextNews

protected boolean waitNextNews
This is set to true when the scrolling should pause before showing the next news.


vertOffset

protected int vertOffset
The offset position where the news should be painted. Used when scrolling the news items vertically.

Constructor Detail

Ticker

public Ticker()
Constructs the news ticker.

Method Detail

convertLineBreaks

protected java.lang.String convertLineBreaks(java.lang.String label)
Converts the characters \ and n to '\n'.

Parameters:
label - The label with the \ and n.

createColor

protected static java.awt.Color createColor(java.lang.String color)
Creates a color based on the string. The string can either be the name of a java defined color, a comma seperated RGB string (255,255,255), or a 6-digit hex-string (#af10cd).

Returns:
The color object, or black if unkown.

createFont

protected static java.awt.Font createFont(java.lang.String value,
                                          java.lang.String name,
                                          int type,
                                          int size)
Creates a font based on the information in the specified string.

Parameters:
value - The font string value.
name - The name of the default font.
type - The default type (Font.PLAIN, Font.BOLD, Font.ITALIC).
size - The default size.

createURL

protected java.net.URL createURL(java.lang.String urlString)
Creates a URL from the specified string.

Parameters:
urlString - The url string.
Returns:
The URL created, or null if invalid or empty.

init

public void init()
Initializes the news ticker, reading the news parameters.


paint

public void paint(java.awt.Graphics g)
Renders the news ticker.

Parameters:
g - The graphics object used to paint with.

processEvent

public void processEvent(java.awt.AWTEvent event)
Processes the mouse events.


setParameter

public void setParameter(java.lang.String name,
                         java.lang.String value)
Sets a parameter.

Parameters:
name - The name of the parameter.
value - The value of the parameter to set.

start

public void start()
Starts the news ticker scroller.


stop

public void stop()
Stops the news ticker scroller.


update

public void update(java.awt.Graphics g)
Overridden to avoid flickering.