public class ImageButton extends Canvas implements MouseListener
Canvas.AccessibleAWTCanvas
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static int |
ARMED |
static int |
DISABLED |
static int |
OVER |
static int |
UNARMED |
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
ImageButton()
Constructs an ImageButton
|
ImageButton(Image image)
Constructs an ImageButton with the given image.
|
Modifier and Type | Method and Description |
---|---|
void |
addActionListener(ActionListener l) |
String |
getActionCommand() |
Border |
getArmedBorder()
Gets the border to display when the button is pressed and the mouse
is still over the button.
|
Image |
getArmedImage()
Gets the image to display when the button is pressed and the mouse
is still over the button.
|
int |
getButtonState()
Gets the current buttonState id for the button
|
Border |
getDisabledBorder()
Gets the border to display when the button is disabled.
|
Image |
getDisabledImage()
Gets the image to display when the button is disabled.
|
Border |
getOverBorder()
Gets the border to display when the button is not pressed and the mouse
is over the button.
|
Image |
getOverImage()
Gets the image to display when the button is not pressed and the mouse
is over the button.
|
Dimension |
getPreferredSize()
Overrides awt.Component.preferredSize() to return the preferred size of the button.
|
Border |
getUnarmedBorder()
Gets the border to display when the button is not pressed or hilited
because of a mouse-over.
|
Image |
getUnarmedImage()
Gets the image to display when the button is not pressed or hilited
because of a mouse-over.
|
void |
mouseClicked(MouseEvent arg0) |
void |
mouseEntered(MouseEvent arg0) |
void |
mouseExited(MouseEvent arg0) |
void |
mousePressed(MouseEvent arg0) |
void |
mouseReleased(MouseEvent arg0) |
void |
paint(Graphics g)
Overrides awt.Component.paint() to paint the current border and image.
|
protected void |
processActionEvent(ActionEvent e) |
void |
removeActionListener(ActionListener l) |
void |
setActionCommand(String command) |
void |
setArmedBorder(Border border)
Sets the border to display when the button is pressed and the mouse
is still over the button.
|
void |
setArmedImage(Image image)
Sets the image to display when the button is pressed and the mouse
is still over the button.
|
protected void |
setButtonState(int buttonState)
Sets the current buttonState id for the button
|
void |
setDisabledBorder(Border border)
Sets the border to display when the button is disabled.
|
void |
setDisabledImage(Image image)
Sets the image to display when the button is disabled.
|
void |
setOverBorder(Border border)
Sets the border to display when the button is not pressed and the mouse
is over the button.
|
void |
setOverImage(Image image)
Sets the image to display when the button is not pressed and the mouse
is over the button.
|
void |
setUnarmedBorder(Border border)
Sets the border to display when the button is not pressed or hilited
because of a mouse-over.
|
void |
setUnarmedImage(Image image)
Sets the image to display when the button is not pressed or hilited
because of a mouse-over.
|
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, 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, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, 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, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, 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, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
public static final int UNARMED
public static final int ARMED
public static final int OVER
public static final int DISABLED
public ImageButton()
public ImageButton(Image image)
image
- the image for all states of the button
(until other images are assigned)public void setUnarmedImage(Image image)
image
- the unarmed imagepublic void setArmedImage(Image image)
image
- the armed imagepublic void setOverImage(Image image)
image
- the over imagepublic void setDisabledImage(Image image)
image
- the disabled imagepublic Image getUnarmedImage()
public Image getArmedImage()
public Image getOverImage()
public Image getDisabledImage()
public void setUnarmedBorder(Border border)
border
- the unarmed borderpublic void setArmedBorder(Border border)
border
- the armed borderpublic void setOverBorder(Border border)
border
- the over borderpublic void setDisabledBorder(Border border)
border
- the disabled borderpublic Border getUnarmedBorder()
public Border getArmedBorder()
public Border getOverBorder()
public Border getDisabledBorder()
public int getButtonState()
protected void setButtonState(int buttonState)
buttonState
- the button state integer idpublic void paint(Graphics g)
public Dimension getPreferredSize()
getPreferredSize
in class Component
public void setActionCommand(String command)
public String getActionCommand()
public void addActionListener(ActionListener l)
public void removeActionListener(ActionListener l)
protected void processActionEvent(ActionEvent e)
public void mouseClicked(MouseEvent arg0)
mouseClicked
in interface MouseListener
public void mousePressed(MouseEvent arg0)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent arg0)
mouseReleased
in interface MouseListener
public void mouseEntered(MouseEvent arg0)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent arg0)
mouseExited
in interface MouseListener
Copyright © 2015–2021 Fiji. All rights reserved.