|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.awt.Component
|
+--com.rolemodelsoft.drawlet.awt.ImageButton
A button which uses an image instead of a label.
| Field Summary | |
protected java.awt.event.ActionListener |
actionListener
The actionListener member variable, for dispatching events. |
protected java.lang.String |
command
The label (not visible) for this button. |
protected java.awt.Image |
image
The image for this button. |
protected boolean |
isHighlighted
Flag that is set when the button should be highlighted. |
protected boolean |
isInside
Flag that is set when the mouse is inside |
protected boolean |
isPressed
Flag that is set when the mouse is pressed inside. |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
| Constructor Summary | |
ImageButton()
Create a new, default ImageButton. |
|
ImageButton(java.awt.Image image)
Create a new ImageButton and initalize it with the given Image. |
|
ImageButton(java.lang.String command)
Create a new ImageButton and initalize it with the given command. |
|
ImageButton(java.lang.String command,
java.awt.Image image)
Create a new ImageButton and initalize it with the
given command and Image. |
|
| Method Summary | |
void |
addActionListener(java.awt.event.ActionListener listener)
Add the given ActionListener to my set of listeners. |
java.lang.String |
getCommand()
Answer the command associated with this receiver. |
protected java.lang.String |
getDefaultCommand()
Answers the default command for the receiver (intended for initialization). |
protected java.awt.Image |
getDefaultImage()
Answers the default image for the receiver (intended for initialization. |
java.awt.Image |
getImage()
Answers the current image this button is associated with. |
java.awt.Dimension |
getMinimumSize()
Answer the size this ImageButton must be displayed at. |
java.awt.Dimension |
getPreferredSize()
Answer the size this ImageButton prefers to be displayed at. |
boolean |
isHighlighted()
Returns whether this button is highlighted (down) or not. |
void |
mouseClicked(java.awt.event.MouseEvent e)
Mouse 'action' events are handled in MousePressed and MouseReleased. |
void |
mouseEntered(java.awt.event.MouseEvent e)
If the mouse moves inside of the button, set the isInside flag. |
void |
mouseExited(java.awt.event.MouseEvent e)
If the mouse moves outside of the button, reset the isInside flag. |
void |
mousePressed(java.awt.event.MouseEvent e)
If the mouse is pressed inside of the button, set the isPressed flag. |
void |
mouseReleased(java.awt.event.MouseEvent e)
If the mouse is released, check to see if it is inside of the button, and if it was originally pressed inside of the button. |
void |
paint(java.awt.Graphics g)
Paint the button. |
void |
paintHighlight(java.awt.Graphics g,
java.awt.Color firstColor,
java.awt.Color secondColor)
Paint the button highlight. |
void |
paintHighlighted(java.awt.Graphics g)
Paint the button highlighted (down). |
void |
paintUnhighlighted(java.awt.Graphics g)
Paint the button unhighlighted (not down). |
void |
processActionEvent()
Create an ActionEvent and pass it to everyone listening for it. |
void |
removeActionListener(java.awt.event.ActionListener listener)
Remove the given ActionListener from my set of listeners. |
void |
setCommand(java.lang.String command)
Set the command associated with the receiver. |
void |
setHighlight(boolean isHighlighted)
Set whether this button is highlighted (down) or not. |
void |
setImage(java.awt.Image image)
Set the Image this button is associated with. |
protected static void |
waitForImage(java.awt.Component component,
java.awt.Image image)
Wait for the image to be available. |
| Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addNotify,
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,
getHeight,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocation,
getLocationOnScreen,
getMaximumSize,
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,
paramString,
postEvent,
preferredSize,
prepareImage,
prepareImage,
print,
printAll,
processComponentEvent,
processEvent,
processFocusEvent,
processInputMethodEvent,
processKeyEvent,
processMouseEvent,
processMouseMotionEvent,
remove,
removeComponentListener,
removeFocusListener,
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,
update,
validate |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
protected java.lang.String command
protected java.awt.Image image
protected java.awt.event.ActionListener actionListener
protected boolean isPressed
protected boolean isInside
protected boolean isHighlighted
| Constructor Detail |
public ImageButton()
ImageButton.public ImageButton(java.awt.Image image)
ImageButton and initalize it with the given Image.image - the image to be used.public ImageButton(java.lang.String command)
ImageButton and initalize it with the given command.command - the command that will be passed in action events.
public ImageButton(java.lang.String command,
java.awt.Image image)
ImageButton and initalize it with the
given command and Image.command - the command that will be passed in action events.image - the image to be used.| Method Detail |
public void addActionListener(java.awt.event.ActionListener listener)
ActionListener to my set of listeners.listener - the action listener to add.public java.lang.String getCommand()
protected java.lang.String getDefaultCommand()
protected java.awt.Image getDefaultImage()
public java.awt.Image getImage()
public java.awt.Dimension getMinimumSize()
ImageButton must be displayed at.public java.awt.Dimension getPreferredSize()
ImageButton prefers to be displayed at.ImageButton.public boolean isHighlighted()
public void mouseClicked(java.awt.event.MouseEvent e)
MousePressed and MouseReleased.e - the event.public void mouseEntered(java.awt.event.MouseEvent e)
isInside flag.e - the event.public void mouseExited(java.awt.event.MouseEvent e)
isInside flag.e - the event.public void mousePressed(java.awt.event.MouseEvent e)
isPressed flag.e - the event.public void mouseReleased(java.awt.event.MouseEvent e)
processActionEvent(). Then reset the isPressed flag.e - the event.public void paint(java.awt.Graphics g)
g - the graphics object to use in painting.
public void paintHighlight(java.awt.Graphics g,
java.awt.Color firstColor,
java.awt.Color secondColor)
g - the graphics object to use in painting.firstColor - the Color to paint the top and left-hand sides.secondColor - the Color to paint the bottom and right-hand sides.public void paintHighlighted(java.awt.Graphics g)
g - the graphics object to use in painting.public void paintUnhighlighted(java.awt.Graphics g)
g - the graphics object to use in painting.public void processActionEvent()
ActionEvent and pass it to everyone listening for it.public void removeActionListener(java.awt.event.ActionListener listener)
ActionListener from my set of listeners.l - ActionListenerpublic void setCommand(java.lang.String command)
command - the command to be passed in action events generated.
by this button.public void setHighlight(boolean isHighlighted)
isHighlighted - a boolean representing the button's
new highlight state.public void setImage(java.awt.Image image)
Image this button is associated with.image - the image this button should use.
protected static void waitForImage(java.awt.Component component,
java.awt.Image image)
component - the component the image is associated with.image - the image to wait for.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||