SilverStream
Application Server 3.5

com.sssw.rt.jform
Class AgcJToggleButton

java.lang.Object
 |
 +--java.awt.Component
       |
       +--java.awt.Container
             |
             +--javax.swing.JComponent
                   |
                   +--javax.swing.AbstractButton
                         |
                         +--javax.swing.JToggleButton
                               |
                               +--com.sssw.rt.jform.AgcJToggleButton
All Implemented Interfaces:
Accessible, AgiHelpInfo, ImageObserver, ItemSelectable, MenuContainer, Serializable, SwingConstants

public class AgcJToggleButton
extends JToggleButton
implements AgiHelpInfo

A lightweight button component that displays an image and has two states: normal and selected. AgcJToggleButton can be bound to a database column.

You can assign icon images to show the normal and selected states, as well as other conditions, such as pressed, disabled, and rollover (when the mouse is over the button).

A toggle button control has a boolean value indicating whether it is selected. It also has an Object value that is stored in the database when the control is bound to a database column. You can specify source values for the storage value by setting the control's checked and unchecked values. When the control changes its selected state, the appropriate source value (checked or unchecked) becomes the current value.

To get or change the boolean state of the control, call AbstractButton.isSelected() or AbstractButton.setSelected(boolean).

To get or change the Object values, call:

Properties:
Caption Expression, Caption Text, Control Type, Disabled Image, Disabled Selected Image, Enabled, Font Name, Font Size, Font Style, Height, Help Page, Horizontal Alignment, Horizontal text position, Left, Name, Normal Image, Pressed Image, Rollover Image, Rollover Selected Image, Selected Image, Tool Tip, Top, Transparent, Vertical Alignment, Vertical text position, Visible, Width
Events:
actionPerformed, focusGained, focusLost, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JToggleButton
JToggleButton.AccessibleJToggleButton, JToggleButton.ToggleButtonModel
 
Inner classes inherited from class javax.swing.AbstractButton
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
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
 
Constructor Summary
AgcJToggleButton()
          Creates an initially unselected toggle button with no text or image.
AgcJToggleButton(Icon icon)
          Creates an initially unselected toggle button with the specified image but no text.
AgcJToggleButton(Icon icon, boolean selected)
          Creates a toggle button with the specified image and selection state, but no text.
AgcJToggleButton(String text)
          Creates an unselected toggle button with the specified text.
AgcJToggleButton(String text, boolean selected)
          Creates a toggle button with the specified text and selection state.
AgcJToggleButton(String text, Icon icon)
          Creates a toggle button that has the specified text and image, and that is initially unselected.
AgcJToggleButton(String text, Icon icon, boolean selected)
          Creates a toggle button with the specified text, image, and selection state.
 
Method Summary
 Object getCheckedValue()
          Gets the button's "checked value" - the value of the button when it is selected.
 boolean getState()
          Deprecated. use isSelected().
 Object getUncheckedValue()
          Gets the button's "unchecked value" - the value of the button when it is not selected.
 Object getValue()
          Gets the user-specified Object mapped to the current button state.
 void setCheckedValue(Object value)
          Sets the button's "checked value" - the value of the button when it is selected.
 void setState(boolean state)
          Deprecated. use setSelected().
 void setUncheckedValue(Object value)
          Sets the button's "unchecked value" - the value of the button when it is not selected.
 void setValue(Object value)
          Sets the button's state, based on the value.
 
Methods inherited from class javax.swing.JToggleButton
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.AbstractButton
addActionListener, addChangeListener, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getActionCommand, getDisabledIcon, getDisabledSelectedIcon, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getLabel, getMargin, getMnemonic, getModel, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setEnabled, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setLabel, setMargin, setMnemonic, setMnemonic, setModel, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods implemented from interface com.sssw.rt.form.AgiHelpInfo
getHelpInfo, setHelpInfo
 

Constructor Detail

AgcJToggleButton

public AgcJToggleButton()
Creates an initially unselected toggle button with no text or image.

AgcJToggleButton

public AgcJToggleButton(Icon icon)
Creates an initially unselected toggle button with the specified image but no text.
Parameters:
icon - the image displayed on the button

AgcJToggleButton

public AgcJToggleButton(Icon icon,
                        boolean selected)
Creates a toggle button with the specified image and selection state, but no text.
Parameters:
icon - the image displayed on the button
selected - if true, the button is initially selected; otherwise, the button is initially unselected

AgcJToggleButton

public AgcJToggleButton(String text)
Creates an unselected toggle button with the specified text.
Parameters:
text - the text label displayed on the toggle button

AgcJToggleButton

public AgcJToggleButton(String text,
                        boolean selected)
Creates a toggle button with the specified text and selection state.
Parameters:
text - the text label displayed on the toggle button
selected - if true, the button is initially selected; otherwise, the button is initially unselected

AgcJToggleButton

public AgcJToggleButton(String text,
                        Icon icon)
Creates a toggle button that has the specified text and image, and that is initially unselected.
Parameters:
text - the text label displayed on the toggle button
icon - the image displayed on the button

AgcJToggleButton

public AgcJToggleButton(String text,
                        Icon icon,
                        boolean selected)
Creates a toggle button with the specified text, image, and selection state.
Parameters:
text - the text label displayed on the toggle button
icon - the image displayed on the button
selected - if true, the button is initially selected; otherwise, the button is initially unselected
Method Detail

setCheckedValue

public void setCheckedValue(Object value)
Sets the button's "checked value" - the value of the button when it is selected.
Parameters:
value - an Object that becomes the button's value when it is selected
Usage:
This method works only if the toggle button uses the default data model. AgcJToggleButton uses the default data model when no other model has been set using the AbstractButton.setModel(ButtonModel) method.
See Also:
AgcJToggleButton.getCheckedValue(), AgcJToggleButton.getValue(), AgcJToggleButton.setValue(Object)

getCheckedValue

public Object getCheckedValue()
Gets the button's "checked value" - the value of the button when it is selected.
Returns:
an Object that is the button's value when it is selected
Usage:
This method works only if the toggle button uses the default data model. AgcJToggleButton uses the default data model when no other model has been set using the AbstractButton.setModel(ButtonModel) method.
See Also:
AgcJToggleButton.setCheckedValue(Object), AgcJToggleButton.getValue(), AgcJToggleButton.setValue(Object)

setUncheckedValue

public void setUncheckedValue(Object value)
Sets the button's "unchecked value" - the value of the button when it is not selected.
Parameters:
value - an Object that becomes the button's value when it is not selected
Usage:
This method works only if the toggle button uses the default data model. AgcJToggleButton uses the default data model when no other model has been set using the AbstractButton.setModel(ButtonModel) method.
See Also:
AgcJToggleButton.getUncheckedValue(), AgcJToggleButton.setCheckedValue(Object)

getUncheckedValue

public Object getUncheckedValue()
Gets the button's "unchecked value" - the value of the button when it is not selected.
Returns:
an Object that is the button's value when it is not selected
Usage:
This method works only if the toggle button uses the default data model. AgcJToggleButton uses the default data model when no other model has been set using the AbstractButton.setModel(ButtonModel) method.
See Also:
AgcJToggleButton.setUncheckedValue(Object), AgcJToggleButton.getCheckedValue()

setValue

public void setValue(Object value)
Sets the button's state, based on the value. If the value matches the button's checked value, then the button becomes selected. Otherwise it becomes deselected.
Parameters:
value - an Object that will be the button's value
Usage:
Calling setValue() doesn't change the checked and unchecked values. The value you specify with setValue() will be reset to the checked or unchecked value if the user changes the button's state.
See Also:
AgcJToggleButton.getValue(), AgcJToggleButton.setCheckedValue(Object)

getValue

public Object getValue()
Gets the user-specified Object mapped to the current button state. If the toggle button is selected, the checked value is returned, or if it unselected, the unchecked value is returned. If the value has been explicitly set with setValue, that value is returned.
Returns:
an Object that is the current value of the toggle button
Usage:
This method works only if the toggle button uses the default data model. AgcJToggleButton uses the default data model when no other model has been set using the AbstractButton.setModel(ButtonModel) method.
See Also:
AgcJToggleButton.getCheckedValue(), AgcJToggleButton.getUncheckedValue()

setState

public void setState(boolean state)
Deprecated. use setSelected().

Sets the state of the button.
See Also:
AbstractButton.setSelected(boolean)

getState

public boolean getState()
Deprecated. use isSelected().

Gets the state of the button.
See Also:
AbstractButton.isSelected()

SilverStream
Application Server 3.5