swingwt.awt
Class Component

java.lang.Object
  extended byswingwt.awt.Component
All Implemented Interfaces:
ImageObserver, MenuContainer
Direct Known Subclasses:
AWTSwingWrapper, Canvas, Container

public class Component
extends java.lang.Object
implements ImageObserver, MenuContainer

Tag class for AWT compatibility - subclass JSWTComponent has all the good stuff.


Field Summary
protected  AccessibleContext accessibleContext
          The accessible context
protected  java.lang.String actionCommand
          Action command
protected  java.util.Vector actionListeners
          Action Listener objects
static float BOTTOM_ALIGNMENT
           
static float CENTER_ALIGNMENT
           
protected  java.util.Vector componentListeners
          Component Listener objects
protected  java.lang.String componentName
          The name of this component
protected  boolean consumeAvailableHeight
          Used with TableLayout to determine whether this component should use up extra height
protected  boolean consumeAvailableWidth
          Used with TableLayout to determine whether this component should use up extra width
protected  boolean focusable
          Whether this component can get the focus
protected  java.util.Vector focusListeners
          Focus Listener objects
protected static GraphicsConfiguration graphicsConfig
          The graphics configuration
protected  java.util.Vector inputMethodListeners
          Input Method Listeners objects
protected  boolean isUserSetFont
          Whether a calling program has set the font for this component
protected  java.util.Vector keyListeners
          Keyboard Listener objects
 java.lang.Object layoutModifier
          Used when caching objects with layouts
static float LEFT_ALIGNMENT
           
protected  java.lang.Object LOCK
          For compatibility with 3rd party layout managers - SwingWT doesn't need this as all laying out is marshalled onto a queued single thread
protected  java.util.Vector mouseListeners
          Mouse Listener objects
protected  java.util.Vector mouseMotionListeners
          Mouse Motion Listener objects
protected  java.util.Vector mouseWheelListeners
          Mouse Wheel Listener objects
protected  Container parent
          The parent container
protected  Color pBackground
          Cache value
protected  Cursor pCursor
          Cache value
protected  boolean pDoubleBuffered
          Whether paint events give direct access to component or use an image buffer and render in one go
 org.eclipse.swt.widgets.Control peer
          The SWT peer this component is representing
protected  boolean pEnabled
          Cache value
protected  Font pFont
          Cache value
protected  Color pForeground
          Cache value
protected  java.lang.Object pLayoutData
          Cache value
protected  Point pLocation
          Cache value
protected  Dimension pMaxSize
          Cache value
protected  Dimension pMinSize
          Cache value
protected  org.eclipse.swt.widgets.Composite ppeer
          If a default instance of Component is used, then we map a paintable composite canvas as AWT does
protected  Dimension pPrefSize
          Cache value
protected  Dimension pSize
          Cache value
protected  java.lang.String pToolTipText
          Cache value
protected  boolean pVisible
          Cache value
static float RIGHT_ALIGNMENT
           
protected  org.eclipse.swt.events.MouseListener swingWTDefaultActionEventAdapter
          Default adapter for Action Events
protected  swingwt.awt.Component.SWTEventAdapter swingWTEventAdapter
          All-in-one event adapter for components
static float TOP_ALIGNMENT
          Constants
 
Fields inherited from interface swingwt.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Component()
           
 
Method Summary
 void add(PopupMenu popupMenu)
           
 void addActionListener(ActionListener l)
          Add an ActionListener to this component
 void addComponentListener(ComponentListener l)
          Add an ComponentListener to this component
 void addFocusListener(FocusListener l)
          Add a KeyListener to this component
 void addInputMethodListener(InputMethodListener l)
          Add an InputMethodListener to this component
 void addKeyListener(KeyListener l)
          Add a KeyListener to this component
 void addMouseListener(MouseListener l)
          Add a MouseListener to this component
 void addMouseMotionListener(MouseMotionListener l)
          Add a MouseMotionListener to this component
 void addMouseWheelListener(MouseWheelListener l)
          Add a MouseWheelListener to this component
 void addNotify()
           
protected  Dimension calculatePreferredSize()
          Override in subclasses to return the preferred size for a given (non-realised) component.
 void componentOnlyDispose()
          Because dispose() can be overridden to do more, calling this routine guarantees that destruction of the component occurs (and nothing else).
protected  Dimension computePreferredSize()
          This is called by getPreferredSize() when we want the peer to compute it's own size.
 boolean contains(int x, int y)
           
 boolean contains(Point point)
           
 Image createImage(int width, int height)
          Creates and returns an image
protected  EventListener[] createListenerArrayFromVector(java.util.Vector listeners)
           
 VolatileImage createVolatileImage(int width, int height)
          Creates and returns a volatile image
 void dispatchEvent(AWTEvent awtEvent)
           
 void dispose()
          Destroys the component and stops all listeners
 AccessibleContext getAccessibleContext()
          Returns the component's accessible context
 java.lang.String getActionCommand()
          Returns the action command for this component
 float getAlignmentX()
          NOT IMPLEMENTED
 float getAlignmentY()
          NOT IMPLEMENTED
 Color getBackground()
          Returns the background colour of the component
 Rectangle getBounds()
          Returns the actual bounds of the component (or 0,0,0,0 if it isn't realised yet)
 ComponentOrientation getComponentOrientation()
           
 Cursor getCursor()
          Returns the components cursor
 Font getFont()
          Returns the Font used on the component
 FontMetrics getFontMetrics(Font f)
          Returns the font metrics for the given font
 Color getForeground()
          Returns the foreground colour of the component
 Graphics getGraphics()
          Return a graphics context for drawing on this object.
 GraphicsConfiguration getGraphicsConfiguration()
          Gets the GraphicsConfiguration for this component
 int getHeight()
          Returns the height of the component
 EventListener[] getListeners(java.lang.Class listenerType)
           
 Point getLocation()
          Returns the component's location on screen
 Point getLocationOnScreen()
          FIXME: Bad algorithm here, but can't find appropriate routine.
 Dimension getMaximumSize()
          Returns the maximum size of the component
 Dimension getMinimumSize()
          Returns the minimum size of the component
 java.lang.String getName()
          Returns the components name
 Container getParent()
          Returns the component's parent
 ComponentPeer getPeer()
           
 Dimension getPeerSize()
          Returns the peers actual size, or 0,0 if it hasn't been created yet/is invisible
 Dimension getPreferredSize()
          Returns the preferred size the component would like to be displayed at - very important for proper layout managers.
 Dimension getSize()
          Returns the peers actual size.
 Dimension getSize(Dimension rv)
          Overloaded version of getSize() that uses the passed in dimension to put the size in to prevent allocation of another on the heap.
 org.eclipse.swt.widgets.Control getSWTPeer()
          Returns the SWT peer
 Toolkit getToolkit()
          Gets the Toolkit for this component
 java.lang.String getToolTipText()
          Returns the tooltip text used on the component
 java.lang.Object getTreeLock()
          For compatibility with 3rd party layout managers - SwingWT doesn't need this as all laying out is marshalled onto a queued single thread
 int getWidth()
          Returns the width of the component
 int getX()
          Returns the component's X position in it's parent container
 int getY()
          Returns the component's Y position in it's parent container
 void grabFocus()
          Forces keyboard focus to the component
 boolean hasFocus()
          Returns true if this component has the focus
 boolean hasSetFont()
          Returns true if a calling process has set the font on this component.
 void hide()
          Makes the component invisible
 boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height)
          Here for compatibility - I'm not sure what it's for.
 boolean inside(int x, int y)
           
 void invalidate()
          Override in container classes to relayout child components - calls repaint here
 boolean isEnabled()
          Returns true if the component is enabled
 boolean isFocusable()
          Returns true if the component can receive the focus
 boolean isMinimumSizeSet()
           
 boolean isShowing()
          Returns true if the component is visible
 boolean isVisible()
          Returns true if the component is visible
 void paint(Graphics g)
          Override in subclasses to paint on the component
protected  void paintComponent(Graphics g)
          Not normally in Component - member of JComponent, implemented here to save a load of class casting around and to call into paint(Graphics) - this is the first point of call for repainting..
 void processActionEvent(int id)
          Sends action events to listeners
 void processComponentEvent(ComponentEvent e)
           
 void processFocusEvent(FocusEvent e)
          Sends Focus Events to component listeners
 void processInputMethodEvent(InputMethodEvent e)
          Sends Input Method Events to component listeners
 void processKeyEvent(KeyEvent e)
          Sends KeyEvents to component listeners
 void processMouseEvent(MouseEvent e)
          Sends mouse events to component listeners
 void processMouseMotionEvent(MouseEvent e)
          Sends mouse motion events to component listeners
protected  void processMouseWheelEvent(MouseWheelEvent e)
          Sends mouse wheel events to component listeners
protected  void processTraverseEvent(org.eclipse.swt.events.TraverseEvent e)
          Called when a traversal key is pressed by the user.
protected  void registerActionEvents()
           
protected  void registerComponentEvents()
           
 void registerEvents()
          When the component has been added to a container, this routine gets called to tell it to set up SWT listeners for all its events.
protected  void registerExtendedModifyEvents()
          Same as above, but for ExtendedModifyEvents
protected  void registerFocusEvents()
           
protected  void registerKeyEvents()
           
protected  void registerModifyEvents()
          Handle ModifyEvents (maps to ImputMethodEvents) by checking the final derivation of this Component.
protected  void registerMouseEvents()
           
protected  void registerPaintEvents()
           
protected  void registerTraversalEvents()
           
 void remove(MenuComponent menuComponent)
           
 void removeActionListener(ActionListener l)
          Remove an ActionListener from the component
 void removeComponentListener(ComponentListener l)
          Remove an ComponentListener from the component
 void removeFocusListener(FocusListener l)
          Remove an KeyListener from the component
 void removeInputMethodListener(InputMethodListener l)
          Remove an InputMethodListener to this component
 void removeKeyListener(KeyListener l)
          Remove an KeyListener from the component
 void removeMouseListener(MouseListener l)
          Remove an MouseListener from the component
 void removeMouseMotionListener(MouseMotionListener l)
          Remove an MouseMotionListener from the component
 void removeMouseWheelListener(MouseWheelListener l)
          Remove a MouseWheelListener to this component
 void removeNotify()
           
 void repaint()
          Redraws the component
 void repaint(int x, int y, int width, int height)
           
 void repaint(long tm, int x, int y, int width, int height)
           
 void requestFocus()
          Requests the component receives the focus
 void setActionCommand(java.lang.String command)
          Sets the action command for this component
 void setAlignmentX(float val)
          NOT IMPLEMENTED
 void setAlignmentY(float val)
          NOT IMPLEMENTED
 void setBackground(Color c)
          Sets the background colour of the component
 void setBounds(int x, int y, int width, int height)
          Sets the physical bounds of the component - used by layout managers
 void setBounds(Rectangle r)
          Sets the physical bounds of the component
 void setCachedProperties()
          If the component has just been added to a container, but properties were set in the meantime, this routine gets called by JSWTComposite to set the cached properties.
 void setComponentOrientation(ComponentOrientation o)
           
protected  void setComponentRemoved()
          When a container removes a component, it calls this method.
 void setCursor(Cursor c)
          Sets the components cursor
 void setEnabled(boolean b)
          Change the enabled state of the component
 void setFocusable(boolean b)
          Set whether the component can be focused
 void setFocusTraversalKeysEnabled(boolean b)
          FIXME: NOT IMPLEMENTED
 void setFont(Font f)
          Sets the font used by the component
 void setForeground(Color c)
          Sets the foreground colour of the component
 void setHeight(int height)
          Sets the height of the component.
 void setLocation(int x, int y)
          Sets the component's location in it's container
 void setLocation(Point p)
          Sets the component's location in it's container
 void setMaximumSize(Dimension d)
          Sets the maximum size of the component
 void setMinimumSize(Dimension d)
          Sets the minimum size of the component
 void setName(java.lang.String newName)
          Sets the components name
 void setPreferredSize(Dimension d)
          Sets the preferred size of the object for layout purposes
 void setSize(Dimension d)
          Sets the peer's actual size
 void setSize(int width, int height)
          Sets the peer's actual size
 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 setToolTipText(java.lang.String text)
          Sets the tooltip text used on the component
 void setVisible(boolean b)
          Change the visibility of the component
 void setWidth(int width)
          Sets the width of the component.
 void show()
          Makes the component visible
 void transferFocus()
          Sets the focus to the next component as if tab was pressed
 void transferFocusBackward()
          Sets the focus to the next component as if shift+tab was pressed
 void transferFocusUpCycle()
          NOT IMPLEMENTED: FIXME - focusCycleRoot not done
 void validate()
          NOT IMPLEMENTED
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

peer

public org.eclipse.swt.widgets.Control peer
The SWT peer this component is representing


ppeer

protected org.eclipse.swt.widgets.Composite ppeer
If a default instance of Component is used, then we map a paintable composite canvas as AWT does


componentName

protected java.lang.String componentName
The name of this component


graphicsConfig

protected static GraphicsConfiguration graphicsConfig
The graphics configuration


parent

protected Container parent
The parent container


layoutModifier

public java.lang.Object layoutModifier
Used when caching objects with layouts


pVisible

protected boolean pVisible
Cache value


pEnabled

protected boolean pEnabled
Cache value


pToolTipText

protected java.lang.String pToolTipText
Cache value


pBackground

protected Color pBackground
Cache value


pForeground

protected Color pForeground
Cache value


pSize

protected Dimension pSize
Cache value


pPrefSize

protected Dimension pPrefSize
Cache value


pMinSize

protected Dimension pMinSize
Cache value


pMaxSize

protected Dimension pMaxSize
Cache value


pLocation

protected Point pLocation
Cache value


pFont

protected Font pFont
Cache value


pLayoutData

protected java.lang.Object pLayoutData
Cache value


pCursor

protected Cursor pCursor
Cache value


pDoubleBuffered

protected boolean pDoubleBuffered
Whether paint events give direct access to component or use an image buffer and render in one go


actionListeners

protected java.util.Vector actionListeners
Action Listener objects


mouseListeners

protected java.util.Vector mouseListeners
Mouse Listener objects


mouseWheelListeners

protected java.util.Vector mouseWheelListeners
Mouse Wheel Listener objects


mouseMotionListeners

protected java.util.Vector mouseMotionListeners
Mouse Motion Listener objects


keyListeners

protected java.util.Vector keyListeners
Keyboard Listener objects


focusListeners

protected java.util.Vector focusListeners
Focus Listener objects


componentListeners

protected java.util.Vector componentListeners
Component Listener objects


inputMethodListeners

protected java.util.Vector inputMethodListeners
Input Method Listeners objects


consumeAvailableWidth

protected boolean consumeAvailableWidth
Used with TableLayout to determine whether this component should use up extra width


consumeAvailableHeight

protected boolean consumeAvailableHeight
Used with TableLayout to determine whether this component should use up extra height


actionCommand

protected java.lang.String actionCommand
Action command


isUserSetFont

protected boolean isUserSetFont
Whether a calling program has set the font for this component


focusable

protected boolean focusable
Whether this component can get the focus


swingWTDefaultActionEventAdapter

protected org.eclipse.swt.events.MouseListener swingWTDefaultActionEventAdapter
Default adapter for Action Events


swingWTEventAdapter

protected swingwt.awt.Component.SWTEventAdapter swingWTEventAdapter
All-in-one event adapter for components


accessibleContext

protected AccessibleContext accessibleContext
The accessible context


TOP_ALIGNMENT

public static final float TOP_ALIGNMENT
Constants

See Also:
Constant Field Values

CENTER_ALIGNMENT

public static final float CENTER_ALIGNMENT
See Also:
Constant Field Values

BOTTOM_ALIGNMENT

public static final float BOTTOM_ALIGNMENT
See Also:
Constant Field Values

LEFT_ALIGNMENT

public static final float LEFT_ALIGNMENT
See Also:
Constant Field Values

RIGHT_ALIGNMENT

public static final float RIGHT_ALIGNMENT
See Also:
Constant Field Values

LOCK

protected java.lang.Object LOCK
For compatibility with 3rd party layout managers - SwingWT doesn't need this as all laying out is marshalled onto a queued single thread

Constructor Detail

Component

public Component()
Method Detail

paint

public void paint(Graphics g)
Override in subclasses to paint on the component


paintComponent

protected void paintComponent(Graphics g)
Not normally in Component - member of JComponent, implemented here to save a load of class casting around and to call into paint(Graphics) - this is the first point of call for repainting..


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.

Throws:
java.lang.Exception

getSWTPeer

public org.eclipse.swt.widgets.Control getSWTPeer()
Returns the SWT peer


getPeer

public ComponentPeer getPeer()

add

public void add(PopupMenu popupMenu)

remove

public void remove(MenuComponent menuComponent)
Specified by:
remove in interface MenuContainer

show

public void show()
Makes the component visible


hide

public void hide()
Makes the component invisible


setVisible

public void setVisible(boolean b)
Change the visibility of the component


isVisible

public boolean isVisible()
Returns true if the component is visible


isShowing

public boolean isShowing()
Returns true if the component is visible


setEnabled

public void setEnabled(boolean b)
Change the enabled state of the component


isEnabled

public boolean isEnabled()
Returns true if the component is enabled


requestFocus

public void requestFocus()
Requests the component receives the focus


grabFocus

public void grabFocus()
Forces keyboard focus to the component


repaint

public void repaint(int x,
                    int y,
                    int width,
                    int height)

repaint

public void repaint(long tm,
                    int x,
                    int y,
                    int width,
                    int height)

repaint

public void repaint()
Redraws the component


getBackground

public Color getBackground()
Returns the background colour of the component


setBackground

public void setBackground(Color c)
Sets the background colour of the component


getForeground

public Color getForeground()
Returns the foreground colour of the component


setForeground

public void setForeground(Color c)
Sets the foreground colour of the component


getWidth

public int getWidth()
Returns the width of the component


getHeight

public int getHeight()
Returns the height of the component


setWidth

public void setWidth(int width)
Sets the width of the component.


setHeight

public void setHeight(int height)
Sets the height of the component.


getGraphics

public Graphics getGraphics()
Return a graphics context for drawing on this object. Note that only instances of JComponent are allowed


getPreferredSize

public Dimension getPreferredSize()
Returns the preferred size the component would like to be displayed at - very important for proper layout managers.


computePreferredSize

protected Dimension computePreferredSize()
This is called by getPreferredSize() when we want the peer to compute it's own size. This base method delegates to the peer, but some components may want to override this value hence the reason we have a separate method here. NOTE THAT THIS ROUTINE IS DIFFERENT FROM calculatePreferredSize() - this routine is called by getPreferredSize() when none has been set by the user and allows the peer to compute it's size, calculatePreferredSize() is used when no peer has been created and we need to guess an appropriate size.


setPreferredSize

public void setPreferredSize(Dimension d)
Sets the preferred size of the object for layout purposes


calculatePreferredSize

protected Dimension calculatePreferredSize()
Override in subclasses to return the preferred size for a given (non-realised) component. Note that you should use setSize() to whatever this routine returns once called to prevent inconsistency with null layout managers. Also note that this is different from the computePreferredSize() method, which is used for calculating the preferredSize of a realised component (this one is for unrealised components)


getMaximumSize

public Dimension getMaximumSize()
Returns the maximum size of the component


setMaximumSize

public void setMaximumSize(Dimension d)
Sets the maximum size of the component


getMinimumSize

public Dimension getMinimumSize()
Returns the minimum size of the component


setMinimumSize

public void setMinimumSize(Dimension d)
Sets the minimum size of the component


isMinimumSizeSet

public boolean isMinimumSizeSet()

setSize

public void setSize(int width,
                    int height)
Sets the peer's actual size


setSize

public void setSize(Dimension d)
Sets the peer's actual size


contains

public boolean contains(int x,
                        int y)

contains

public boolean contains(Point point)

inside

public boolean inside(int x,
                      int y)

getSize

public Dimension getSize()
Returns the peers actual size. Or, if the peer is embedded inside a ScrollPane component, the larger of the preferredSize/peers actual size. This works rather nicely for handling layouts inside a scrollbar as we can simply offset a large composite according to the scrollbar positions inside JScrollPane. One note - if the component is JTree, JTable, JTextArea or JEditorPane, then we return the size as usual since these components handle their own scrolling and we don't want the JScrollPane behaving weirdly.


getSize

public Dimension getSize(Dimension rv)
Overloaded version of getSize() that uses the passed in dimension to put the size in to prevent allocation of another on the heap. NB: Still creates a new dimension due to how SwingWT works so there is no benefit to using this method.


getPeerSize

public Dimension getPeerSize()
Returns the peers actual size, or 0,0 if it hasn't been created yet/is invisible


setFocusTraversalKeysEnabled

public void setFocusTraversalKeysEnabled(boolean b)
FIXME: NOT IMPLEMENTED


getLocation

public Point getLocation()
Returns the component's location on screen


getLocationOnScreen

public Point getLocationOnScreen()
FIXME: Bad algorithm here, but can't find appropriate routine. Display.map() looks interesting, but it is undocumented.


createImage

public Image createImage(int width,
                         int height)
Creates and returns an image


createVolatileImage

public VolatileImage createVolatileImage(int width,
                                         int height)
Creates and returns a volatile image


getFontMetrics

public FontMetrics getFontMetrics(Font f)
Returns the font metrics for the given font


getFont

public Font getFont()
Returns the Font used on the component

Specified by:
getFont in interface MenuContainer

setFont

public void setFont(Font f)
Sets the font used by the component


hasSetFont

public boolean hasSetFont()
Returns true if a calling process has set the font on this component. So other parts of SwingWT know when to override the standard font as part of your system theme.


getToolTipText

public java.lang.String getToolTipText()
Returns the tooltip text used on the component


setToolTipText

public void setToolTipText(java.lang.String text)
Sets the tooltip text used on the component


setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Sets the physical bounds of the component - used by layout managers


setBounds

public void setBounds(Rectangle r)
Sets the physical bounds of the component


getBounds

public Rectangle getBounds()
Returns the actual bounds of the component (or 0,0,0,0 if it isn't realised yet)


getAlignmentX

public float getAlignmentX()
NOT IMPLEMENTED


getAlignmentY

public float getAlignmentY()
NOT IMPLEMENTED


setAlignmentX

public void setAlignmentX(float val)
NOT IMPLEMENTED


setAlignmentY

public void setAlignmentY(float val)
NOT IMPLEMENTED


transferFocus

public void transferFocus()
Sets the focus to the next component as if tab was pressed


transferFocusBackward

public void transferFocusBackward()
Sets the focus to the next component as if shift+tab was pressed


transferFocusUpCycle

public void transferFocusUpCycle()
NOT IMPLEMENTED: FIXME - focusCycleRoot not done


invalidate

public void invalidate()
Override in container classes to relayout child components - calls repaint here


validate

public void validate()
NOT IMPLEMENTED


getActionCommand

public java.lang.String getActionCommand()
Returns the action command for this component


setActionCommand

public void setActionCommand(java.lang.String command)
Sets the action command for this component


setLocation

public void setLocation(Point p)
Sets the component's location in it's container


setLocation

public void setLocation(int x,
                        int y)
Sets the component's location in it's container


getX

public int getX()
Returns the component's X position in it's parent container


getY

public int getY()
Returns the component's Y position in it's parent container


getParent

public Container getParent()
Returns the component's parent


getName

public java.lang.String getName()
Returns the components name


setName

public void setName(java.lang.String newName)
Sets the components name


setCursor

public void setCursor(Cursor c)
Sets the components cursor


isFocusable

public boolean isFocusable()
Returns true if the component can receive the focus


setFocusable

public void setFocusable(boolean b)
Set whether the component can be focused


getCursor

public Cursor getCursor()
Returns the components cursor


getToolkit

public Toolkit getToolkit()
Gets the Toolkit for this component


getGraphicsConfiguration

public GraphicsConfiguration getGraphicsConfiguration()
Gets the GraphicsConfiguration for this component


getComponentOrientation

public ComponentOrientation getComponentOrientation()

setComponentOrientation

public void setComponentOrientation(ComponentOrientation o)

dispose

public void dispose()
Destroys the component and stops all listeners


componentOnlyDispose

public void componentOnlyDispose()
Because dispose() can be overridden to do more, calling this routine guarantees that destruction of the component occurs (and nothing else).


addActionListener

public void addActionListener(ActionListener l)
Add an ActionListener to this component


removeActionListener

public void removeActionListener(ActionListener l)
Remove an ActionListener from the component


addComponentListener

public void addComponentListener(ComponentListener l)
Add an ComponentListener to this component


removeComponentListener

public void removeComponentListener(ComponentListener l)
Remove an ComponentListener from the component


addMouseListener

public void addMouseListener(MouseListener l)
Add a MouseListener to this component


removeMouseListener

public void removeMouseListener(MouseListener l)
Remove an MouseListener from the component


addMouseWheelListener

public void addMouseWheelListener(MouseWheelListener l)
Add a MouseWheelListener to this component


removeMouseWheelListener

public void removeMouseWheelListener(MouseWheelListener l)
Remove a MouseWheelListener to this component


addMouseMotionListener

public void addMouseMotionListener(MouseMotionListener l)
Add a MouseMotionListener to this component


removeMouseMotionListener

public void removeMouseMotionListener(MouseMotionListener l)
Remove an MouseMotionListener from the component


addKeyListener

public void addKeyListener(KeyListener l)
Add a KeyListener to this component


removeKeyListener

public void removeKeyListener(KeyListener l)
Remove an KeyListener from the component


addFocusListener

public void addFocusListener(FocusListener l)
Add a KeyListener to this component


removeFocusListener

public void removeFocusListener(FocusListener l)
Remove an KeyListener from the component


addInputMethodListener

public void addInputMethodListener(InputMethodListener l)
Add an InputMethodListener to this component


removeInputMethodListener

public void removeInputMethodListener(InputMethodListener l)
Remove an InputMethodListener to this component


dispatchEvent

public void dispatchEvent(AWTEvent awtEvent)

addNotify

public void addNotify()

removeNotify

public void removeNotify()

getListeners

public EventListener[] getListeners(java.lang.Class listenerType)

createListenerArrayFromVector

protected EventListener[] createListenerArrayFromVector(java.util.Vector listeners)

processActionEvent

public void processActionEvent(int id)
Sends action events to listeners


processComponentEvent

public void processComponentEvent(ComponentEvent e)

processMouseEvent

public void processMouseEvent(MouseEvent e)
Sends mouse events to component listeners


processMouseMotionEvent

public void processMouseMotionEvent(MouseEvent e)
Sends mouse motion events to component listeners


processMouseWheelEvent

protected void processMouseWheelEvent(MouseWheelEvent e)
Sends mouse wheel events to component listeners


processKeyEvent

public void processKeyEvent(KeyEvent e)
Sends KeyEvents to component listeners


processFocusEvent

public void processFocusEvent(FocusEvent e)
Sends Focus Events to component listeners


processInputMethodEvent

public void processInputMethodEvent(InputMethodEvent e)
Sends Input Method Events to component listeners


setCachedProperties

public void setCachedProperties()
If the component has just been added to a container, but properties were set in the meantime, this routine gets called by JSWTComposite to set the cached properties.


registerEvents

public void registerEvents()
When the component has been added to a container, this routine gets called to tell it to set up SWT listeners for all its events. We can map these then to the AWT-style events


registerPaintEvents

protected void registerPaintEvents()

registerTraversalEvents

protected void registerTraversalEvents()

registerFocusEvents

protected void registerFocusEvents()

registerComponentEvents

protected void registerComponentEvents()

registerMouseEvents

protected void registerMouseEvents()

registerKeyEvents

protected void registerKeyEvents()

registerActionEvents

protected void registerActionEvents()

registerModifyEvents

protected void registerModifyEvents()
Handle ModifyEvents (maps to ImputMethodEvents) by checking the final derivation of this Component. Unusual way to do it, but since InputMethodEvents are handled in the base Component, unlike SWT, it's the most effective way to maintain backwards compatibility. This method is being used for speed - the alternatives are to use peer.getClass().getMethod(...) or peer.getClass().getMethods() and search for required methods. getMethod() has the problem of throwing an exception, which will eat up resources given how often this code will be called. getMethods(), likewise, will usually return a very large list, taking a long time to traverse. This means if SWT is updated to have new components return ModifyEvents, it will need to be added here.


registerExtendedModifyEvents

protected void registerExtendedModifyEvents()
Same as above, but for ExtendedModifyEvents


processTraverseEvent

protected void processTraverseEvent(org.eclipse.swt.events.TraverseEvent e)
Called when a traversal key is pressed by the user. This routine determines whether we should use the custom focus manager if one is avaliable, or just let it go.


setComponentRemoved

protected void setComponentRemoved()
When a container removes a component, it calls this method. You can override this in your subclass to perform any specific action you need to take when that component is removed.


imageUpdate

public boolean imageUpdate(Image img,
                           int infoflags,
                           int x,
                           int y,
                           int width,
                           int height)
Here for compatibility - I'm not sure what it's for. Doesn't do anything anyway. :-)

Specified by:
imageUpdate in interface ImageObserver

hasFocus

public boolean hasFocus()
Returns true if this component has the focus


getTreeLock

public java.lang.Object getTreeLock()
For compatibility with 3rd party layout managers - SwingWT doesn't need this as all laying out is marshalled onto a queued single thread


getAccessibleContext

public AccessibleContext getAccessibleContext()
Returns the component's accessible context