HOME

com.ultraswing
Class ToolBarToggleButton

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.AbstractButton
                          |
                          +--javax.swing.JButton
                                |
                                +--com.ultraswing.ToggleButton
                                      |
                                      +--com.ultraswing.FlatToggleButton
                                            |
                                            +--com.ultraswing.ToolBarToggleButton
All Implemented Interfaces:
Accessible, EventListener, ImageObserver, ItemSelectable, MenuContainer, MouseListener, PropertyChangeListener, Serializable, SwingConstants

public class ToolBarToggleButton
extends FlatToggleButton
implements PropertyChangeListener

Toggle button on toolbar

See Also:
Serialized Form

Field Summary
static Dimension ICON_ONLY_SIZE
           
static int ICON_ONLY_STYLE
           
static Dimension TEXT_ICON_HORIZONTAL_SIZE
           
static int TEXT_ICON_STYLE
           
static Dimension TEXT_ICON_VERTICAL_SIZE
           
static Dimension TEXT_ONLY_SIZE
           
static int TEXT_ONLY_STYLE
           
 
Fields inherited from class javax.swing.AbstractButton
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ToolBarToggleButton()
          Creates a button with no set text or icon.
ToolBarToggleButton(String text)
          Creates a button with text.
ToolBarToggleButton(String text, Icon img)
          Creates a button with initial text and an icon.
ToolBarToggleButton(String text, Icon img, boolean isVertical)
          Creates a button with initial text and an icon.
ToolBarToggleButton(String text, Icon img, int style, boolean isVertical)
          Creates a button with initial text and an icon.
 
Method Summary
 Dimension getButtonSize(int style, boolean isVertical)
           
 Icon getIcon()
          Returns the icon
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void propertyChange(PropertyChangeEvent e)
           
 void setButtonSize(int style, boolean isVertical, Dimension size)
           
 void setIcon(Icon icon)
          Sets button icon
 void setStyle(int style)
          Sets button style
 void setText(String text)
          Sets button text
 void setVertical(boolean b)
          Makes this button vertical or not depending on the parameter b
 
Methods inherited from class com.ultraswing.FlatToggleButton
getState, getVerticalButtonIcon, getVerticalButtonText, mouseClicked, mousePressed, mouseReleased, paintComponent, setAntialias, setBorderChangeable, setState
 
Methods inherited from class javax.swing.JButton
configurePropertiesFromAction, getAccessibleContext, getUIClassID, isDefaultButton, isDefaultCapable, paramString, removeNotify, setDefaultCapable, updateUI
 
Methods inherited from class javax.swing.AbstractButton
addActionListener, addChangeListener, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setEnabled, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIconTextGap, setLabel, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setUI, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, 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

ICON_ONLY_STYLE

public static final int ICON_ONLY_STYLE
See Also:
Constant Field Values

TEXT_ONLY_STYLE

public static final int TEXT_ONLY_STYLE
See Also:
Constant Field Values

TEXT_ICON_STYLE

public static final int TEXT_ICON_STYLE
See Also:
Constant Field Values

ICON_ONLY_SIZE

public static final Dimension ICON_ONLY_SIZE

TEXT_ONLY_SIZE

public static final Dimension TEXT_ONLY_SIZE

TEXT_ICON_VERTICAL_SIZE

public static final Dimension TEXT_ICON_VERTICAL_SIZE

TEXT_ICON_HORIZONTAL_SIZE

public static final Dimension TEXT_ICON_HORIZONTAL_SIZE
Constructor Detail

ToolBarToggleButton

public ToolBarToggleButton()
Creates a button with no set text or icon.


ToolBarToggleButton

public ToolBarToggleButton(String text)
Creates a button with text.

Parameters:
text - the text of the button

ToolBarToggleButton

public ToolBarToggleButton(String text,
                           Icon img)
Creates a button with initial text and an icon.

Parameters:
text - the text of the button
img - the Icon image to display on the button

ToolBarToggleButton

public ToolBarToggleButton(String text,
                           Icon img,
                           boolean isVertical)
Creates a button with initial text and an icon.

Parameters:
text - the text of the button
img - the Icon image to display on the button
isVertical - if true, this button is a vertical button

ToolBarToggleButton

public ToolBarToggleButton(String text,
                           Icon img,
                           int style,
                           boolean isVertical)
Creates a button with initial text and an icon.

Parameters:
text - the text of the button
img - the Icon image to display on the button
style - button style, possible values are ToolBarToggleButton.TEXT_ONLY_STYLE, ToolBarToggleButton.ICON_ONLY_STYLE, ToolBarToggleButton.TEXT_ICON_STYLE
isVertical - if true, this button is a vertical button
Method Detail

setStyle

public void setStyle(int style)
Sets button style

Parameters:
style - button style, possible values are ToolBarToggleButton.TEXT_ONLY_STYLE, ToolBarToggleButton.ICON_ONLY_STYLE, ToolBarToggleButton.TEXT_ICON_STYLE

setText

public void setText(String text)
Sets button text

Overrides:
setText in class com.ultraswing.ToggleButton

setIcon

public void setIcon(Icon icon)
Sets button icon

Overrides:
setIcon in class com.ultraswing.ToggleButton

getIcon

public Icon getIcon()
Returns the icon

Overrides:
getIcon in class AbstractButton

propertyChange

public void propertyChange(PropertyChangeEvent e)
Specified by:
propertyChange in interface PropertyChangeListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener
Overrides:
mouseEntered in class FlatToggleButton

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener
Overrides:
mouseExited in class FlatToggleButton

setVertical

public void setVertical(boolean b)
Makes this button vertical or not depending on the parameter b

Overrides:
setVertical in class com.ultraswing.ToggleButton
Parameters:
b - if true, show vertical button

setButtonSize

public void setButtonSize(int style,
                          boolean isVertical,
                          Dimension size)

getButtonSize

public Dimension getButtonSize(int style,
                               boolean isVertical)

HOME

Copyright © 2002 iReasoning Networks. All Rights Reserved.