Class powersoft.jcm.ui.Component
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class powersoft.jcm.ui.Component

java.lang.Object
   |
   +----powersoft.jcm.ui.Component

public class Component
extends Object
implements AWTEventTarget
The superclass for GUI components. All GUI components derive from this component.

Notes: This component is defined as an abstract class. You cannot instantiate a component, only one of its subclasses, for example, a TextBox component.

See Also:
AWTComponent, Container

Variable Index

 o _AWTComponent
 o _createVector
 o _destroyAWTComponent
 o _destroyVector
 o _font
 o _generalVector
 o _mouseMoveVector
 o _resizePercentages
 o _text

Constructor Index

 o Component()
Components are not instantiated directly.

Method Index

 o addCreateListener(CreateListener)
 o addDestroyListener(DestroyListener)
 o addGeneralListener(GeneralListener)
 o addMouseMoveListener(MouseMoveListener)
 o attachToComponent(Component, Container, boolean, boolean)
Attaches to an existing AWT component.
 o checkCreated()
Throws a NotCreatedException if the component has not been created.
 o create()
Creates a new component.
 o create(Container)
Creates a new component.
 o create(Container, int, int, int, int)
Creates the component.
 o create(Container, int, int, int, int, boolean)
Creates the component, optionally interpreting the given location and size parameters as dialog units.
 o create(Container, Rectangle)
Creates the component.
 o create(Rectangle)
Creates the component.
 o createAWTComponent(Component)
Creates the AWT component.
 o destroy()
Destroys the component.
 o destroy(boolean)
Destroys the component.
 o detachFromComponent(boolean)
Detaches from the AWT component.
 o DUHeight(int)
Converts dialog units into vertical pixels, using the current font settings for the component.

The origin in dialog units is the top left corner of the inset rectangle, so (0,0) in DUs does not necessarily correspond to (0,0) in pixels.

 o DURectangle(int, int, int, int)
Converts dialog units into pixels, using the current font settings for the component.
 o DURectangle(Rectangle)
Converts dialog units into pixels, using the current font settings for the component.
 o DUWidth(int)
Converts dialog units into horizontal pixels, using the current font settings for the component.

The origin in dialog units is the top left corner of the inset rectangle, so (0,0) in DUs does not necessarily correspond to (0,0) in pixels.

 o findComponent(Component, boolean)
 o findMenuComponent(MenuComponent, boolean)
 o getAWTComponent()
Retrieves the %%%product component's underlying AWT component.
 o getBackColor()
Gets the component's background color.
 o getColorModel()
Retrieves the ColorModel used to display the component on an output device.
 o getContains(int, int)
Determines whether the specified point is within the component area.
 o getCreateListeners()
 o getDestroyListeners()
 o getEnabled()
Gets the enabled state of the component.
 o getFocus()
 o getFont()
Gets the font used by the component for drawing text.
 o getFont(boolean)
Gets the font used by the component.
 o getFontMetrics()
 o getForeColor()
 o getGeneralListeners()
 o getHeight()
Gets the height of the component.
 o getLayoutName()
Gets the layout name of the component.
 o getLeft()
Gets the left origin of the component.
 o getMouseMoveListeners()
 o getName()
Gets the name of the component.
 o getParent()
Gets the parent of the component.
 o getRectangle()
Gets the bounding rectangle for the object in client coordinates of the parent window (if no parent window, absolute coordinates).
 o getRectangle(boolean)
Gets the bounding rectangle for the object in absolute coordinates or client coordinates of the parent window.
 o getResizePercentages()
 o getShowing()
Gets the show state of the component.
 o getText()
Gets the text of the component.
 o getTop()
Gets the top origin of the component.
 o getUserData()
 o getVisible()
Gets the visibility of a component.
 o getWidth()
Gets the width of the component.
 o getZOrder()
 o handleAWTEvent(Event)
 o handleCreate(CreateEvent)
 o handleDestroy(DestroyEvent)
 o handleGeneral(GeneralEvent)
 o handleMouseMove(MouseMoveEvent)
 o invalidate()
 o locateComponent(int, int)
Locates the component or child component which contains the given point.
 o makeComponent(Container, int, int, int, int, boolean)
Create the component.
 o move(int, int)
 o move(Rectangle)
 o paramString()
Returns information about the component which is used by the toString method.
 o processAWTEvent(Event)
 o removeCreateListener(CreateListener)
 o removeDestroyListener(DestroyListener)
 o removeGeneralListener(GeneralListener)
 o removeMouseMoveListener(MouseMoveListener)
 o repaint()
 o repaint(int, int, int, int)
 o resize(Dimension)
 o setBackColor(Color)
Sets the component's background color.
 o setEnabled(boolean)
Sets the enabled state of the component.
 o setFocus(boolean)
 o setFont(Font)
Sets the font used by the component for drawing text.
 o setForeColor(Color)
 o setHeight(int)
Sets the height of the component.
 o setLayoutName(String)
Sets the layout name of the component.
 o setLeft(int)
Sets the left origin of the component.
 o setName(String)
Sets the name of the component.
 o setParent(Container)
Sets the parent of the component.
 o setRectangle(Rectangle)
Sets the bounding rectangle for the object in client coordinates of the parent window.
 o setResizePercentages(Rectangle)
 o setText(String)
Sets the text of the component.
 o setTop(int)
Sets the top origin of the component.
 o setUserData(Object)
 o setVisible(boolean)
Sets the visibility of a component.
 o setWidth(int)
Sets the width of the component.
 o setZOrder(int)
 o toString()
 o validate()

Variables

 o _AWTComponent
  protected Component _AWTComponent
 o _destroyAWTComponent
  protected boolean _destroyAWTComponent
 o _text
  protected String _text
 o _font
  protected Font _font
 o _resizePercentages
  protected Rectangle _resizePercentages
 o _createVector
  protected EventListenerVector _createVector
 o _destroyVector
  protected EventListenerVector _destroyVector
 o _mouseMoveVector
  protected EventListenerVector _mouseMoveVector
 o _generalVector
  protected EventListenerVector _generalVector

Constructors

 o Component
  public Component()
Components are not instantiated directly.

Methods

 o getAWTComponent
  public Component getAWTComponent()
Retrieves the %%%product component's underlying AWT component.
See Also:
attachToComponent, detachFromComponent, findComponent
 o getBackColor
  public Color getBackColor()
Gets the component's background color.

Notes: If the component's BackColor property is not set, the getBackColor method returns the BackColor property of the component's parent.

See Also:
setBackColor, getForeColor, Color
 o setBackColor
  public void setBackColor(Color color)
Sets the component's background color.
Parameters:
color - Specifies the component's background color.
See Also:
getBackColor, setForeColor, Color
 o getColorModel
  public ColorModel getColorModel()
Retrieves the ColorModel used to display the component on an output device. The ColorModel is an abstract class that encapsulates the conversion between pixel values the corresponding red, green, blue, and alpha (transparency) components.
Returns:
The color model for the underlying AWT component.
See Also:
ColorModel
 o getContains
  public boolean getContains(int x,
                             int y)
Determines whether the specified point is within the component area.

Notes: The coordinates are relative to the coordinate system of the component -- (0,0) is the upper left corner.

Returns:
True if the point is within the component area, false otherwise.
See Also:
getRectangle
 o getEnabled
  public boolean getEnabled()
Gets the enabled state of the component. A disabled component does not respond to user input.
See Also:
setEnabled
 o setEnabled
  public void setEnabled(boolean enabled)
Sets the enabled state of the component.
Parameters:
enabled - If true the component is enabled. If false the component is disabled.
See Also:
getEnabled
 o getFocus
  public boolean getFocus()
 o setFocus
  public void setFocus(boolean focus)
 o getFont
  public Font getFont()
Gets the font used by the component for drawing text. If no font was set, searches up the parent tree until one is found. If none was found, returns null.
See Also:
setFont
 o getFont
  public Font getFont(boolean searchParents)
Gets the font used by the component.
Parameters:
searchParents - If true, searches up the parent tree until a font is found, or returns null. If false, returns the font setting for the component, which might be null.
See Also:
setFont
 o setFont
  public void setFont(Font font)
Sets the font used by the component for drawing text.
Parameters:
font - Specifies the font to be used for drawing text.
See Also:
getFont, DURectangle
 o getFontMetrics
  public FontMetrics getFontMetrics()
 o getForeColor
  public Color getForeColor()
 o setForeColor
  public void setForeColor(Color color)
 o getHeight
  public int getHeight()
Gets the height of the component.
See Also:
setHeight, getRectangle
 o setHeight
  public void setHeight(int h)
Sets the height of the component.
Parameters:
h - Specifies the height of the component in pixels.
See Also:
getHeight, setRectangle
 o getLayoutName
  public String getLayoutName()
Gets the layout name of the component. The layout name is used by the layout manager.
See Also:
setLayoutName, LayoutManager
 o setLayoutName
  public void setLayoutName(String name)
Sets the layout name of the component. The layout name is used by the layout manager.
Parameters:
name - Specifies the layout name of the component.
See Also:
getLayoutName, LayoutManager
 o getLeft
  public int getLeft()
Gets the left origin of the component.
See Also:
setLeft, getRectangle
 o setLeft
  public void setLeft(int l)
Sets the left origin of the component.
Parameters:
l - The left coordinate of the component.
See Also:
getLeft, setRectangle
 o getName
  public String getName()
Gets the name of the component.
See Also:
setName
 o setName
  public void setName(String name)
Sets the name of the component.
See Also:
getName
 o getParent
  public synchronized Container getParent()
Gets the parent of the component.
 o setParent
  public synchronized void setParent(Container parent)
Sets the parent of the component. Automatically calls the parent's addComponent method, first removing it from its old parent if necessary.
Parameters:
parent - The new parent container of the component.
 o getRectangle
  public Rectangle getRectangle()
Gets the bounding rectangle for the object in client coordinates of the parent window (if no parent window, absolute coordinates).
See Also:
setRectangle
 o getRectangle
  public Rectangle getRectangle(boolean asAbsolute)
Gets the bounding rectangle for the object in absolute coordinates or client coordinates of the parent window.
Parameters:
asAbsolute - If true, returns absolute coordinates.
See Also:
setRectangle
 o setRectangle
  public void setRectangle(Rectangle rect)
Sets the bounding rectangle for the object in client coordinates of the parent window.
Parameters:
rect - The new bounding rectangle.
See Also:
getRectangle
 o getResizePercentages
  public Rectangle getResizePercentages()
 o setResizePercentages
  public void setResizePercentages(Rectangle percentages)
 o getShowing
  public boolean getShowing()
Gets the show state of the component. A component is showing if it is visible and its parent is showing.
See Also:
getVisible
 o getText
  public String getText()
Gets the text of the component.
See Also:
setText
 o setText
  public void setText(String text)
Sets the text of the component.
See Also:
getText
 o getTop
  public int getTop()
Gets the top origin of the component.
See Also:
setTop, getRectangle
 o setTop
  public void setTop(int t)
Sets the top origin of the component.
See Also:
getTop, setRectangle
 o getUserData
  public Object getUserData()
 o setUserData
  public void setUserData(Object userData)
 o getVisible
  public boolean getVisible()
Gets the visibility of a component. A visible component does not paint itself unless it is also showing (all its parents are also visible).
See Also:
getShowing, setVisible
 o setVisible
  public void setVisible(boolean visible)
Sets the visibility of a component.
See Also:
getVisible
 o getWidth
  public int getWidth()
Gets the width of the component.
See Also:
setWidth, getRectangle
 o setWidth
  public void setWidth(int w)
