|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--com.javaranch.common.LButton
Lightweight button that uses images for the button.
Each button has its own up, down and disabled image.
- - - - - - - - - - - - - - - - -
Copyright (c) 1998-2004 Paul Wheaton
You are welcome to do whatever you want to with this source file provided that you maintain this comment fragment (between the dashed lines). Modify it, change the package name, change the class name ... personal or business use ... sell it, share it ... add a copyright for the portions you add ...
My goal in giving this away and maintaining the copyright is to hopefully direct developers back to JavaRanch.
The original source can be found at JavaRanch
- - - - - - - - - - - - - - - - -
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 | |
LButton(ButtonData d,
ButtonAdapter a)
Create a new LButton object from serialized data. |
|
LButton(java.awt.Image upImage,
java.awt.Image downImage,
java.awt.Image dimImage,
int x,
int y,
ButtonAdapter a)
|
|
LButton(java.lang.Object obj,
java.lang.String rootImageName,
int x,
int y,
ButtonAdapter a)
|
|
LButton(java.lang.String rootImageName,
int x,
int y,
ButtonAdapter a)
|
Method Summary | |
void |
addButtonListener(ButtonAdapter a)
|
void |
addButtonListener(ButtonListener bl)
Capture mouse press or release events. |
void |
addPressListener(PressListener pl)
Capture mouse press events. |
void |
addReleaseListener(ReleaseListener rl)
Capture mouse release events. |
void |
forceDown()
Force the button to "down" mode. |
void |
forceUp()
Force the button to "up" mode. |
java.awt.Dimension |
getPreferredSize()
For internal use only. |
void |
mouseClicked(java.awt.event.MouseEvent e)
For internal use only. |
void |
mouseDragged(java.awt.event.MouseEvent e)
For internal use only. |
void |
mouseEntered(java.awt.event.MouseEvent e)
For internal use only. |
void |
mouseExited(java.awt.event.MouseEvent e)
For internal use only. |
void |
mouseMoved(java.awt.event.MouseEvent e)
For internal use only. |
void |
mousePressed(java.awt.event.MouseEvent e)
For internal use only. |
void |
mouseReleased(java.awt.event.MouseEvent e)
For internal use only. |
void |
paint(java.awt.Graphics g)
For internal use only. |
void |
setEnabled(boolean yes)
Overrides the Component.setEnabled method so the proper image can be used. |
void |
update(java.awt.Graphics g)
|
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, 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, getAccessibleContext, 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, getListeners, 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, 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, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, 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 LButton(java.lang.String rootImageName, int x, int y, ButtonAdapter a) throws java.lang.Exception
public LButton(java.lang.Object obj, java.lang.String rootImageName, int x, int y, ButtonAdapter a) throws java.lang.Exception
public LButton(ButtonData d, ButtonAdapter a) throws java.lang.Exception
Passing in the down or dim images is optional.
public LButton(java.awt.Image upImage, java.awt.Image downImage, java.awt.Image dimImage, int x, int y, ButtonAdapter a)
Method Detail |
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class java.awt.Component
public void addButtonListener(ButtonAdapter a)
public void update(java.awt.Graphics g)
update
in class java.awt.Component
public void paint(java.awt.Graphics g)
paint
in class java.awt.Component
public void setEnabled(boolean yes)
setEnabled
in class java.awt.Component
public void addPressListener(PressListener pl)
public void addReleaseListener(ReleaseListener rl)
public void addButtonListener(ButtonListener bl)
public void forceUp()
public void forceDown()
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |