swingwtx.swing
Class JButton

java.lang.Object
  extended byswingwt.awt.Component
      extended byswingwt.awt.Container
          extended byswingwtx.swing.JComponent
              extended byswingwtx.swing.AbstractButton
                  extended byswingwtx.swing.JButton
All Implemented Interfaces:
ButtonModel, ImageObserver, ItemSelectable, MenuContainer, SwingConstants

public class JButton
extends AbstractButton
implements SwingConstants, ButtonModel


Nested Class Summary
 
Nested classes inherited from class swingwtx.swing.JComponent
JComponent.InternalFrameSelectionListener
 
Field Summary
protected  Container pDefaultButtonParent
           
protected  boolean pDefaultCapable
           
protected  Icon pImage
           
protected  org.eclipse.swt.widgets.ToolItem pSWTToolButton
          If this JButton is representing an SWT tool button, a reference to it
 
Fields inherited from class swingwtx.swing.AbstractButton
changeListeners, itemListeners, pAction, pGroup, pHAlign, pHTextPosition, pIcon, pMnemonic, pModel, ppeer, pSelection, pText, pVAlign, pVTextPosition
 
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.Container
composite, comps, containerListeners, layout, queuedValidateRequest
 
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
 
Fields inherited from interface swingwt.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
  JButton()
           
  JButton(Action a)
           
protected JButton(Action a, boolean addAsListener)
           
  JButton(Icon icon)
           
  JButton(java.lang.String text)
           
  JButton(java.lang.String text, Icon icon)
           
 
Method Summary
 void addItemListener(ItemListener l)
           
protected  Dimension calculatePreferredSize()
          Overriden to calculate non-realised preferred size.
 boolean getDefaultCapable()
           
 Icon getIcon()
           
 java.lang.Object[] getSelectedObjects()
           
protected  int getSWTFlags()
           
 java.lang.String getText()
          Overrides superclass as we need to read cached text for tool button purposes
protected  void handleWindowsForegroundKludge()
           
 boolean isArmed()
           
 boolean isPressed()
           
 boolean isRollover()
           
 boolean isSelected()
           
 void removeItemListener(ItemListener l)
           
protected  void renderText()
          This makes up for deficiencies in being able to set images and text on a button.
 void setArmed(boolean b)
           
protected  void setColorTextImage(org.eclipse.swt.widgets.Button button, java.lang.String text, Color color)
           
 void setDefaultButtonParent(Container window)
           
 void setDefaultCapable(boolean b)
           
 void setEnabled(boolean b)
          Change the enabled state of the component
 void setForeground(Color foreground)
          Sets the foreground colour of the component
 void setIcon(Icon icon)
           
 void setPressed(boolean b)
           
 void setRollover(boolean b)
           
 void setSelected(boolean b)
           
 void setSwingWTParent(Container parent)
          Once a parent component receives an "add" call for a child, this being the child, this should be called to tell us to instantiate the peer and load in any cached properties.
 void setText(java.lang.String text)
          Overrides superclass so we can render it where necessary
 void setToolTipText(java.lang.String text)
          Overrides superclass so we can update any ToolItem
 
Methods inherited from class swingwtx.swing.AbstractButton
addChangeListener, getAction, getActionCommand, getHorizontalAlignment, getHorizontalTextPosition, getMnemonic, getModel, getVerticalAlignment, getVerticalTextPosition, processActionEvent, processItemEvent, registerActionEvents, removeChangeListener, setAction, setAction, setBorderPainted, setContentAreaFilled, setDisabledIcon, setFocusPainted, setGroup, setHorizontalAlignment, setHorizontalTextPosition, setMnemonic, setMnemonic, setModel, setPressedIcon, setRolloverIcon, setRolloverSelectedIcon, setSelectedIcon, setVerticalAlignment, setVerticalTextPosition, showMnemonic
 
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
 
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, 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, setFocusable, setFocusTraversalKeysEnabled, setFont, 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
 
Methods inherited from interface swingwtx.swing.ButtonModel
addActionListener, addChangeListener, getActionCommand, getMnemonic, isEnabled, removeActionListener, removeChangeListener, setActionCommand, setGroup, setMnemonic
 

Field Detail

pImage

protected Icon pImage

pDefaultCapable

protected boolean pDefaultCapable

pDefaultButtonParent

protected Container pDefaultButtonParent

pSWTToolButton

protected org.eclipse.swt.widgets.ToolItem pSWTToolButton
If this JButton is representing an SWT tool button, a reference to it

Constructor Detail

JButton

public JButton()

JButton

public JButton(java.lang.String text)

JButton

public JButton(Action a)

JButton

public JButton(Icon icon)

JButton

public JButton(java.lang.String text,
               Icon icon)

JButton

protected JButton(Action a,
                  boolean addAsListener)
See Also:
AbstractButton.setAction(Action, bool)
Method Detail

getIcon

public Icon getIcon()

setIcon

public void setIcon(Icon icon)
Overrides:
setIcon in class AbstractButton

setToolTipText

public void setToolTipText(java.lang.String text)
Overrides superclass so we can update any ToolItem

Overrides:
setToolTipText in class AbstractButton

getText

public java.lang.String getText()
Overrides superclass as we need to read cached text for tool button purposes

Overrides:
getText in class AbstractButton

setText

public void setText(java.lang.String text)
Overrides superclass so we can render it where necessary

Overrides:
setText in class AbstractButton

setEnabled

public void setEnabled(boolean b)
Description copied from class: Component
Change the enabled state of the component

Specified by:
setEnabled in interface ButtonModel
Overrides:
setEnabled in class Component

getDefaultCapable

public boolean getDefaultCapable()

setDefaultCapable

public void setDefaultCapable(boolean b)

setColorTextImage

protected void setColorTextImage(org.eclipse.swt.widgets.Button button,
                                 java.lang.String text,
                                 Color color)

renderText

protected void renderText()
This makes up for deficiencies in being able to set images and text on a button. Call it after setting either the text or image.


setForeground

public void setForeground(Color foreground)
Description copied from class: Component
Sets the foreground colour of the component

Overrides:
setForeground in class Component

handleWindowsForegroundKludge

protected void handleWindowsForegroundKludge()

calculatePreferredSize

protected Dimension calculatePreferredSize()
Overriden to calculate non-realised preferred size.

Overrides:
calculatePreferredSize in class Component

getSWTFlags

protected int getSWTFlags()

setSwingWTParent

public void setSwingWTParent(Container parent)
                      throws java.lang.Exception
Once a parent component receives an "add" call for a child, this being the child, this should be called to tell us to instantiate the peer and load in any cached properties.

Overrides:
setSwingWTParent in class JComponent
Throws:
java.lang.Exception

setDefaultButtonParent

public void setDefaultButtonParent(Container window)

isSelected

public boolean isSelected()
Specified by:
isSelected in interface ButtonModel
Specified by:
isSelected in class AbstractButton

setSelected

public void setSelected(boolean b)
Specified by:
setSelected in interface ButtonModel
Specified by:
setSelected in class AbstractButton

addItemListener

public void addItemListener(ItemListener l)
Specified by:
addItemListener in interface ButtonModel
Overrides:
addItemListener in class AbstractButton

getSelectedObjects

public java.lang.Object[] getSelectedObjects()
Specified by:
getSelectedObjects in interface ItemSelectable

removeItemListener

public void removeItemListener(ItemListener l)
Specified by:
removeItemListener in interface ButtonModel
Overrides:
removeItemListener in class AbstractButton

isArmed

public boolean isArmed()
Specified by:
isArmed in interface ButtonModel

isPressed

public boolean isPressed()
Specified by:
isPressed in interface ButtonModel

isRollover

public boolean isRollover()
Specified by:
isRollover in interface ButtonModel

setArmed

public void setArmed(boolean b)
Specified by:
setArmed in interface ButtonModel

setPressed

public void setPressed(boolean b)
Specified by:
setPressed in interface ButtonModel

setRollover

public void setRollover(boolean b)
Specified by:
setRollover in interface ButtonModel