java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Panel | +--java.applet.Applet | +--TopScroll
Scrolling Applet, you can put a top scroll object directly onto a web page, its a standalone object. It will scroll text from right to left and add a distortion effect to the page. The speed is adjustable from 1 very slow thru 10 very fast (4 is default) using the SPEED parameter in the HTML file. Set the Text filename and Image Filename parameters from your HTML page. The Text parmeter is TEXTFILE and should be set to the file name relative to the html file's path. The Image parameter is IMAGENAME and should be a .gif file of 256 colours or less, again this is relative to the html file. The font must be fixed width and height. If the font width and height are not 20 pixels per letter, you must set these too, the parameters are FONTWIDTH and FONTHEIGHT. ALWAYS make the width divisible by the font width, and the height is twice the size of the letters.
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
TopScroll()
TopScroll constructor, empty, actually uses start for thread creation. |
Method Summary | |
protected void |
generateDistortion()
generates the distortion effect that is rolled across the scrolling text, this is calculated once at the start, and held in memory. |
java.lang.String |
getAppletInfo()
Returns the applet information |
protected void |
getIndexColourData(java.awt.Image img,
byte[][] byPixels,
byte[] byReds,
byte[] byGreens,
byte[] byBlues)
converts an image containing the letters into a 256 colour version, thats split up by letter rather than by line. |
protected int |
GetNextCharIndex(char letter)
Given a character value, this function will convert this value into an index position into the image file containing the chars |
void |
init()
initialises the scroller and sets up the instance data. |
void |
paint(java.awt.Graphics g)
draws the current buffer that was created by the last call to the scrollit() function. |
protected java.lang.String |
readTextFile(java.lang.String name)
|
void |
run()
just stays in a loop moving the scroller to its new location, then doing a repaint and waiting 1/60th of a second before repeating. |
protected void |
scrollit()
after scrolling the contents by calling StepScroll the scrollit function places the distortion effect onto the current image. |
void |
start()
create a new thread for our Applet to run in |
protected void |
StepScroll()
move the scroller one position, if the scroller has moved by one full letter position, then a new letter is added and the smooth scroll offset is reset. |
void |
stop()
stop our applets thread, its done! |
void |
update(java.awt.Graphics g)
We handle update so that drawing is smoother and doesnt flash, this function directly calls paint(Graphics g); |
Methods inherited from class java.applet.Applet |
destroy,
getAppletContext,
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,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getAlignmentX,
getAlignmentY,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getInsets,
getLayout,
getMaximumSize,
getMinimumSize,
getPreferredSize,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
paramString,
preferredSize,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
removeNotify,
setFont,
setLayout,
validate,
validateTree |
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,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
firePropertyChange,
getBackground,
getBounds,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getGraphics,
getHeight,
getInputContext,
getInputMethodRequests,
getLocation,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getSize,
getToolkit,
getTreeLock,
getWidth,
getX,
getY,
gotFocus,
handleEvent,
hasFocus,
hide,
imageUpdate,
inside,
isDisplayable,
isDoubleBuffered,
isEnabled,
isFocusTraversable,
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,
processInputMethodEvent,
processKeyEvent,
processMouseEvent,
processMouseMotionEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removePropertyChangeListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
repaint,
requestFocus,
reshape,
setBackground,
setBounds,
setBounds,
setComponentOrientation,
setCursor,
setDropTarget,
setEnabled,
setForeground,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
setVisible,
show,
show,
size,
toString,
transferFocus |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public TopScroll()
Method Detail |
public java.lang.String getAppletInfo()
protected java.lang.String readTextFile(java.lang.String name) throws java.lang.Exception
public void init()
public void update(java.awt.Graphics g)
g
- the awt graphics devicepublic void paint(java.awt.Graphics g)
g
- the awt graphics device.protected void scrollit()
public void start()
public void stop()
public void run()
protected int GetNextCharIndex(char letter)
letter
- the letter to be convertedprotected void StepScroll()
protected void getIndexColourData(java.awt.Image img, byte[][] byPixels, byte[] byReds, byte[] byGreens, byte[] byBlues)
img
- the image file to be convertedbyPixels
- the pixel array where each image will be storedbyReds
- the color index for redsbyGreens
- the color index for greensbyBlues
- the color index for bluesprotected void generateDistortion()