|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
com.lizardtech.djvubean.toolbar.ToggleButton
public class ToggleButton
This class is intended as an AWT replacement of JButton and JToggleButton.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
static int |
NOBORDER
Constant to incidate no border should be painted. |
static boolean |
OLD_JAVA
query java version. |
static int |
RAISED_BORDER
Constant to incidate a raised border should be painted. |
static int |
SIMPLE_BORDER
Constant to incidate a simple border should be painted. |
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 | |
---|---|
ToggleButton(java.lang.String tip,
java.lang.String text,
java.lang.Object imageArg,
java.awt.Dimension defaultSize)
Creates a new ToggleButton object equivalent to JButton. |
|
ToggleButton(java.lang.String tip,
java.lang.String text,
java.lang.Object imageArg,
java.awt.Dimension defaultSize,
boolean isSelected)
Creates a new ToggleButton object equivalent to JToggleButton. |
Method Summary | |
---|---|
void |
addActionListener(java.awt.event.ActionListener listener)
Add a new ActionListener. |
void |
addItemListener(java.awt.event.ItemListener listener)
Add a new ItemListener. |
void |
drawIcon(java.awt.Graphics g)
Called to draw this this button. |
void |
drawImage(java.awt.Graphics g,
java.awt.Image image,
int xOffset)
Called to draw the image at the specified offset. |
java.lang.String |
getActionCommand()
Query the action command. |
java.awt.event.ActionListener[] |
getActionListeners()
Query currently registered ActionListener objects. |
int |
getBorderType()
Query the border type. |
int |
getBorderX()
Get the border along the X axis. |
int |
getBorderY()
Get the border along the Y axis. |
protected java.awt.Image |
getImage(java.lang.Object imageArg)
Called to load an image. |
protected int |
getImageHeight()
Query the height of the image. |
protected int |
getImageHeightScaled()
Query the scaled height of the image. |
protected int |
getImageWidth()
Query the width of the image. |
protected int |
getImageWidthScaled()
Query the scaled width of the image. |
java.awt.event.ItemListener[] |
getItemListeners()
Query currently registered ItemListener objects. |
java.lang.String |
getLabel()
Query the text label for this button. |
java.awt.Dimension |
getMaximumSize()
Query the maximum image size allowed. |
java.awt.Dimension |
getMinimumSize()
Query the minimum image size allowed. |
java.awt.Dimension |
getPreferredSize()
Query the preferred image size allowed. |
double |
getScaleFactor()
Query the scale resizing factor used for the image. |
java.lang.Object[] |
getSelectedObjects()
Return an array of this item if selected, otherwise an empty array is returned. |
boolean |
imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int width,
int height)
Callback called to indicate the icon image has been updated. |
boolean |
isSelected()
Query if selected. |
void |
paint(java.awt.Graphics g)
Called to draw the button. |
void |
paintAll(java.awt.Graphics g)
Called to paint the component. |
protected void |
processActionEvent(java.awt.event.ActionEvent event)
Called to process an ActionEvent. |
protected void |
processEvent(java.awt.AWTEvent event)
Called to process an event. |
protected void |
processItemEvent(java.awt.event.ItemEvent event)
Called to process an item event. |
protected void |
processMouseEvent(java.awt.event.MouseEvent event)
Called when the mouse has updated. |
void |
removeActionListener(java.awt.event.ActionListener listener)
Remove an ActionListener. |
void |
removeItemListener(java.awt.event.ItemListener listener)
Remove an ItemListener. |
void |
repaintWait(long timeout)
Called to invoke a repaint, and wait upto the specified timeout value in milliseconds for the update() method to be invoked. |
void |
setActionCommand(java.lang.String actionCommand)
Set the action command. |
void |
setBorderType(int borderType)
Sets the border type. |
void |
setEnabled(boolean enabled)
Set the enabled property of this Component. |
protected void |
setImageHeight(int height)
Set the height of the image. |
protected void |
setImageWidth(int width)
Set the width of the image. |
void |
setLabel(java.lang.String text)
Set the text label for this button. |
void |
setScaleFactor(double value)
Set the scale resizing factor used for the image. |
void |
setSelected(boolean value)
Set the selected value. |
void |
update(java.awt.Graphics g)
Called to draw the button. |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final boolean OLD_JAVA
public static final int NOBORDER
public static final int RAISED_BORDER
public static final int SIMPLE_BORDER
Constructor Detail |
---|
public ToggleButton(java.lang.String tip, java.lang.String text, java.lang.Object imageArg, java.awt.Dimension defaultSize)
tip
- Tool tip to display. (For future use.)text
- Text to display.imageArg
- Image to display.defaultSize
- default button size.public ToggleButton(java.lang.String tip, java.lang.String text, java.lang.Object imageArg, java.awt.Dimension defaultSize, boolean isSelected)
tip
- Tool tip to display. (For future use.)text
- Text to display.imageArg
- Image to display.defaultSize
- default button size.isSelected
- Initial selection value.Method Detail |
---|
public void setActionCommand(java.lang.String actionCommand)
actionCommand
- string to set.public java.lang.String getActionCommand()
public java.awt.event.ActionListener[] getActionListeners()
public void setBorderType(int borderType)
borderType
- how to draw the border.public int getBorderType()
public int getBorderX()
public int getBorderY()
public void setEnabled(boolean enabled)
setEnabled
in class java.awt.Component
enabled
- true if enabled.public java.awt.event.ItemListener[] getItemListeners()
public void setLabel(java.lang.String text)
text
- label for this button.public java.lang.String getLabel()
public java.awt.Dimension getMaximumSize()
getMaximumSize
in class java.awt.Container
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class java.awt.Container
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class java.awt.Container
public void setScaleFactor(double value)
value
- scale factor used for resizing the image.public double getScaleFactor()
public void setSelected(boolean value)
value
- true if selected.public boolean isSelected()
public java.lang.Object[] getSelectedObjects()
getSelectedObjects
in interface java.awt.ItemSelectable
public void addActionListener(java.awt.event.ActionListener listener)
listener
- to add.public void addItemListener(java.awt.event.ItemListener listener)
addItemListener
in interface java.awt.ItemSelectable
listener
- to add.public void drawIcon(java.awt.Graphics g)
g
- Graphics device to draw to.public void drawImage(java.awt.Graphics g, java.awt.Image image, int xOffset)
g
- graphics object to draw.image
- to draw.xOffset
- offset along the X axis.public boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
imageUpdate
in interface java.awt.image.ImageObserver
imageUpdate
in class java.awt.Component
img
- updated image.infoflags
- flags indicating update status.x
- coordinate of the image.y
- coordinate of the image.width
- of the image.height
- height of the image.
public void paint(java.awt.Graphics g)
paint
in class java.awt.Container
g
- Graphics device to draw to.public void paintAll(java.awt.Graphics g)
paintAll
in class java.awt.Component
g
- graphics object to paint.public void removeActionListener(java.awt.event.ActionListener listener)
listener
- to remove.public void removeItemListener(java.awt.event.ItemListener listener)
removeItemListener
in interface java.awt.ItemSelectable
listener
- to remove.public void repaintWait(long timeout)
timeout
- maximum time to wait.public void update(java.awt.Graphics g)
update
in class java.awt.Container
g
- Graphics device to draw to.protected java.awt.Image getImage(java.lang.Object imageArg)
imageArg
- argument indicating the image, URL, or string path of
the image to load.
protected void setImageHeight(int height)
height
- of the image.protected int getImageHeight()
protected int getImageHeightScaled()
protected void setImageWidth(int width)
width
- of the image.protected int getImageWidth()
protected int getImageWidthScaled()
protected void processActionEvent(java.awt.event.ActionEvent event)
event
- event to process.protected void processEvent(java.awt.AWTEvent event)
processEvent
in class java.awt.Container
event
- to process.protected void processItemEvent(java.awt.event.ItemEvent event)
event
- event to process.protected void processMouseEvent(java.awt.event.MouseEvent event)
processMouseEvent
in class java.awt.Component
event
- describes the mouse update.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |