|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.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 Form| Inner classes inherited from class java.awt.Button |
java.awt.Button.AccessibleAWTButton |
| Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
| 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, 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, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, 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.getPreferredSize in class java.awt.Componentpublic java.awt.Dimension preferredSize()
Dimension with
width 42 and height 52.
This method is only called by the system layout manager.preferredSize in class java.awt.Componentpublic void setDisable()
imageFileDisable.gif.public void setEnable()
imageFile.gifpublic void print(java.awt.Graphics g)
print in class java.awt.Componentpublic void update(java.awt.Graphics g)
repaint method
is called.update in class java.awt.Componentpublic void paint(java.awt.Graphics g)
paint in class java.awt.Component
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||