|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Canvas
org.lyra.Widgets.TickerCanvas
public class TickerCanvas
Provides a ticker tape capability to the javax.swing.JLabel display in order to permit them to display larger strings then they are physically able to display.
This is an alternative to the TickerLabel method which makes use of the Swing methods directly. Due to the ability of controlling buffering directly it was hoped to have a smoother look, but seems to be on par with the swing variant.
Currently this variant is to remain in case it can be worked out. However at the moment there is no immediate requirement for it, since mixing of AWT and Swing components can lead to unexpected behaviours.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Canvas |
---|
java.awt.Canvas.AccessibleAWTCanvas |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
private static int |
BUFFER
|
private boolean |
Loop
|
private java.awt.image.BufferStrategy |
myBuffer
|
private java.awt.image.BufferedImage |
myCrop
|
private int |
myDescent
|
private int |
myHeight
|
private int |
myLimit
|
private java.lang.String |
myMessage
|
private int |
myPosition
|
private java.awt.Dimension |
mySize
|
private java.awt.image.BufferedImage |
mySource
|
private java.lang.Thread |
myThread
|
private int |
myWidth
|
private boolean |
Redraw
|
private boolean |
Reprocess
|
private static long |
serialVersionUID
|
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 | |
---|---|
TickerCanvas()
Base constructor which initialises none of the elements. |
|
TickerCanvas(java.lang.String msg)
Constructor which takes the initial message as the base. |
|
TickerCanvas(java.lang.String msg,
java.awt.Font font)
Constructor which takes the initial message and font for use as the base. |
|
TickerCanvas(java.lang.String msg,
java.awt.Font font,
int limit)
Constructor which takes the initial message, font and limit for use as the base. |
|
TickerCanvas(java.lang.String msg,
int limit)
Constructor which takes the initial message and limit for use as the base. |
Method Summary | |
---|---|
private void |
fetchMetrics()
Makes use of the FontMetrics methods to establish sizing elements in order to determine the needs for ticker functionality. |
private void |
fetchMetrics(java.awt.FontMetrics metrics)
Makes use of the FontMetrics methods to establish sizing elements in order to determine the needs for ticker functionality. |
private void |
fetchMetrics(java.awt.Graphics g)
Makes use of the FontMetrics methods to establish sizing elements in order to determine the needs for ticker functionality. |
private void |
fetchSource(java.awt.Graphics g)
Creates a buffered image for use. |
private java.awt.image.BufferedImage |
getCrop()
Returns the cropped image for use. |
int |
getHeight()
|
int |
getLimit()
Returns the established limit for message displays. |
java.lang.String |
getText()
Returns the message displayed in ticker fashion. |
int |
getWidth()
|
void |
paint(java.awt.Graphics g)
|
void |
run()
|
private void |
setCrop(java.awt.image.BufferedImage img)
Assigns the cropped image for use. |
void |
setFont(java.awt.Font font)
|
void |
setLimit(int limit)
Establishes the limit for message display. |
void |
setMaximumSize(java.awt.Dimension maximumSize)
|
void |
setMinimumSize(java.awt.Dimension minimumSize)
|
void |
setPreferredSize(java.awt.Dimension preferredSize)
|
void |
setText(java.lang.String msg)
Establishes the message displayed in ticker fashion. |
Methods inherited from class java.awt.Canvas |
---|
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private java.awt.image.BufferStrategy myBuffer
private java.lang.String myMessage
private int myHeight
private int myWidth
private int myLimit
private int myDescent
private java.awt.Dimension mySize
private boolean Reprocess
private boolean Redraw
private boolean Loop
private int myPosition
private java.awt.image.BufferedImage mySource
private java.awt.image.BufferedImage myCrop
private java.lang.Thread myThread
private static final int BUFFER
Constructor Detail |
---|
public TickerCanvas()
public TickerCanvas(java.lang.String msg)
msg
- String message for display in ticker format.public TickerCanvas(java.lang.String msg, java.awt.Font font)
msg
- String message for display in ticker format.font
- Font for display.public TickerCanvas(java.lang.String msg, java.awt.Font font, int limit)
msg
- String message for display in ticker format.font
- Font for display.limit
- Maximum width which will lead to a ticker incident.public TickerCanvas(java.lang.String msg, int limit)
msg
- String message for display in ticker format.limit
- Maximum width which will lead to a ticker incident.Method Detail |
---|
private void fetchMetrics(java.awt.FontMetrics metrics)
metrics
- FontMetrics handle for information.private void fetchMetrics()
private void fetchMetrics(java.awt.Graphics g)
g
- java.awt.Graphics handle for display.private void fetchSource(java.awt.Graphics g)
private void setCrop(java.awt.image.BufferedImage img)
img
- BufferedImage containing cropped section for display.private java.awt.image.BufferedImage getCrop()
public void setText(java.lang.String msg)
msg
- String containing currently displayed text.public java.lang.String getText()
public void setFont(java.awt.Font font)
setFont
in class java.awt.Component
public void setLimit(int limit)
limit
- Display limit for the message.public int getLimit()
public void paint(java.awt.Graphics g)
paint
in class java.awt.Canvas
public int getWidth()
getWidth
in class java.awt.Component
public int getHeight()
getHeight
in class java.awt.Component
public void setMinimumSize(java.awt.Dimension minimumSize)
setMinimumSize
in class java.awt.Component
public void setPreferredSize(java.awt.Dimension preferredSize)
setPreferredSize
in class java.awt.Component
public void setMaximumSize(java.awt.Dimension maximumSize)
setMaximumSize
in class java.awt.Component
public void run()
run
in interface java.lang.Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |