Class ClickBtn

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--ClickBtn

public class ClickBtn
extends java.applet.Applet
implements java.lang.Runnable

click button, used on a html page as an applet, it will rotate between 2 images, looking like the image is turning round. the image is configured by applet parameters. these are as follows: ClickNoise the au file to play when clicked. EnterNoise the au file to play when mouse is over item ImageSrc the first image to rotate ImageDest the other image to rotate ImageBack use this to set an image background ImageBkCol use this to set a background colour URLName the name of the URL associated with the button

See Also:
Serialized Form

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
ClickBtn()
          empty constructor, see init
 
Method Summary
protected  void BumpCurrentState()
          move on the current state value, check if its looped.
 void init()
          read in all the parameters, and get the applet ready to start rotating between the 2 images
 boolean mouseDown(java.awt.Event evt, int x, int y)
          on a mouse down we draw the object "pressed" and play the click sound
 boolean mouseEnter(java.awt.Event evt, int x, int y)
          when the mouse is entered, show status of goto: URLPage., then set the cursor to a hand pointer.
 boolean mouseExit(java.awt.Event evt, int x, int y)
          when exited reset the cursor and unset the entered control condition
 boolean mouseUp(java.awt.Event evt, int x, int y)
          on a mouse up we draw the object "normally" and goto the URL
protected  void myDraw3DRect(java.awt.Graphics g, int x, int y, int w, int h, boolean raised)
          draws a 3d rectangle, of a width and height, raised or indented
 void paint(java.awt.Graphics gfx)
          draw my offscreen image, avoids paint problems.
protected  void redrawAll()
          redraw the offscreen image, and bump the current state of the rotation
 void run()
          stay in a loop repainting, the screen and delaying a while
 void start()
          start applet and create new thread
 void stop()
          kill the thread, were done
 
Methods inherited from class java.applet.Applet
destroy, 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, 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, update, 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, mouseDrag, mouseMove, 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

ClickBtn

public ClickBtn()
empty constructor, see init
Method Detail

init

public void init()
read in all the parameters, and get the applet ready to start rotating between the 2 images
Overrides:
init in class java.applet.Applet

BumpCurrentState

protected void BumpCurrentState()
move on the current state value, check if its looped.

paint

public void paint(java.awt.Graphics gfx)
draw my offscreen image, avoids paint problems.
Overrides:
paint in class java.awt.Container

myDraw3DRect

protected void myDraw3DRect(java.awt.Graphics g,
                            int x,
                            int y,
                            int w,
                            int h,
                            boolean raised)
draws a 3d rectangle, of a width and height, raised or indented
Parameters:
g - the device to draw on
x - the starting x location
y - the starting y location
w - the width of the rectangle
h - the height of the rectangle
raised - true to draw a raised rectangle, false indented

redrawAll

protected void redrawAll()
redraw the offscreen image, and bump the current state of the rotation

start

public void start()
start applet and create new thread
Overrides:
start in class java.applet.Applet

stop

public void stop()
kill the thread, were done
Overrides:
stop in class java.applet.Applet

run

public void run()
stay in a loop repainting, the screen and delaying a while
Specified by:
run in interface java.lang.Runnable

mouseDown

public boolean mouseDown(java.awt.Event evt,
                         int x,
                         int y)
on a mouse down we draw the object "pressed" and play the click sound
Overrides:
mouseDown in class java.awt.Component

mouseUp

public boolean mouseUp(java.awt.Event evt,
                       int x,
                       int y)
on a mouse up we draw the object "normally" and goto the URL
Overrides:
mouseUp in class java.awt.Component

mouseEnter

public boolean mouseEnter(java.awt.Event evt,
                          int x,
                          int y)
when the mouse is entered, show status of goto: URLPage., then set the cursor to a hand pointer. Also play the entered sound
Overrides:
mouseEnter in class java.awt.Component

mouseExit

public boolean mouseExit(java.awt.Event evt,
                         int x,
                         int y)
when exited reset the cursor and unset the entered control condition
Overrides:
mouseExit in class java.awt.Component


1