Sets the width of the component.
See Also:
getWidth, setRectangle
 o getZOrder
  public int getZOrder()
 o setZOrder
  public void setZOrder(int zorder)
 o addCreateListener
  public synchronized void addCreateListener(CreateListener l)
 o getCreateListeners
  public synchronized EventListenerVector getCreateListeners()
 o handleCreate
  public synchronized void handleCreate(CreateEvent data)
 o removeCreateListener
  public synchronized void removeCreateListener(CreateListener l)
 o addDestroyListener
  public synchronized void addDestroyListener(DestroyListener l)
 o getDestroyListeners
  public synchronized EventListenerVector getDestroyListeners()
 o handleDestroy
  public synchronized void handleDestroy(DestroyEvent data)
 o removeDestroyListener
  public synchronized void removeDestroyListener(DestroyListener l)
 o addMouseMoveListener
  public synchronized void addMouseMoveListener(MouseMoveListener l)
 o getMouseMoveListeners
  public synchronized EventListenerVector getMouseMoveListeners()
 o handleMouseMove
  public synchronized void handleMouseMove(MouseMoveEvent data)
 o removeMouseMoveListener
  public synchronized void removeMouseMoveListener(MouseMoveListener l)
 o addGeneralListener
  public synchronized void addGeneralListener(GeneralListener l)
 o getGeneralListeners
  public synchronized EventListenerVector getGeneralListeners()
 o handleGeneral
  public synchronized void handleGeneral(GeneralEvent data)
 o removeGeneralListener
  public synchronized void removeGeneralListener(GeneralListener l)
 o attachToComponent
  public boolean attachToComponent(Component awtComponent,
                                   Container parent,
                                   boolean destroy,
                                   boolean callCreate)
Attaches to an existing AWT component. If the Create event is triggered, it is called as the last step.
Parameters:
awtComponent - The AWT component of interest.
parent - Specifies the component's parent container. If this isn't null, setParent is invoked for the component.
destroy - If true, the AWT component will be destroyed when this component is destroyed. If false, the AWT component is not destroyed.
callCreate - If true, the Create event occurs and the corresponding chain of event handlers is invoked. If false, the Create event does not occur.
Returns:
true
See Also:
create, detachFromComponent
 o create
  public boolean create()
Creates a new component.
Returns:
true if the component was successfully created; false otherwise
See Also:
destroy, attachToComponent, detachFromComponent
 o create
  public boolean create(Container parent)
Creates a new component.
Parameters:
parent - Specifies the parent or owner of the component to be created. It may be null.
Returns:
true if the component was successfully created; false otherwise
See Also:
destroy, attachToComponent, detachFromComponent
 o create
  public boolean create(Container parent,
                        Rectangle bounds)
Creates the component.
Parameters:
parent - Specifies the parent or owner of the component to be created. It may be null.
bounds - Specifies the component's bounding rectangle which consists of the upper left corner of the rectangle and its width and height.
Returns:
true if the component was successfully created; false otherwise
See Also:
destroy, attachToComponent, detachFromComponent
 o create
  public boolean create(Rectangle bounds)
Creates the component.
Parameters:
bounds - Specifies the component's bounding rectangle which consists of the upper left corner of the rectangle and its width and height.
Returns:
true if the component was successfully created; false otherwise
See Also:
destroy, attachToComponent, detachFromComponent
 o create
  public boolean create(Container parent,
                        int x,
                        int y,
                        int w,
                        int h)
Creates the component.
Parameters:
parent - Specifies the parent or owner of the component to be created. It may be null.
x - The x-coordinate of the upper left corner of the component's bounding rectangle. This is in screen coordinates if the component has no parent or client area coordinates if the component has a parent.
y - The y-coordinate of the upper left corner of the component's bounding rectangle. This is in screen coordinates if the component has no parent or client area coordinates if the component has a parent.
w - The width of the component's bounding rectangle, in pixels.
h - The height of the component's bounding rectangle, in pixels.
Returns:
true if the component was successfully created; false otherwise
See Also:
destroy, attachToComponent, detachFromComponent
 o create
  public boolean create(Container parent,
                        int x,
                        int y,
                        int w,
                        int h,
                        boolean inDialogUnits)
Creates the component, optionally interpreting the given location and size parameters as dialog units.
Parameters:
parent - Specifies the parent or owner of the component to be created. It may be null.
x - The x-coordinate of the upper left corner of the component's bounding rectangle. This is in screen coordinates (pixels or dialog units) if the component has no parent or client area coordinates if the component has a parent.
y - The y-coordinate of the upper left corner of the component's bounding rectangle. This is in screen coordinates (pixels or dialog units) if the component has no parent or client area coordinates if the component has a parent.
w - The width of the component's bounding rectangle, in pixels or dialog units.
h - The height of the component's bounding rectangle, in pixels or dialog units.
inDialogUnits - When true, the x, y, w, and h parameters are interpreted as dialog units, otherwise they are interpreted as pixels.
Returns:
true if the component was successfully created; false otherwise
See Also:
destroy, attachToComponent, detachFromComponent
 o destroy
  public synchronized boolean destroy()
Destroys the component.
Returns:
true if the component was successfully destroyed; false otherwise
See Also:
create, detachFromComponent
 o destroy
  public synchronized boolean destroy(boolean callEvent)
Destroys the component.
Returns:
true if the component was successfully destroyed; false otherwise
 o detachFromComponent
  public Component detachFromComponent(boolean callDestroy)
Detaches from the AWT component. Does not dispose of the component -- destroy should be called instead. If the Destroy event is triggered, it is called before the detachment actually occurs.
Parameters:
callDestroy - If true, calls the Destroy event.
Returns:
The detached AWT component.
See Also:
attachToComponent, destroy
 o DUHeight
  public int DUHeight(int verticalDU)
Converts dialog units into vertical pixels, using the current font settings for the component.

The origin in dialog units is the top left corner of the inset rectangle, so (0,0) in DUs does not necessarily correspond to (0,0) in pixels.

Parameters:
verticalDU - specifies the height to be converted, in dialog units
Returns:
The height in pixels.
See Also:
DUWidth, DialogSize
 o DUWidth
  public int DUWidth(int horizDU)
Converts dialog units into horizontal pixels, using the current font settings for the component.

The origin in dialog units is the top left corner of the inset rectangle, so (0,0) in DUs does not necessarily correspond to (0,0) in pixels.

Parameters:
horizDU - specifies the width to be converted, in dialog units
Returns:
The width in pixels.
See Also:
DUHeight, DialogSize
 o DURectangle
  public Rectangle DURectangle(Rectangle r)
Converts dialog units into pixels, using the current font settings for the component.
See Also:
DUHeight, DUWidth, setFont
 o DURectangle
  public Rectangle DURectangle(int x,
                               int y,
                               int w,
                               int h)
Converts dialog units into pixels, using the current font settings for the component.
See Also:
DUHeight, DUWidth, setFont
 o findComponent
  public Component findComponent(Component awtComp,
                                 boolean recurse)
 o findMenuComponent
  public MenuComponent findMenuComponent(MenuComponent awtComp,
                                         boolean recurse)
 o invalidate
  public void invalidate()
 o locateComponent
  public Component locateComponent(int x,
                                   int y)
Locates the component or child component which contains the given point.
Returns:
The component containing the given point or null if no component is found to contain the given point.
 o move
  public void move(int x,
                   int y)
 o move
  public void move(Rectangle rect)
 o repaint
  public void repaint()
 o repaint
  public void repaint(int x,
                      int y,
                      int width,
                      int height)
 o resize
  public void resize(Dimension dim)
 o validate
  public void validate()
 o toString
  public String toString()
Overrides:
toString in class Object
 o paramString
  protected String paramString()
Returns information about the component which is used by the toString method. Subclasses should override this method as appropriate.
 o handleAWTEvent
  public boolean handleAWTEvent(Event event)
 o makeComponent
  protected synchronized boolean makeComponent(Container parent,
                                               int x,
                                               int y,
                                               int width,
                                               int height,
                                               boolean callEvent)
Create the component. This method is called by the create methods to actually do the work.

The default behaviour is to call createAWTComponent to get the AWT component, then call attachToComponent, setParent and then trigger the Create event. For AWT containers, addNotify is also called. In general component writers need only to override createAWTComponent and not this method.

Parameters:
parent - The parent or owner of the component. May be null.
x - The initial left position of the component.
y - The initial top position of the component.
w - The initial width of the component.
h - The initial height of the component.
Returns:
Success or failure.
See Also:
create, createAWTComponent, attachToComponent, setParent
 o createAWTComponent
  protected Component createAWTComponent(Component parent)
Creates the AWT component. This method is called by makeComponent to actually create the underlying AWT component.
Parameters:
parent - The parent of the AWT component, not to be confused with the parent of the JCM component (in other words, you must still call setParent).
Returns:
The new component, or null if error occurs.
See Also:
makeComponent
 o checkCreated
  protected void checkCreated()
Throws a NotCreatedException if the component has not been created. This method should not be called directly.
 o processAWTEvent
  protected boolean processAWTEvent(Event event)

All Packages  Class Hierarchy  This Package  Previous  Next  Index