Led Ticker Component v2.2
www.ledticker.net

net.ledticker
Interface LedTicker


public interface LedTicker

This interface is a proxy for the led ticker class which is a JComponent that is obtained via getTickerComponent method. To create a led ticker use LedTickerFactory.createLedTicker()

The ticker content is composed of TickerElements which in turn are also composed of Tokens.

See Also:
LedTickerFactory, TickerElement, Token

Method Summary
 void addElement(TickerElement element)
          Adds an element to the ticker's contents
 void addElementListener(ElementListener listener)
          Adds the specified element listener to receive element events from this led ticker.
 javax.swing.JComponent getTickerComponent()
          Gets the JComponent used to display the contents and animation of the ticker.
 boolean isDraggingEnabled()
          Returns the ability of the ticker to support dragging.
 void pauseAnimation()
          Pauses the ticker elements' scrolling.
 void removeAll()
          Empties the contents of the ticker.
 void removeElement(TickerElement element)
          Removes an element from the ticker's contents
 void removeElementListener(ElementListener listener)
          Removes the specified element listener so that it no longer receives element events from this led ticker.
 void setBackgroundColor(java.awt.Color color)
          Sets the background color of the ticker
 void setDotGaps(int hGap, int vGap)
          Sets the gaps, in pixels, between two ticker leds.
 void setDotOffColor(java.awt.Color color)
          Sets the color of a turned-off led
 void setDotSize(int width, int height)
          Sets the dimensions, in pixels, of the ticker's led Default values are (1, 1).
 void setDraggingEnabled(boolean draggingEnabled)
          Enables the movement of the scroll by dragging
 void setElementGap(int gap)
          Sets the gap, in dots, between two elements of the ticker Default value is 4.
 void setSpeed(int speed)
          Sets the speed of the ticker animation.
 void setTokenGap(int gap)
          Sets the gap, in dots, between two tokens of an element.
 void startAnimation()
          Starts to scroll the ticker's elements.
 void stopAnimation()
          Stops the ticker elements' scrolling.
 void update(TickerElement element)
          Signals the ticker that the given element changed it's value and that it's display should be updated.
 void updateAll()
          Updates the display of all of the ticker's elements.
 

Method Detail

addElement

public void addElement(TickerElement element)
Adds an element to the ticker's contents

Parameters:
element - the element to be added to the contents

removeElement

public void removeElement(TickerElement element)
Removes an element from the ticker's contents

Parameters:
element - the element to be removed from the contents

removeAll

public void removeAll()
Empties the contents of the ticker.


update

public void update(TickerElement element)
Signals the ticker that the given element changed it's value and that it's display should be updated. The update mechanism was designed with the reuse of the TickerElement objects in mind. Therefore, the given instance must be the same with the one that was originally added to the ticker, otherwise an IllegalArgumentException is thrown.

Parameters:
element - the element to be updated
Throws:
java.lang.IllegalArgumentException - if the given element was not found within the ticker's contents

updateAll

public void updateAll()
Updates the display of all of the ticker's elements.


addElementListener

public void addElementListener(ElementListener listener)
Adds the specified element listener to receive element events from this led ticker. If listener is null, no exception is thrown and no action is performed.

Parameters:
listener - the element listener.
See Also:
ElementEvent, ElementListener, removeElementListener(ElementListener)

removeElementListener

public void removeElementListener(ElementListener listener)
Removes the specified element listener so that it no longer receives element events from this led ticker. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this led ticker. If listener is null, no exception is thrown and no action is performed.

Parameters:
listener - the element listener.
See Also:
ElementEvent, ElementListener, addElementListener(ElementListener)

setDotSize

public void setDotSize(int width,
                       int height)
Sets the dimensions, in pixels, of the ticker's led Default values are (1, 1).

Parameters:
width - the width of the led
height - the height of the led

setDotGaps

public void setDotGaps(int hGap,
                       int vGap)
Sets the gaps, in pixels, between two ticker leds. Default values are (1, 1).

Parameters:
hGap - the horizontal gap
vGap - the vertical gap

setElementGap

public void setElementGap(int gap)
Sets the gap, in dots, between two elements of the ticker Default value is 4.

Parameters:
gap - the gap between elements

setTokenGap

public void setTokenGap(int gap)
Sets the gap, in dots, between two tokens of an element. Default value is 2.

Parameters:
gap - the gap between the elements' tokens

setSpeed

public void setSpeed(int speed)
Sets the speed of the ticker animation. The speed must be a value between 1 and 10, default value is 3.

Parameters:
speed - the speed of the ticker animation
Throws:
java.lang.IllegalArgumentException - if the given value is less than 1 or more than 10

setBackgroundColor

public void setBackgroundColor(java.awt.Color color)
Sets the background color of the ticker

Parameters:
color - the background color of the ticker

setDotOffColor

public void setDotOffColor(java.awt.Color color)
Sets the color of a turned-off led

Parameters:
color - the color of a turned-off led

startAnimation

public void startAnimation()
Starts to scroll the ticker's elements. If the animation was paused, this method will resume it. If the animation was stopped (or never started before) the method will create and start a Thread that will perform the animation.


stopAnimation

public void stopAnimation()
Stops the ticker elements' scrolling. This method terminates the Thread responsible with the ticker's animation.


pauseAnimation

public void pauseAnimation()
Pauses the ticker elements' scrolling. This method stops the animation without terminating it's associated Thread.


setDraggingEnabled

public void setDraggingEnabled(boolean draggingEnabled)
Enables the movement of the scroll by dragging

Parameters:
draggingEnabled - if set to true enables the movement of the scroll by dragging

isDraggingEnabled

public boolean isDraggingEnabled()
Returns the ability of the ticker to support dragging.


getTickerComponent

public javax.swing.JComponent getTickerComponent()
Gets the JComponent used to display the contents and animation of the ticker.

Returns:
the component where the ticker is rendered

Led Ticker Component v2.2
www.ledticker.net