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
-
_AWTComponent
-
-
_createVector
-
-
_destroyAWTComponent
-
-
_destroyVector
-
-
_font
-
-
_generalVector
-
-
_mouseMoveVector
-
-
_resizePercentages
-
-
_text
-
-
Component()
- Components are not instantiated directly.
-
addCreateListener(CreateListener)
-
-
addDestroyListener(DestroyListener)
-
-
addGeneralListener(GeneralListener)
-
-
addMouseMoveListener(MouseMoveListener)
-
-
attachToComponent(Component, Container, boolean, boolean)
- Attaches to an existing AWT component.
-
checkCreated()
- Throws a NotCreatedException if the component has not been created.
-
create()
- Creates a new component.
-
create(Container)
- Creates a new component.
-
create(Container, int, int, int, int)
- Creates the component.
-
create(Container, int, int, int, int, boolean)
- Creates the component, optionally interpreting the given location
and size parameters as dialog units.
-
create(Container, Rectangle)
- Creates the component.
-
create(Rectangle)
- Creates the component.
-
createAWTComponent(Component)
- Creates the AWT component.
-
destroy()
- Destroys the component.
-
destroy(boolean)
- Destroys the component.
-
detachFromComponent(boolean)
- Detaches from the AWT component.
-
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.
-
DURectangle(int, int, int, int)
- Converts dialog units into pixels, using the current font
settings for the component.
-
DURectangle(Rectangle)
- Converts dialog units into pixels, using the current font
settings for the component.
-
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.
-
findComponent(Component, boolean)
-
-
findMenuComponent(MenuComponent, boolean)
-
-
getAWTComponent()
- Retrieves the %%%product component's underlying AWT component.
-
getBackColor()
- Gets the component's background color.
-
getColorModel()
- Retrieves the ColorModel used to display the component on an
output device.
-
getContains(int, int)
- Determines whether the specified point is within the component area.
-
getCreateListeners()
-
-
getDestroyListeners()
-
-
getEnabled()
- Gets the enabled state of the component.
-
getFocus()
-
-
getFont()
- Gets the font used by the component for drawing text.
-
getFont(boolean)
- Gets the font used by the component.
-
getFontMetrics()
-
-
getForeColor()
-
-
getGeneralListeners()
-
-
getHeight()
- Gets the height of the component.
-
getLayoutName()
- Gets the layout name of the component.
-
getLeft()
- Gets the left origin of the component.
-
getMouseMoveListeners()
-
-
getName()
- Gets the name of the component.
-
getParent()
- Gets the parent of the component.
-
getRectangle()
- Gets the bounding rectangle for the object in client coordinates
of the parent window (if no parent window, absolute coordinates).
-
getRectangle(boolean)
- Gets the bounding rectangle for the object in absolute coordinates
or client coordinates of the parent window.
-
getResizePercentages()
-
-
getShowing()
- Gets the show state of the component.
-
getText()
- Gets the text of the component.
-
getTop()
- Gets the top origin of the component.
-
getUserData()
-
-
getVisible()
- Gets the visibility of a component.
-
getWidth()
- Gets the width of the component.
-
getZOrder()
-
-
handleAWTEvent(Event)
-
-
handleCreate(CreateEvent)
-
-
handleDestroy(DestroyEvent)
-
-
handleGeneral(GeneralEvent)
-
-
handleMouseMove(MouseMoveEvent)
-
-
invalidate()
-
-
locateComponent(int, int)
- Locates the component or child component which contains the given point.
-
makeComponent(Container, int, int, int, int, boolean)
- Create the component.
-
move(int, int)
-
-
move(Rectangle)
-
-
paramString()
- Returns information about the component which is used by the toString
method.
-
processAWTEvent(Event)
-
-
removeCreateListener(CreateListener)
-
-
removeDestroyListener(DestroyListener)
-
-
removeGeneralListener(GeneralListener)
-
-
removeMouseMoveListener(MouseMoveListener)
-
-
repaint()
-
-
repaint(int, int, int, int)
-
-
resize(Dimension)
-
-
setBackColor(Color)
- Sets the component's background color.
-
setEnabled(boolean)
- Sets the enabled state of the component.
-
setFocus(boolean)
-
-
setFont(Font)
- Sets the font used by the component for drawing text.
-
setForeColor(Color)
-
-
setHeight(int)
- Sets the height of the component.
-
setLayoutName(String)
- Sets the layout name of the component.
-
setLeft(int)
- Sets the left origin of the component.
-
setName(String)
- Sets the name of the component.
-
setParent(Container)
- Sets the parent of the component.
-
setRectangle(Rectangle)
- Sets the bounding rectangle for the object in client coordinates
of the parent window.
-
setResizePercentages(Rectangle)
-
-
setText(String)
- Sets the text of the component.
-
setTop(int)
- Sets the top origin of the component.
-
setUserData(Object)
-
-
setVisible(boolean)
- Sets the visibility of a component.
-
setWidth(int)
- Sets the width of the component.
-
setZOrder(int)
-
-
toString()
-
-
validate()
-
_AWTComponent
protected Component _AWTComponent
_destroyAWTComponent
protected boolean _destroyAWTComponent
_text
protected String _text
_font
protected Font _font
_resizePercentages
protected Rectangle _resizePercentages
_createVector
protected EventListenerVector _createVector
_destroyVector
protected EventListenerVector _destroyVector
_mouseMoveVector
protected EventListenerVector _mouseMoveVector
_generalVector
protected EventListenerVector _generalVector
Component
public Component()
- Components are not instantiated directly.
getAWTComponent
public Component getAWTComponent()
- Retrieves the %%%product component's underlying AWT component.
- See Also:
- attachToComponent, detachFromComponent, findComponent
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
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
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
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
getEnabled
public boolean getEnabled()
- Gets the enabled state of the component. A disabled component
does not respond to user input.
- See Also:
- setEnabled
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
getFocus
public boolean getFocus()
setFocus
public void setFocus(boolean focus)
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
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
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
getFontMetrics
public FontMetrics getFontMetrics()
getForeColor
public Color getForeColor()
setForeColor
public void setForeColor(Color color)
getHeight
public int getHeight()
- Gets the height of the component.
- See Also:
- setHeight, getRectangle
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
getLayoutName
public String getLayoutName()
- Gets the layout name of the component. The layout name
is used by the layout manager.
- See Also:
- setLayoutName, LayoutManager
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
getLeft
public int getLeft()
- Gets the left origin of the component.
- See Also:
- setLeft, getRectangle
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
getName
public String getName()
- Gets the name of the component.
- See Also:
- setName
setName
public void setName(String name)
- Sets the name of the component.
- See Also:
- getName
getParent
public synchronized Container getParent()
- Gets the parent of the component.
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.
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
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
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
getResizePercentages
public Rectangle getResizePercentages()
setResizePercentages
public void setResizePercentages(Rectangle percentages)
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
getText
public String getText()
- Gets the text of the component.
- See Also:
- setText
setText
public void setText(String text)
- Sets the text of the component.
- See Also:
- getText
getTop
public int getTop()
- Gets the top origin of the component.
- See Also:
- setTop, getRectangle
setTop
public void setTop(int t)
- Sets the top origin of the component.
- See Also:
- getTop, setRectangle
getUserData
public Object getUserData()
setUserData
public void setUserData(Object userData)
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
setVisible
public void setVisible(boolean visible)
- Sets the visibility of a component.
- See Also:
- getVisible
getWidth
public int getWidth()
- Gets the width of the component.
- See Also:
- setWidth, getRectangle
setWidth
public void setWidth(int w)
- Sets the width of the component.
- See Also:
- getWidth, setRectangle
getZOrder
public int getZOrder()
setZOrder
public void setZOrder(int zorder)
addCreateListener
public synchronized void addCreateListener(CreateListener l)
getCreateListeners
public synchronized EventListenerVector getCreateListeners()
handleCreate
public synchronized void handleCreate(CreateEvent data)
removeCreateListener
public synchronized void removeCreateListener(CreateListener l)
addDestroyListener
public synchronized void addDestroyListener(DestroyListener l)
getDestroyListeners
public synchronized EventListenerVector getDestroyListeners()
handleDestroy
public synchronized void handleDestroy(DestroyEvent data)
removeDestroyListener
public synchronized void removeDestroyListener(DestroyListener l)
addMouseMoveListener
public synchronized void addMouseMoveListener(MouseMoveListener l)
getMouseMoveListeners
public synchronized EventListenerVector getMouseMoveListeners()
handleMouseMove
public synchronized void handleMouseMove(MouseMoveEvent data)
removeMouseMoveListener
public synchronized void removeMouseMoveListener(MouseMoveListener l)
addGeneralListener
public synchronized void addGeneralListener(GeneralListener l)
getGeneralListeners
public synchronized EventListenerVector getGeneralListeners()
handleGeneral
public synchronized void handleGeneral(GeneralEvent data)
removeGeneralListener
public synchronized void removeGeneralListener(GeneralListener l)
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
create
public boolean create()
- Creates a new component.
- Returns:
-
true
if the component was successfully created;
false
otherwise
- See Also:
- destroy, attachToComponent, detachFromComponent
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
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
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
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
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
destroy
public synchronized boolean destroy()
- Destroys the component.
- Returns:
-
true
if the component was successfully
destroyed; false
otherwise
- See Also:
- create, detachFromComponent
destroy
public synchronized boolean destroy(boolean callEvent)
- Destroys the component.
- Returns:
-
true
if the component was successfully
destroyed; false
otherwise
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
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
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
DURectangle
public Rectangle DURectangle(Rectangle r)
- Converts dialog units into pixels, using the current font
settings for the component.
- See Also:
- DUHeight, DUWidth, setFont
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
findComponent
public Component findComponent(Component awtComp,
boolean recurse)
findMenuComponent
public MenuComponent findMenuComponent(MenuComponent awtComp,
boolean recurse)
invalidate
public void invalidate()
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.
move
public void move(int x,
int y)
move
public void move(Rectangle rect)
repaint
public void repaint()
repaint
public void repaint(int x,
int y,
int width,
int height)
resize
public void resize(Dimension dim)
validate
public void validate()
toString
public String toString()
- Overrides:
- toString in class Object
paramString
protected String paramString()
- Returns information about the component which is used by the toString
method. Subclasses should override this method as appropriate.
handleAWTEvent
public boolean handleAWTEvent(Event event)
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
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
checkCreated
protected void checkCreated()
- Throws a NotCreatedException if the component has not been created.
This method should not be called directly.
processAWTEvent
protected boolean processAWTEvent(Event event)
All Packages Class Hierarchy This Package Previous Next Index