com.objectplanet
Class NewsTicker

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

public class NewsTicker
extends Ticker

The news ticker applet displays a list of news scrolling vertically, with the ability to scroll up and down interactivly and click on a link to open a page with more news.

<applet code=com.objectplanet.NewsTicker
archive=com.objectplanet.NewsTicker.jar
width=200 height=400>
<param name=header value="News">
<param name=newsURL value="news.xml">
</applet>

The URL containing the news should contain news in the following format:

<news>
  <header>
    news header text
  </header>
  <body>
    This is the text of the news item
    body. It can contain as much text
    as you want. The item in the link
    tag is the url opened when the
    user clicks on the news body.
  </body>
  <link>
    newsitem.html
  </link>
</news>

newsURL
The URL where the news are read from. The news needs to be in XML format as displayed above. Use \n for multiline labels.
<param name=newsURL value="news.xml">

dataInterval
Data interval in seconds between reloads of the news from URL.
<param name=dataInterval value="5">

header
The news ticker applet header. This header is always visible and does not scroll. The header can also be empty. Use \n for multiline labels.
<param name=header value="this is a\nmultiline header">

headerFont
The font used for the applet header. The first field is the font name, the second is plain, bold, or bolditalic. The last field is the point size of the font.
<param name=headerFont value="Arial,bold,16">

headerColor
The color used for the applet header. The color can be set using one of the following color names; black, blue, cyan, darkGray, gray, green, lightGray, magenta, orange, pink, red, white, or you can use the URL hex code for the color.
<param name=headerColor value="red">
<param name=headerFont value="#c0c0c0">

headerAlignment
The horizontal alignment of the applet header.
<param name=headerAlignment value="left">
<param name=headerAlignment value="center">
<param name=headerAlignment value="right">

newsHeaderFont
Each news item has a header. This is the font used for the header.
<param name=newsHeaderFont value="Arial,bold,11">

newsHeaderColor
The color used for the news item header.
<param name=newsHeaderColor value="blue">

newsFont
The font used for the news item body.
<param name=newsFont value="Arial,plain,11">

newsColor
The color used for the news item body.
<param name=newsColor value="gray">

focusColor
The color used for the news item body when the user places the mouse button over it.
<param name=focusColor value="red">

target
The default window to open the url is the same window as the applet is in. Use this parameter to control which window the url is openened in. See here for target details.
<param name=target value="window_name">

background
The background color of the applet.
<param name=background value="orange">

scrollSpeed
The speed of the scrolling. The scrolling can be set with a value from 0 (no scrolling) through 100 (fast scrolling).
<param name=scrollSpeed value="60">

border
You can display a border around the applet and applet header. Control the color of the border by seperating the border type and color with a comma.
<param name=border value="none">
<param name=border value="solid">
<param name=border value="up">
<param name=border value="down">
<param name=border value="grooved">
<param name=border value="embossed">
<param name=border value="embossed,orange">
<param name=border value="grooved,#c0aaff">

wrapSpace
By default, the first news item starts again at the bottom when the last has left the top of the applet. Set this parameter to control the space between the last item and where the first one starts again. Use -1 for the default behavior.
<param name=wrapSpace value="100">

newsXMLTag
You can control the xml tag used for each news item. The default tag is <news>. Specify the xml tag without the enclosing < and >.
<param name=newsXMLTag value="news_item">

newsHeaderXMLTag
You can control the xml tag used for the news header. The default tag is <header>. Specify the xml tag without the enclosing < and >.
<param name=newsHeaderXMLTag value="news_header">

newsBodyXMLTag
You can control the xml tag used for the news body. The default tag is <body>. Specify the xml tag without the enclosing < and >.
<param name=newsBodyXMLTag value="news_body">

newsLinkXMLTag
You can control the xml tag used for the news link. The default tag is <link>. Specify the xml tag without the enclosing < and >.
<param name=newsLinkXMLTag value="news_link">

pauseOnMouseOver
Set this parameter to true if you want to pause scrolling whin mouse is over the news.
<param name=pauseOnMouseOver value="true">

pauseOnMouseOver
This parameter can be used to control the number of seconds applet will wait until scrolling to the next news.
<param name=pauseOnMouseOver value="1">

backgroundImage
This parameter can be used to set a background image for the applet.
<param name=backgroundImage value="background.gif">

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
 
Fields inherited from class com.objectplanet.Ticker
border, BORDER_DOWN, BORDER_EMBOSSED, BORDER_GROOVED, BORDER_NONE, BORDER_SOLID, BORDER_UP, borderColor, currentCursor, CURSOR_DEFAULT, CURSOR_LINK, focusColor, focusIndex, headerHeight, horzOffset, linkPositions, mousePosition, newsColor, newsFont, newsHeaderColor, newsHeaderFont, newsItems, offscreen, scrollSpeed, target, waitNextNews, vertOffset
 
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
NewsTicker()
          Constructs the news ticker.
 
Method Summary
protected  void checkCursor(int xpos, int ypos)
          Checks if the cursor is above a link.
 void init()
          Initializes the news ticker, reading the news parameters.
 void paintHeader(java.awt.Graphics g)
          Paints the header.
 void setParameter(java.lang.String name, java.lang.String value)
          Sets a parameter.
 
Methods inherited from class com.objectplanet.Ticker
convertLineBreaks, createColor, createFont, createURL, paint, processEvent, start, stop, update
 
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
 

Constructor Detail

NewsTicker

public NewsTicker()
Constructs the news ticker.

Method Detail

checkCursor

protected void checkCursor(int xpos,
                           int ypos)
Checks if the cursor is above a link.

Parameters:
xpos - The x position of the cursor.
ypos - The y position of the cursor.

init

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

Overrides:
init in class Ticker

paintHeader

public void paintHeader(java.awt.Graphics g)
Paints the header.

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

setParameter

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

Overrides:
setParameter in class Ticker
Parameters:
name - The name of the parameter.
value - The value of the parameter to set.