|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Button
ciips.animation.ImageButton
The ImageButton
class extends the original
java.awt.Button
to display graphical images in
gif
format. In this particular implementation,
the images to be loaded have to be located in the same
directory as the code base
(which can be accessed
using Applet.getCodeBase()
).
In order to work around the bug in some of the older java complient
web browser, in particular, the class not found
exception
during the initilization of the frame using Netscape 2.0,
this class is casted to its parent class Button
and explicitly casted back to ImageButton
when the
customized methods are required.
Button
,
Serialized FormNested Class Summary |
Nested classes inherited from class java.awt.Button |
java.awt.Button.AccessibleAWTButton |
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 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 | |
ImageButton(java.lang.String imageFile,
AlgAnimApp app,
ControlPanel parent)
Creates an ImageButton using the gif
file specified by the first parameter on the panel defined by
the third parameter. |
Method Summary | |
java.awt.Dimension |
getPreferredSize()
Specify the dimension of the button. |
void |
paint(java.awt.Graphics g)
Method to draw image on the button |
java.awt.Dimension |
preferredSize()
Specify the dimension of the button. |
void |
print(java.awt.Graphics g)
Method to draw image on the button |
void |
setDisable()
Disable the image button and set the current image to imageFileDisable.gif . |
void |
setEnable()
Enable the image button and set the current image to imageFile.gif |
void |
update(java.awt.Graphics g)
This method is invokes when the repaint method
is called. |
Methods inherited from class java.awt.Button |
addActionListener, addNotify, getAccessibleContext, getActionCommand, getActionListeners, getLabel, getListeners, paramString, processActionEvent, processEvent, removeActionListener, setActionCommand, setLabel |
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, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, 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, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, 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 |
Constructor Detail |
public ImageButton(java.lang.String imageFile, AlgAnimApp app, ControlPanel parent)
ImageButton
using the gif
file specified by the first parameter on the panel defined by
the third parameter.
Before calling this constructor, make sure that the image file
imageFile.gif
exists. It is also required to have
another gif image imageFileDisable.gif
, which
appears to be the disabled button.
imageFile
- The gif image file without the
.gif
extension. The extension will be appended
when calling the Applet.getImage()
method.
app
- An instance to an applet. The only applet in this
cluster of classes, an instance of AlgAnimApp
, is
usually passed in here. This particular applet is used to
obtain the code base, i.e. the location of the image files.
parent
- The panel where this image button is going to reside.
This paremeter is passed in so that the repaint method for the
panel can be called when a refreshing is required.Method Detail |
public java.awt.Dimension getPreferredSize()
Dimension
with
width
42 and height
52.
This method is only called by the system layout manager.
public java.awt.Dimension preferredSize()
Dimension
with
width
42 and height
52.
This method is only called by the system layout manager.
public void setDisable()
imageFileDisable.gif
.
public void setEnable()
imageFile.gif
public void print(java.awt.Graphics g)
public void update(java.awt.Graphics g)
repaint
method
is called.
public void paint(java.awt.Graphics g)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |