swingwtx.swing
Class AbstractButton
java.lang.Object
swingwt.awt.Component
swingwt.awt.Container
swingwtx.swing.JComponent
swingwtx.swing.AbstractButton
- All Implemented Interfaces:
- ImageObserver, MenuContainer, SwingConstants
- Direct Known Subclasses:
- JButton, JCheckBox, JRadioButton, JSWTMenuComponent, JToggleButton
- public abstract class AbstractButton
- extends JComponent
- implements SwingConstants
Swing Abstract Button superclass for improved
swingy-ness (and correct ActionEvent command)
Written by Diane Trout, few changes and fixes up by me
to provide a better hierarchy and prevent ActionEvents
being fired twice.
Fields inherited from class swingwtx.swing.JComponent |
accessibleContext, actionMap, ancestorInputMap, border, clientProperties, descendantHasPeer, focusInputMap, internalFrameAdapter, internalFrameParent, opaque, propertyChangeListeners, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, windowInputMap |
Fields inherited from class swingwt.awt.Component |
actionCommand, actionListeners, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListeners, componentName, consumeAvailableHeight, consumeAvailableWidth, focusable, focusListeners, graphicsConfig, inputMethodListeners, isUserSetFont, keyListeners, layoutModifier, LEFT_ALIGNMENT, LOCK, mouseListeners, mouseMotionListeners, mouseWheelListeners, parent, pBackground, pCursor, pDoubleBuffered, peer, pEnabled, pFont, pForeground, pLayoutData, pLocation, pMaxSize, pMinSize, pPrefSize, pSize, pToolTipText, pVisible, RIGHT_ALIGNMENT, swingWTDefaultActionEventAdapter, swingWTEventAdapter, TOP_ALIGNMENT |
Fields inherited from interface swingwtx.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 |
Methods inherited from class swingwtx.swing.JComponent |
add, add, add, add, add, addPropertyChangeListener, addPropertyChangeListener, checkInternalFrameChild, dispose, getAccessibleContext, getActionMap, getAutoscrolls, getBorder, getClientProperty, getInputMap, getInsets, getToolTipLocation, getToolTipText, getTopLevelAncestor, getVisibleRect, isDoubleBuffered, isOpaque, isOptimizedDrawingEnabled, isValidateRoot, paint, paintBackground, paintChildren, paintComponent, paintImmediately, paintImmediately, putClientProperty, remove, remove, removePropertyChangeListener, removePropertyChangeListener, repaint, revalidate, scrollRectToVisible, setActionMap, setAutoscrolls, setBorder, setDoubleBuffered, setInputMap, setMargin, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setSwingWTParent |
Methods inherited from class swingwt.awt.Container |
addComponentToLayout, addContainerListener, debug_showContainmentTree, doAdd, doLayout, getComponent, getComponentCount, getComponentOrientation, getComponents, getComposite, getLayout, getMaximumSize, getMinimumSize, getParent, getPreferredSize, invalidate, minimumSize, preferredSize, processContainerEvent, processEvent, queuedValidate, removeAll, removeComponentFromCache, removeContainerListener, setLayout, setLayoutImpl, validate |
Methods inherited from class swingwt.awt.Component |
add, addActionListener, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, calculatePreferredSize, componentOnlyDispose, computePreferredSize, contains, contains, createImage, createListenerArrayFromVector, createVolatileImage, dispatchEvent, getAlignmentX, getAlignmentY, getBackground, getBounds, getCursor, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getListeners, getLocation, getLocationOnScreen, getName, getPeer, getPeerSize, getSize, getSize, getSWTPeer, getToolkit, getToolTipText, getTreeLock, getWidth, getX, getY, grabFocus, hasFocus, hasSetFont, hide, imageUpdate, inside, isEnabled, isFocusable, isMinimumSizeSet, isShowing, isVisible, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, processTraverseEvent, registerComponentEvents, registerEvents, registerExtendedModifyEvents, registerFocusEvents, registerKeyEvents, registerModifyEvents, registerMouseEvents, registerPaintEvents, registerTraversalEvents, remove, removeActionListener, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, repaint, repaint, repaint, requestFocus, setActionCommand, setAlignmentX, setAlignmentY, setBackground, setBounds, setBounds, setCachedProperties, setComponentOrientation, setComponentRemoved, setCursor, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setFont, setForeground, setHeight, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setSize, setSize, setVisible, setWidth, show, transferFocus, transferFocusBackward, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ppeer
protected org.eclipse.swt.widgets.Button ppeer
pText
protected java.lang.String pText
pModel
protected ButtonModel pModel
pGroup
protected ButtonGroup pGroup
pMnemonic
protected char pMnemonic
pSelection
protected boolean pSelection
pHTextPosition
protected int pHTextPosition
pVTextPosition
protected int pVTextPosition
pHAlign
protected int pHAlign
pVAlign
protected int pVAlign
pIcon
protected Icon pIcon
pAction
protected Action pAction
changeListeners
protected java.util.Vector changeListeners
itemListeners
protected java.util.Vector itemListeners
AbstractButton
public AbstractButton()
setAction
public void setAction(Action a)
setAction
protected void setAction(Action a,
boolean addAsListener)
- Works like setAction.
- Parameters:
a
- The action to setaddAsListener
- Whether or not to add the action as a listener to the button.
This method is used by JToolBar with wrappers and prevents running out of
stack space by getting into an endless loop of actions that fire events.
getAction
public Action getAction()
getActionCommand
public java.lang.String getActionCommand()
- If the action command is null, return the button text like Swing
- Overrides:
getActionCommand
in class Component
setIcon
public void setIcon(Icon icon)
setPressedIcon
public void setPressedIcon(Icon icon)
setRolloverIcon
public void setRolloverIcon(Icon icon)
setRolloverSelectedIcon
public void setRolloverSelectedIcon(Icon icon)
setDisabledIcon
public void setDisabledIcon(Icon icon)
setSelectedIcon
public void setSelectedIcon(Icon icon)
setBorderPainted
public void setBorderPainted(boolean b)
setFocusPainted
public void setFocusPainted(boolean b)
setContentAreaFilled
public void setContentAreaFilled(boolean b)
addChangeListener
public void addChangeListener(ChangeListener l)
removeChangeListener
public void removeChangeListener(ChangeListener l)
addItemListener
public void addItemListener(ItemListener l)
removeItemListener
public void removeItemListener(ItemListener l)
registerActionEvents
protected void registerActionEvents()
- Overridden as we use the Button selection for action events
- Overrides:
registerActionEvents
in class Component
setHorizontalAlignment
public void setHorizontalAlignment(int align)
setVerticalAlignment
public void setVerticalAlignment(int align)
getHorizontalAlignment
public int getHorizontalAlignment()
getVerticalAlignment
public int getVerticalAlignment()
setHorizontalTextPosition
public void setHorizontalTextPosition(int textpos)
setVerticalTextPosition
public void setVerticalTextPosition(int textpos)
getHorizontalTextPosition
public int getHorizontalTextPosition()
getVerticalTextPosition
public int getVerticalTextPosition()
processActionEvent
public void processActionEvent(int id)
- Sends action events to listeners.
- Overrides:
processActionEvent
in class Component
processItemEvent
public void processItemEvent()
- Handles firing of Item events for when selection changes
getText
public java.lang.String getText()
setText
public void setText(java.lang.String text)
getMnemonic
public int getMnemonic()
setMnemonic
public void setMnemonic(char mnemonic)
setMnemonic
public void setMnemonic(int mnemonic)
showMnemonic
protected void showMnemonic()
isSelected
public abstract boolean isSelected()
setSelected
public abstract void setSelected(boolean b)
setToolTipText
public void setToolTipText(java.lang.String text)
- Sets the tooltip text used on the component - overridden here,
so that if we have a mnemonic, we can tack it on the end. Only applies
to JButton and JToggleButton
- Overrides:
setToolTipText
in class Component
setModel
public void setModel(ButtonModel m)
getModel
public ButtonModel getModel()
setGroup
public void setGroup(ButtonGroup g)