Class UIComponent
abstract public class UIComponent implements IUIComponent,
IUIAccessible, ImageObserver, Cloneable
{
// Methods
public boolean action(Event evt, Object what);
public synchronized void addFocusListener(IUIFocusListener l);
public synchronized void addKeyListener(IUIKeyListener l);
public synchronized void addMouseListener(IUIMouseListener l);
public synchronized void addMouseMotionListener(
IUIMouseMotionListener l);
public void addNotify();
public void adjustLayoutSize(Dimension oldSize,
Dimension newSize);
public Object clone();
public boolean contains(int x, int y);
public boolean contains(Point point);
public Image createImage(ImageProducer ip);
public Image createImage(int width, int height);
public void deliverEvent(Event e);
public void doDefaultAction();
public void doLayout();
public boolean ensureVisible(Rectangle rect);
public Color getBackground();
public Rectangle getBounds();
public Rectangle getBounds(IUIComponent comp);
public IUIComponent getComponent(int x, int y);
public IUIComponent getComponent(Point point);
public IUIComponent getComponentAt(int x, int y);
public IUIComponent getComponentAt(Point pt);
public Cursor getCursor();
public String getDefaultAction();
public String getDescription();
public int getFlags();
public Font getFont();
public FontMetrics getFontMetrics(Font f);
public Color getForeground();
public FxGraphics getGraphics();
public String getHelp();
public int getID();
public int getIndex();
public String getKeyboardShortcut();
public Point getLocation();
public Point getLocation(IUIComponent comp);
public Point getLocationOnScreen();
public Dimension getMaximumSize();
public Dimension getMinimumSize();
public String getName();
public IUIContainer getParent();
public ComponentPeer getPeer();
public Dimension getPreferredSize();
public Dimension getPreferredSize(Dimension size);
public int getRoleCode();
public IUIRootContainer getRoot();
public Dimension getSize();
public int getStateCode();
public Toolkit getToolkit();
public final Object getTreeLock();
public String getValueText();
public boolean gotFocus(Event e, Object o);
public boolean handleEvent(Event e);
public boolean imageUpdate(Image image, int flags, int x, int y,
int width, int height);
public void invalidate();
public boolean invalidateAll();
public boolean isChecked();
public boolean isEnabled();
public boolean isEnabled(boolean recurse);
public boolean isFocused();
public boolean isHeightRelative();
public boolean isHot();
public boolean isIndeterminate();
public boolean isInvalidating();
public boolean isKeyable();
public boolean isKeyable(boolean recurse);
public boolean isNotified();
public boolean isPressed();
public boolean isRedrawing();
public boolean isSelectable();
public boolean isSelected();
public boolean isShowing();
public boolean isValid();
public boolean isVisible();
public boolean isVisible(boolean recurse);
public boolean isWidthRelative();
public boolean keyDown(Event evt, int key);
public boolean keyUp(Event evt, int key);
public void layout();
public boolean lostFocus(Event e, Object o);
public boolean mouseClicked(Event e, int x, int y);
public boolean mouseDown(Event e, int x, int y);
public boolean mouseDrag(Event e, int x, int y);
public boolean mouseEnter(Event e, int x, int y);
public boolean mouseExit(Event e, int x, int y);
public boolean mouseMove(Event evt, int x, int y);
public boolean mouseUp(Event e, int x, int y);
public IUIComponent navigate(IUIComponent comp, int direction,
boolean keyable);
public void notifyEvent(UINotifyEvent e);
public void paint(FxGraphics g);
public void paintAll(FxGraphics g);
public boolean postEvent(Event e);
public boolean prepareImage(Image image, ImageObserver observer);
public boolean prepareImage(Image image, int width, int height,
ImageObserver observer);
public void print(FxGraphics g);
public void printAll(FxGraphics g);
public void relayout();
public synchronized void removeFocusListener(IUIFocusListener l);
public synchronized void removeKeyListener(IUIKeyListener l);
public synchronized void removeMouseListener(IUIMouseListener l);
public synchronized void removeMouseMotionListener(
IUIMouseMotionListener l);
public void removeNotify();
public void repaint();
public void repaint(long time);
public void repaint(int x, int y, int width, int height);
public void repaint(long tm, int x, int y, int width, int height);
public void requestFocus();
public void setBackground(Color color);
public void setBounds(int x, int y, int width, int height);
public void setBounds(Rectangle rect);
public void setChecked(boolean on);
public void setCursor(Cursor cursor);
public void setEnabled(boolean on);
public void setFlags(int flags);
public void setFocused(boolean on);
public void setFont(Font font);
public void setForeground(Color color);
public void setHot(boolean on);
public void setID(int id);
public void setIndeterminate(boolean on);
public void setIndex(int index);
public void setInvalidating(boolean on);
public void setLocation(int x, int y);
public void setLocation(Point point);
public void setName(String name);
public void setParent(IUIContainer parent);
public void setPressed(boolean on);
public void setRedrawing(boolean on);
public void setSelected(boolean on);
public void setSize(int width, int height);
public void setSize(Dimension size);
public void setValid(boolean on);
public void setValueText(String value);
public void setVisible(boolean show);
public String toString();
public void update(FxGraphics g);
public void validate();
}
This class implements a stateless component. UIComponent is the base class for all components and containers in AFC. UIContainer extends UIComponent to implement a stateless container.
UIComponent allows you to create lightweight controls without the overhead of managing an object's states. Although most components and containers in AFC are not stateless, UIComponent and UIContainer provide the option of creating controls that have no states.
Note AFC extends UIStateComponent and UIStateContainer from UIComponent and UIContainer, respectively, to implement objects having states.
UIComponent implements the IUIComponent, IUIAccessible, and ImageObserver interfaces.
Note The hot-track color is the same color as the button text color. As a result, hot-tracking does not appear to be functional.
public boolean action(Event evt, Object what);
Responds to an action that has occurred within the control.
Return Value:
Returns true if the event was handled; otherwise, returns false.
Parameter | Description |
evt
| The event posted to the control.
|
what
| The object that posted the event.
|
Remarks:
This method implements action in the IUIComponent interface, and by default, does nothing. UIComponent components should override this method.
public synchronized void addFocusListener(IUIFocusListener l);
Adds the specified focus listener. The listener receives all focus events generated for the control.
Return Value:
No return value.
Parameter | Description |
l
| The focus listener to be added.
|
Remarks:
This method implements addFocusListener in the IUIComponent interface.
See Also: removeFocusListener
public synchronized void addKeyListener(IUIKeyListener l);
Adds the specified key listener. The listener receives all key events generated for the control.
Return Value:
No return value.
Parameter | Description |
l
| The key listener to be added.
|
Remarks:
This method implements addKeyListener in the IUIComponent interface.
See Also: removeKeyListener
public synchronized void addMouseListener(IUIMouseListener l);
Adds the specified mouse listener. The listener receives all mouse events generated for the control.
Return Value:
No return value.
Parameter | Description |
l
| The mouse listener to be added.
|
Remarks:
This method implements addMouseListener in the IUIComponent interface.
See Also: removeMouseListener
public synchronized void addMouseMotionListener(IUIMouseMotionListener l);
Adds the specified mouse motion listener. The listener receives all mouse motion events generated for the control.
Return Value:
No return value.
Parameter | Description |
l
| The mouse motion listener to be added.
|
Remarks:
This method implements addMouseMotionListener in the IUIComponent interface.
See Also: removeMouseMotionListener
public void addNotify();
Called to perform initialization when the graphics context is first available. Sends an EVENT_OBJECT_CREATE event notification to the parent or child.
Return Value:
No return value.
Remarks:
This method implements addNotify in the IUIComponent interface, and by default, does nothing. Components should override this method.
See Also: removeNotify
public void adjustLayoutSize(Dimension oldSize, Dimension newSize);
Invalidates the control and adjusts its layout size.
Return Value:
No return value.
Parameter | Description |
oldSize
| The previous layout size of the control.
|
newSize
| The new layout size of the control.
|
Remarks:
This method implements adjustLayoutSize in the IUIComponent interface. adjustLayoutSize is automatically invoked when the component's size has changed.
public Object clone();
Clones a copy of the component.
Return Value:
Returns the new cloned copy of the component
Exceptions:
CloneNotSupportedException
This exception should not occur.
public boolean contains(int x, int y);
Determines whether the control contains the point identified by the specified coordinates.
Return Value:
Returns true if the control contains the point; otherwise, returns false.
Parameter | Description |
x
| The x coordinate of the point, in the control's coordinate space.
|
y
| The y coordinate of the point, in the control's coordinate space.
|
Remarks:
This method implements contains in the IUIComponent interface, and calls getSize to determine whether the point lies within the control.
public boolean contains(Point point);
Determines whether the control contains the specified point.
Return Value:
Returns true if the control contains the point; otherwise, returns false.
Parameter | Description |
point
| The point, in the control's coordinate space.
|
Remarks:
This method implements contains in the IUIComponent interface, and calls getSize to determine whether the point lies within the control.
public Image createImage(ImageProducer ip);
Creates an image from the specified image producer.
Return Value:
Returns the created image.
Parameter | Description |
ip
| The image producer that will generate the image.
|
public Image createImage(int width, int height);
Creates an off-screen image of the specified dimensions (in pixels).
Return Value:
Returns the created image.
Parameter | Description |
width
| The width of the image.
|
height
| The height of the image.
|
public void deliverEvent(Event e);
Delivers an event to the control.
Return Value:
No return value.
Parameter | Description |
e
| The event.
|
Remarks:
This method implements deliverEvent in the IUIComponent interface by calling postEvent.
public void doDefaultAction();
Performs the default action for the control. For example, the default action for a button is to be pressed.
Return Value:
No return value.
Remarks:
This method implements doDefaultAction in the IUIAccessible interface, and by default, does nothing. Components should override this method.
See Also: getDefaultAction
public void doLayout();
Note This method is replaced by layout.
public boolean ensureVisible(Rectangle rect);
Brings the area identified by the specified rectangle into view.
Return Value:
Returns true if any component was moved or resized to make the rectangle visible; otherwise, returns false.
Parameter | Description |
rect
| The rectangle identifying the area to be made visible.
|
Remarks:
This method implements ensureVisible in the IUIComponent interface.
public Color getBackground();
Retrieves the background color of the control.
Return Value:
Returns a Color object containing the background color.
Remarks:
This method implements getBackground in the IUIComponent interface, and only checks the background color of the control's parent. By default, the control has no parent (see getParent); therefore, null is returned. Components should override this method.
See Also: setBackground
public Rectangle getBounds();
Retrieves the bounding rectangle of the control, relative to its parent.
Return Value:
Returns a Rectangle object identifying the control's bounding area, in its parent's coordinate space.
Remarks:
This method implements getBounds in the IUIComponent interface. If the control has no parent, the returned rectangle has a width and height of 0 pixels.
See Also: setBounds, getParent
public Rectangle getBounds(IUIComponent comp);
Retrieves the bounding rectangle of the control, relative to the specified component.
Return Value:
Returns a Rectangle object identifying the control's bounding area, in the coordinate space of the specified component.
Parameter | Description |
comp
| The reference component. The coordinates of the returned Rectangle object are relative to this component. If null, screen coordinates are used.
|
Remarks:
This method implements getBounds in the IUIComponent interface.
See Also: setBounds
public IUIComponent getComponent(int x, int y);
Retrieves the component that contains the point identified by the specified coordinates.
Return Value:
Returns the control itself if it contains the point; otherwise, returns null.
Parameter | Description |
x
| The x coordinate of the point, in the control's coordinate space.
|
y
| The y coordinate of the point, in the control's coordinate space.
|
Remarks:
This method implements getComponent in the IUIComponent interface, and calls getSize to determine whether the point lies within the control.
public IUIComponent getComponent(Point point);
Retrieves the component that contains the specified point.
Return Value:
Returns the control itself if it contains the point; otherwise, returns null.
Parameter | Description |
point
| The point, in the control's coordinate space.
|
Remarks:
This method implements getComponent in the IUIComponent interface, and calls getSize to determine whether the point lies within the control.
public IUIComponent getComponentAt(int x, int y);
Note This method is replaced by getComponent.
public IUIComponent getComponentAt(Point pt);
Note This method is replaced by getComponent.
public Cursor getCursor();
Retrieves the control's cursor.
Return Value:
Returns a Cursor object containing the cursor.
Remarks:
This method implements getCursor in the IUIComponent interface, and only checks the cursor of the control's parent. By default, the control has no parent (see getParent); therefore, null is returned. Components should override this method.
See Also: setCursor
public String getDefaultAction();
Retrieves the default action for the control.
Return Value:
Returns an empty string, indicating the control has no default action.
Remarks:
This method implements getDefaultAction in the IUIAccessible interface. Components should override this method.
See Also: doDefaultAction
public String getDescription();
Retrieves a description of the control.
Return Value:
Returns an empty string, indicating the control has no description.
Remarks:
This method implements getDescription in the IUIAccessible interface. Components should override this method.
public int getFlags();
Retrieves the user-defined bits currently set for the control.
Return Value:
Returns 0, indicating no user-defined bits are set.
Remarks:
This method implements getFlags in the IUIComponent interface. Components that have states should override this method.
See Also: setFlags
public Font getFont();
Retrieves the font of the control.
Return Value:
Returns a Font object containing the font.
Remarks:
This method implements getFont in the IUIComponent interface, and only checks the font of the control's parent. By default, the control has no parent (see getParent); therefore, null is returned. Components should override this method.
See Also: setFont
public FontMetrics getFontMetrics(Font f);
Retrieves the font metrics for the specified font.
Return Value:
Returns the font metrics.
Parameter | Description |
f
| The font.
|
Remarks:
This method implements getFontMetrics in the IUIComponent interface.
public Color getForeground();
Retrieves the foreground color of the control.
Return Value:
Returns a Color object containing the foreground color.
Remarks:
This method implements getForeground in the IUIComponent interface, and only checks the foreground color of the control's parent. By default, the control has no parent (see getParent); therefore, null is returned. Components should override this method.
See Also: setForeground
public FxGraphics getGraphics();
Retrieves the graphics context of the control.
Return Value:
Returns the graphics context, if available; otherwise, returns null.
Remarks:
This method implements getGraphics in the IUIComponent interface.
Note In order to get a valid FxGraphics object back from the getGraphics call, the isNotified state must be checked first.
public String getHelp();
Retrieves the Help text for the control.
Return Value:
Returns an empty string, indicating the control has no Help text.
Remarks:
This method implements getHelp in the IUIAccessible interface. Components should override this method.
public int getID();
Retrieves the control's identifier.
Return Value:
Returns -1, indicating the control has no identifier.
Remarks:
This method implements getID in the IUIComponent interface. Components should override this method.
See Also: setID, getName
public int getIndex();
Retrieves the index of the control within its parent container.
Return Value:
Returns the control's index (if it has a parent container); otherwise, returns -1.
Remarks:
This method implements getIndex in the IUIComponent interface.
See Also: setIndex, getParent
public String getKeyboardShortcut();
Retrieves the keyboard shortcut for the control.
Return Value:
Returns an empty string, indicating the control has no keyboard shortcut.
Remarks:
This method implements getKeyboardShortcut in the IUIAccessible interface. Components should override this method.
public Point getLocation();
Retrieves the location of the control, relative to its parent.
Return Value:
Returns a Point object containing the upper-left corner of the control, in its parent's coordinate space.
Remarks:
This method implements getLocation in the IUIComponent interface.
See Also: setLocation
public Point getLocation(IUIComponent comp);
Retrieves the location of the control, relative to the specified component.
Return Value:
Returns a Point object containing the upper-left corner of the control, in the coordinate space of the specified component.
Parameter | Description |
comp
| The reference component. The coordinates of the returned Point object are relative to this component. If null, screen coordinates are used.
|
Remarks:
This method implements getLocation in the IUIComponent interface.
See Also: setLocation
public Point getLocationOnScreen();
Note This method is replaced by getLocation.
public Dimension getMaximumSize();
Retrieves the maximum dimensions (in pixels) for displaying the control.
Return Value:
Returns a Dimension object with the width and height set to the maximum integer value.
Remarks:
This method implements getMaximumSize in the IUIComponent interface. Components should override this method.
See Also: getMinimumSize, getPreferredSize, getSize
public Dimension getMinimumSize();
Retrieves the minimum size of the control. The minimum size specifies the smallest dimensions (in pixels) that will allow the control to be displayed.
Return Value:
Returns a Dimension object with a width and height of 0 pixels.
Remarks:
This method implements getMinimumSize in the IUIComponent interface. Components should override this method.
See Also: getPreferredSize, getMaximumSize, getSize
public String getName();
Retrieves the control's name.
Return Value:
Returns the name of the control, or null, indicating the control has no name.
Remarks:
This method implements getName in the IUIComponent interface. Components should override this method.
See Also: setName, getID
public IUIContainer getParent();
Retrieves the control's parent.
Return Value:
Returns the parent of the container, or null, indicating the control has no parent container.
Remarks:
This method implements getParent in the IUIComponent interface. Components should override this method.
See Also: setParent
public ComponentPeer getPeer();
Retrieves the peer of the control's root container.
Return Value:
Returns the root container's peer.
Remarks:
This method implements getPeer in the IUIComponent interface.
public Dimension getPreferredSize();
Retrieves the preferred dimensions (in pixels) for displaying the control.
Return Value:
Returns a Dimension object with a width and height of 0 pixels.
Remarks:
This method implements getPreferredSize in the IUIComponent interface. Components should override this method.
See Also: getMinimumSize, getMaximumSize, getSize
public Dimension getPreferredSize(Dimension size);
Retrieves the preferred dimensions (in pixels) for displaying the control.
Return Value:
Returns a Dimension object with a width and height of 0 pixels.
Parameter | Description |
size
| The Dimension to coerce the preferred size to.
|
Remarks:
This method implements getPreferredSize in the IUIComponent interface. Components should override this method.
This method is used to force the preferred size of a component to a specified Dimension or on a particular axis.
See Also: getMinimumSize, getMaximumSize, getSize
public int getRoleCode();
Retrieves the role of the control.
Return Value:
Returns 0, indicating no ROLE_SYSTEM code describes the control.
Remarks:
This method implements getRoleCode in the IUIAccessible interface. Components should override this method if one of the ROLE_SYSTEM codes describes the control.
public IUIRootContainer getRoot();
Retrieves the first component in the control's chain that implements the IUIRootContainer interface.
Return Value:
Returns the root container if successful; otherwise, returns null.
Remarks:
This method implements getRoot in the IUIComponent interface.
public Dimension getSize();
Retrieves the size (in pixels) of the control.
Return Value:
Returns a Dimension object containing the control's size.
Remarks:
This method implements getSize in the IUIComponent interface, and uses the control's parent container to determine the size. If the control has no parent, getSize returns a width and height of zero.
See Also: setSize, getParent
public int getStateCode();
Retrieves the state of the control.
Return Value:
Returns the combination of STATE_SYSTEM codes that best describe the state of the control.
Remarks:
This method implements getStateCode in the IUIAccessible interface. The returned code contains the STATE_SYSTEM_SIZEABLE and STATE_SYSTEM_MOVEABLE flags. Depending on which states are set for the control, the returned code may also contain one of the following other codes.
State
|
Code
|
checked
|
STATE_SYSTEM_CHECKED
|
focused
|
STATE_SYSTEM_FOCUSED
|
hot-tracked
|
STATE_SYSTEM_HOTTRACKED
|
indeterminate
|
STATE_SYSTEM_MIXED
|
pressed
|
STATE_SYSTEM_PRESSED
|
selected
|
STATE_SYSTEM_SELECTED
|
can receive keyboard input
|
STATE_SYSTEM_FOCUSABLE
|
can be selected
|
STATE_SYSTEM_SELECTABLE
|
not visible
|
STATE_SYSTEM_INVISIBLE
|
Components can override getStateCode by combining any class-specific codes with the codes obtained from each superclass. The following example shows how UISelector overrides this method.
public int getStateCode()
{
int state = super.getStateCode();
if (selMode == MULTISELECT)
state |= STATE_SYSTEM_MULTISELECTABLE;
else if (selMode == EXTENDSELECT)
state |= STATE_SYSTEM_EXTSELECTABLE;
return(state);
}
See Also: isChecked, isFocused, isHot, isIndeterminate, isKeyable, isPressed, isSelectable, isSelected, isVisible
public Toolkit getToolkit();
Retrieves the toolkit associated with the control.
Return Value:
Returns the associated toolkit.
Remarks:
This method implements getToolkit in the IUIComponent interface.
public final Object getTreeLock();
Retrieves the locking object for AWT component tree and layout operations.
public String getValueText();
Retrieves the value of the control.
Return Value:
Returns an empty string, indicating the control has no value text.
Remarks:
This method implements getValueText in the IUIAccessible interface. Components should override this method.
See Also: setValueText
public boolean gotFocus(Event e, Object o);
Responds to the control receiving input focus.
Return Value:
Returns false.
Parameter | Description |
e
| The event posted to the control.
|
o
| The object that posted the event (typically null).
|
Remarks:
This method implements gotFocus in the IUIComponent interface. gotFocus calls setFocused to set the focus state.
public boolean handleEvent(Event e);
Responds to events occurring within the control.
Return Value:
Returns true if the event was handled; otherwise, returns false.
Parameter | Description |
e
| The event.
|
Remarks:
This method implements handleEvent in the IUIComponent interface. handleEvent checks the type of event and calls the corresponding event method, as follows.
See Also: postEvent
public boolean imageUpdate(Image image, int flags, int x, int y, int width,
int height);
Called to incrementally draw the control's image as the image bits become available.
Return Value:
Returns false, indicating the image is fully loaded.
Parameter | Description |
image
| The control's image.
|
flags
| The flags that specify the status of the image being loaded. You can pass any bitwise combination of the fields defined in the ImageObserver interface.
|
x
| The x coordinate of the image.
|
y
| The y coordinate of the image.
|
width
| The width of the image (in pixels).
|
height
| The height of the image (in pixels).
|
Remarks:
This method implements imageUpdate in the ImageObserver interface. Components that display images should override this method.
public void invalidate();
Note This method is replaced by setValid.
public boolean invalidateAll();
Invalidates the control and all of its child components.
Return Value:
Returns true, indicating that the control was invalidated.
Remarks:
This method implements invalidateAll in the IUIComponent interface.
public boolean isChecked();
Determines whether the control's checked state is set.
Return Value:
Returns false, indicating the checked state is not set.
Remarks:
This method implements isChecked in the IUIComponent interface. Components that have states should override this method.
See Also: setChecked
public boolean isEnabled();
Determines whether the control's enabled state is set.
Return Value:
Returns false, indicating the enabled state is not set.
Remarks:
This method implements isEnabled in the IUIComponent interface. Components that have states should override this method.
See Also: setEnabled
public boolean isEnabled(boolean recurse);
Determines whether the enabled state of the control, or of all its ancestors, is set.
Return Value:
Returns true if the control and all of its ancestors are enabled (if the recurse parameter is true) or if the control alone is enabled (if recurse is false); otherwise, returns false.
Parameter | Description |
recurse
| If true, this method checks the enabled state of the control and each of its ancestors. If false, only the control itself is checked.
|
Remarks:
This method implements isEnabled in the IUIComponent interface.
See Also: setEnabled
public boolean isFocused();
Determines whether the control's focus state is set.
Return Value:
Returns false, since the control is stateless.
Remarks:
This method implements isFocused in the IUIComponent interface. Components with states should override this method.
See Also: setFocused
public boolean isHeightRelative();
Determines if this layout manager uses the height of the container to lay out its children.
Return Value:
Returns true if this layout manager uses the container's height to lay out the children; otherwise, returns false. (The default is true.) Returning false also means that the container's layout method doesn't need to be called on a vertical resizing.
See Also: isWidthRelative
public boolean isHot();
Determines whether the control's hot-tracked state is set.
Return Value:
Returns false, indicating the hot-tracked state is not set.
Remarks:
This method implements isHot in the IUIComponent interface. Components that have states should override this method.
See Also: setHot
public boolean isIndeterminate();
Determines whether the control's indeterminate state is set.
Return Value:
Returns false, indicating the indeterminate state is not set.
Remarks:
This method implements isIndeterminate in the IUIComponent interface. Components that have states should override this method.
See Also: setIndeterminate
public boolean isInvalidating();
Retrieves the current invalidating state of this object.
Return Value:
Returns true if this object has invalidating enabled; otherwise, returns false (which means it will ignore requests to invalidate).
public boolean isKeyable();
Determines whether the control can receive keyboard input.
Return Value:
Returns true if the control can receive keyboard input; otherwise, returns false.
Remarks:
This method implements isKeyable in the IUIComponent interface. A control can receive keyboard input if it is enabled and visible.
See Also: isEnabled, isVisible
public boolean isKeyable(boolean recurse);
Determines whether the control, and all of its ancestors, can receive keyboard input.
Return Value:
Returns true if the control and all of its ancestors can receive keyboard input (if the recurse parameter is true) or if the control alone can receive keyboard input (if recurse is false); otherwise, returns false.
Parameter | Description |
recurse
| If true, this method checks whether the control and each of its ancestors can receive keyboard input. If false, only the control itself is checked.
|
Remarks:
This method implements isKeyable in the IUIComponent interface. A control can receive keyboard input if it is enabled and visible.
See Also: isEnabled, isVisible
public boolean isNotified();
Determines whether the control's notified state is set.
Return Value:
Returns false, indicating the notified state is not set.
Remarks:
This method implements isNotified in the IUIComponent interface. Components that have states should override this method.
See Also: addNotify, removeNotify
public boolean isPressed();
Determines whether the control's pressed state is set.
Return Value:
Returns false, indicating the pressed state is not set.
Remarks:
This method implements isPressed in the IUIComponent interface. Components that have states should override this method.
See Also: setPressed
public boolean isRedrawing();
Determines whether the control will be redrawn when a paint request is made.
Return Value:
Returns false, indicating the redrawing state is not set.
Remarks:
This method implements isRedrawing in the IUIComponent interface, and by default, simply returns false. Components should override this method.
See Also: setRedrawing
public boolean isSelectable();
Determines whether the control's selected state can be set.
Return Value:
Returns true if the control can be selected; otherwise, returns false.
Remarks:
This method implements isSelectable in the IUIComponent interface, and simply calls isKeyable.
See Also: setSelected, isSelected
public boolean isSelected();
Determines whether the control's selected state is set.
Return Value:
Returns false, indicating the selected state is not set.
Remarks:
This method implements isSelected in the IUIComponent interface. Components that have states should override this method.
See Also: setSelected
public boolean isShowing();
Note This method is replaced by isVisible.
public boolean isValid();
Determines whether the control is valid.
Return Value:
Returns false, indicating the control is invalid.
Remarks:
This method implements isValid in the IUIComponent interface, and by default, simply returns false. Components should override this method.
public boolean isVisible();
Determines whether the control's visible state is set.
Return Value:
Returns false, indicating the control is hidden.
Remarks:
This method implements isVisible in the IUIComponent interface. Components that have states should override this method.
See Also: setVisible
public boolean isVisible(boolean recurse);
Determines whether the visible state of the control, or of all its ancestors, is set.
Return Value:
Returns true if the control and all of its ancestors are visible (if the recurse parameter is true) or if the control alone is visible (if recurse is false); otherwise, returns false.
Parameter | Description |
recurse
| If true, this method checks the visible state of the control and each of its ancestors. If false, only the control itself is checked.
|
Remarks:
This method implements isVisible in the IUIComponent interface.
See Also: setVisible
public boolean isWidthRelative();
Determines if this layout manager uses the width of the container to lay out its children.
Return Value:
Returns true if this layout manager uses the container's width to lay out the children; otherwise, returns false. (The default is true.) Returning false also means that the container's layout method doesn't need to be called on a horizontal resizing.
See Also: isHeightRelative
public boolean keyDown(Event evt, int key);
Responds to a key being pressed when the control has the input focus.
Return Value:
Returns true if the event was handled; otherwise, returns false.
Parameter | Description |
evt
| The event posted to the control.
|
key
| The key that was pressed.
|
Remarks:
This method implements keyDown in the IUIComponent interface, and by default, does nothing. UIComponent components should override this method.
public boolean keyUp(Event evt, int key);
Responds to a key being released when the control has the input focus.
Return Value:
Returns true if the event was handled; otherwise, returns false.
Parameter | Description |
evt
| The event posted to the control.
|
key
| The key that was released.
|
Remarks:
This method implements keyUp in the IUIComponent interface, and by default, does nothing. UIComponent components should override this method.
public void layout();
Lays out the control.
Return Value:
No return value.
Remarks:
This method implements layout in the IUIComponent interface, and by default, does nothing. Components should override this method.
layout is invoked when the control is validated.
See Also: relayout
public boolean lostFocus(Event e, Object o);
Responds to the control losing input focus.
Return Value:
Returns false.
Parameter | Description |
e
| The event posted to the control.
|
o
| The object that posted the event (typically null).
|
Remarks:
This method implements lostFocus in the IUIComponent interface. lostFocus calls setFocused to clear the focus state. lostFocus also clears the pressed state, if set.
public boolean mouseClicked(Event e, int x, int y);
Responds to the control being clicked with the mouse.
Return Value:
Returns true if the event was handled; otherwise, returns false.
Parameter | Description |
e
| The event posted to the control.
|
x
| The x coordinate of the event.
|
y
| The y coordinate of the event.
|
Remarks:
This method implements mouseClicked in the IUIComponent interface, and by default, does nothing. UIComponent components should override this method.
public boolean mouseDown(Event e, int x, int y);
Responds to the mouse button being pressed over the control.
Return Value:
Returns true if the event was handled; otherwise, returns false.
Parameter | Description |
e
| The event posted to the control.
|
x
| The x coordinate of the event.
|
y
| The y coordinate of the event.
|
Remarks:
This method implements mouseDown in the IUIComponent interface. mouseDown calls setPressed to set the pressed state. UIComponent components should override this method.
See Also: mouseUp
public boolean mouseDrag(Event e, int x, int y);
Responds to the mouse being dragged (while the mouse button is pressed) inside or outside the control.
Return Value:
Returns true if the event was handled; otherwise, returns false.
Parameter | Description |
e
| The event posted to the control.
|
x
| The x coordinate of the event.
|
y
| The y coordinate of the event.
|
Remarks:
This method implements mouseDrag in the IUIComponent interface. mouseDrag calls setPressed to set or clear the pressed state. If the mouse is dragged inside the control, the pressed state is set. If the mouse is dragged outside the control, the pressed state is cleared. UIComponent components should override this method.
public boolean mouseEnter(Event e, int x, int y);
Responds to the mouse entering the control.
Return Value:
Returns true if the event was handled; otherwise, returns false.
Parameter | Description |
evt
| The event posted to the control.
|
x
| The x coordinate of the event.
|
y
| The y coordinate of the event.
|
Remarks:
This method implements mouseEnter in the IUIComponent interface. If the control can receive keyboard input, mouseEnter calls setHot to set the hot-tracked state. If the control has a tool tip, mouseEnter manages a timer to display the tool tip. UIComponent components should override this method.
See Also: mouseExit, mouseMove
public boolean mouseExit(Event e, int x, int y);
Responds to the mouse leaving the control.
Return Value:
Returns true if the event was handled; otherwise, returns false.
Parameter | Description |
e
| The event posted to the control.
|
x
| The x coordinate of the event.
|
y
| The y coordinate of the event.
|
Remarks:
This method implements mouseExit in the IUIComponent interface. If the control can receive keyboard input, mouseExit calls setHot to clear the hot-tracked state. If the control has a tool tip, mouseExit manages a timer to display the tool tip. UIComponent components should override this method.
See Also: mouseEnter, mouseMove
public boolean mouseMove(Event evt, int x, int y);
Responds to the mouse being moved within the control (with the mouse button unpressed).
Return Value:
Returns false.
Parameter | Description |
evt
| The event posted to the control.
|
x
| The x coordinate of the event.
|
y
| The y coordinate of the event.
|
Remarks:
This method implements mouseMove in the IUIComponent interface. If the control has a tool tip, mouseMove manages a timer to display the tool tip.
public boolean mouseUp(Event e, int x, int y);
Responds to the mouse button being released over the control.
Return Value:
Returns true if the event was handled; otherwise, returns false.
Parameter | Description |
e
| The event posted to the control.
|
x
| The x coordinate of the event.
|
y
| The y coordinate of the event.
|
Remarks:
This method implements mouseUp in the IUIComponent interface. mouseUp calls setPressed to clear the pressed state. UIComponent components should override this method.
See Also: mouseDown
public IUIComponent navigate(IUIComponent comp, int direction,
boolean keyable);
Navigates from the specified component to another component in the specified direction.
Return Value:
Returns null, indicating no component can be navigated to.
Parameter | Description |
comp
| The component to navigate from.
|
direction
| The navigation direction. Specify one of the NAVDIR values in the IUIAccessible interface.
|
keyable
| If true, only components that are able to receive keyboard input can be navigated to; otherwise, all components can be navigated to.
|
Remarks:
This method implements navigate in the IUIAccessible interface. UIContainer overrides this method to handle keyboard navigation among components in a container.
public void notifyEvent(UINotifyEvent e);
Passes event notification to any children that have requested notification.
Return Value:
No return value.
Parameter | Description |
e
| The event.
|
public void paint(FxGraphics g);
Draws the control in the specified graphics context.
Return Value:
No return value.
Parameter | Description |
g
| The graphics context.
|
Remarks:
This method implements paint in the IUIComponent interface, and by default, does nothing. Components should override this method.
See Also: paintAll, repaint, setRedrawing
public void paintAll(FxGraphics g);
Draws the control and all of its child components, using the specified graphics context.
Return Value:
No return value.
Parameter | Description |
g
| The graphics context.
|
Remarks:
This method implements paintAll in the IUIComponent interface. If the control is valid and its redrawing state is set, paintAll simply calls update.
See Also: paint, isRedrawing, isValid
public boolean postEvent(Event e);
Posts an event to the control.
Return Value:
Returns true if the event was handled (either by the control or by one of its ancestors); otherwise, returns false.
Parameter | Description |
e
| The event.
|
Remarks:
This method implements postEvent in the IUIComponent interface. postEvent calls handleEvent to respond to the event. If handleEvent returns false, the event is posted to the control's parent for handling (see getParent).
If the control and all of its ancestors are disabled, the event is not handled and postEvent returns false.
See Also: deliverEvent
public boolean prepareImage(Image image, ImageObserver observer);
Prepares an image for this component.
Return Value:
Returns true if the image has been fully prepared; false otherwise.
Parameter | Description |
image
| The image to prepare for component.
|
observer
| The observer notified of the image's preparation.
|
public boolean prepareImage(Image image, int width, int height,
ImageObserver observer);
Prepares an image of the specified dimension for this component. The dimensions are specified in pixels.
Return Value:
Returns true if the image has been fully prepared; false otherwise.
Parameter | Description |
image
| The image to prepare for component.
|
width
| The width of the image.
|
height
| The height of the image.
|
observer
| The observer notified of the image's preparation.
|
public void print(FxGraphics g);
Prints the control in the specified graphics context.
Return Value:
No return value.
Parameter | Description |
g
| The graphics context.
|
Remarks:
This method implements print in the IUIComponent interface, and simply calls paint.
See Also: printAll
public void printAll(FxGraphics g);
Prints the control and all of its child components, using the specified graphics context.
Return Value:
No return value.
Parameter | Description |
g
| The graphics context.
|
Remarks:
This method implements printAll in the IUIComponent interface, and simply calls paintAll.
See Also: print
public void relayout();
Schedules the control to be laid out as soon as possible.
Return Value:
No return value.
Remarks:
This method implements relayout in the IUIComponent interface. relayout calls layout if the control is valid.
See Also: isValid
public synchronized void removeFocusListener(IUIFocusListener l);
Removes the specified focus listener. The listener no longer receives the control's focus events.
Return Value:
No return value.
Parameter | Description |
l
| The focus listener to be removed.
|
Remarks:
This method implements removeFocusListener in the IUIComponent interface.
See Also: addFocusListener
public synchronized void removeKeyListener(IUIKeyListener l);
Removes the specified key listener. The listener no longer receives the control's key events.
Return Value:
No return value.
Parameter | Description |
l
| The key listener to be removed.
|
Remarks:
This method implements removeKeyListener in the IUIComponent interface.
See Also: addKeyListener
public synchronized void removeMouseListener(IUIMouseListener l);
Removes the specified mouse listener. The listener no longer receives the control's mouse events.
Return Value:
No return value.
Parameter | Description |
l
| The mouse listener to be removed.
|
Remarks:
This method implements removeMouseListener in the IUIComponent interface.
See Also: addMouseListener
public synchronized void removeMouseMotionListener(
IUIMouseMotionListener l);
Removes the specified mouse motion listener. The listener no longer receives the control's mouse motion events.
Return Value:
No return value.
Parameter | Description |
l
| The mouse motion listener to be removed.
|
Remarks:
This method implements removeMouseMotionListener in the IUIComponent interface.
See Also: addMouseMotionListener
public void removeNotify();
Called when the graphics context is first unavailable. Sends an EVENT_OBJECT_DESTROY event notification to the parent or child.
Return Value:
No return value.
Remarks:
This method implements removeNotify in the IUIComponent interface, and by default, does nothing. Components should override this method.
See Also: addNotify
public void repaint();
Schedules the control to be redrawn as soon as possible.
Return Value:
No return value.
Remarks:
This method implements repaint in the IUIComponent interface. If the control is valid and its redrawing state is set, repaint calls update to redraw the control (if the control's graphics context is available).
Note This method is synchronous.
See Also: getGraphics, isRedrawing, isValid
public void repaint(long time);
Schedules the control to be redrawn after the specified amount of time.
Return Value:
No return value.
Parameter | Description |
time
| The number of milliseconds after which the control is redrawn.
|
Remarks:
This method implements repaint in the IUIComponent interface. This implementation ignores the time parameter and simply calls repaint(). Components should override this method.
Note This method is synchronous.
public void repaint(int x, int y, int width, int height);
Schedules the specified rectangle within the control to be redrawn as soon as possible.
Return Value:
No return value.
Parameter | Description |
x
| The x coordinate of the upper-left corner of the rectangle to be redrawn.
|
y
| The y coordinate of the upper-left corner of the rectangle to be redrawn.
|
width
| The width of the rectangle to be redrawn (in pixels).
|
height
| The height of the rectangle to be redrawn (in pixels).
|
Remarks:
This method implements repaint in the IUIComponent interface. This implementation ignores all parameters and simply calls repaint(). Components should override this method.
Note This method is synchronous.
public void repaint(long tm, int x, int y, int width, int height);
Schedules the specified rectangle within the control to be redrawn after the specified amount of time.
Return Value:
No return value.
Parameter | Description |
tm
| The number of milliseconds after which the rectangle is redrawn.
|
x
| The x coordinate of the upper-left corner of the rectangle to be redrawn.
|
y
| The y coordinate of the upper-left corner of the rectangle to be redrawn.
|
width
| The width of the rectangle to be redrawn (in pixels).
|
height
| The height of the rectangle to be redrawn (in pixels).
|
Remarks:
This method implements repaint in the IUIComponent interface. This implementation ignores all parameters and simply calls repaint(). Components should override this method.
Note This method is synchronous.
public void requestFocus();
Requests that the control receive the input focus.
Return Value:
No return value.
Remarks:
This method implements requestFocus in the IUIComponent interface.
public void setBackground(Color color);
Sets the control's background color.
Return Value:
No return value.
Parameter | Description |
color
| The background color for the control.
|
Remarks:
This method implements setBackground in the IUIComponent interface. Components should override this method.
See Also: getBackground
public void setBounds(int x, int y, int width, int height);
Sets the bounding rectangle of the control, according to the specified coordinates and dimensions. Sends an EVENT_OBJECT_LOCATIONCHANGE event notification to the parent or child.
Return Value:
No return value.
Parameter | Description |
x
| The x coordinate for the upper-left corner of the control, relative to the parent.
|
y
| The y coordinate for the upper-left corner of the control, relative to the parent.
|
width
| The new width of the control (in pixels).
|
height
| The new height of the control (in pixels).
|
Remarks:
This method implements setBounds in the IUIComponent interface. If the control has no parent container, this method returns false.
See Also: getBounds, getParent, com.ms.ui.UIWinEvent
public void setBounds(Rectangle rect);
Sets the bounding rectangle of the control, according to the specified Rectangle object.
Return Value:
No return value.
Parameter | Description |
rect
| The rectangle identifying the coordinates for the control's upper-left corner and the control's new width and height.
|
Remarks:
This method implements setBounds in the IUIComponent interface.
See Also: getBounds
public void setChecked(boolean on);
Sets or clears the checked state of the control.
Return Value:
No return value.
Parameter | Description |
on
| If true, the checked state is set; otherwise, it is cleared.
|
Remarks:
This method implements setChecked in the IUIComponent interface. Components that have states should override this method.
See Also: isChecked
public void setCursor(Cursor cursor);
Sets the control's cursor.
Return Value:
No return value.
Parameter | Description |
cursor
| The cursor for the control.
|
Remarks:
This method implements setCursor in the IUIComponent interface. Components should override this method.
See Also: getCursor
public void setEnabled(boolean on);
Sets or clears the enabled state of the control.
Return Value:
No return value.
Parameter | Description |
on
| If true, the enabled state is set; otherwise, it is cleared.
|
Remarks:
This method implements setEnabled in the IUIComponent interface. Components that have states should override this method.
See Also: isEnabled
public void setFlags(int flags);
Sets the user-defined bits for the control.
Return Value:
No return value.
Parameter | Description |
flags
| The user-defined settings for the control. You can set any bit in the mask 0xFFFF0000.
|
Remarks:
This method implements setFlags in the IUIComponent interface. Components that have states should override this method.
See Also: getFlags
public void setFocused(boolean on);
Sets or clears the focus state of the control. Sends an EVENT_OBJECT_FOCUS event notification to the parent or child.
Return Value:
No return value.
Parameter | Description |
on
| If true, the focus state is set; otherwise, it is cleared.
|
Remarks:
This method implements setFocused in the IUIComponent interface. Components that have states should override this method.
setFocused is automatically invoked when the control receives or loses focus.
See Also: isFocused, com.ms.ui.UIWinEvent
public void setFont(Font font);
Sets the control's font.
Return Value:
No return value.
Parameter | Description |
font
| The font for the control.
|
Remarks:
This method implements setFont in the IUIComponent interface. Components should override this method.
See Also: getFont
public void setForeground(Color color);
Sets the control's foreground color.
Return Value:
No return value.
Parameter | Description |
color
| The foreground color for the control.
|
Remarks:
This method implements setForeground in the IUIComponent interface. Components should override this method.
See Also: getForeground
public void setHot(boolean on);
Sets or clears the hot-tracked state of the control.
Return Value:
No return value.
Parameter | Description |
on
| If true, the hot-tracked state is set; otherwise, it is cleared.
|
Remarks:
This method implements setHot in the IUIComponent interface. Components that have states should override this method.
setHot is automatically invoked when the mouse enters and exits the control.
See Also: isHot
public void setID(int id);
Set the control's identifier.
Return Value:
No return value.
Parameter | Description |
id
| The value to be associated with the control.
|
Remarks:
This method implements setID in the IUIComponent interface. Components should override this method.
See Also: getID, setName
public void setIndeterminate(boolean on);
Sets or clears the indeterminate state of the control.
Return Value:
No return value.
Parameter | Description |
on
| If true, the indeterminate state is set; otherwise, it is cleared.
|
Remarks:
This method implements setIndeterminate in the IUIComponent interface. Components that have states should override this method.
See Also: isIndeterminate
public void setIndex(int index);
Sets the index of the control within its parent container.
Return Value:
No return value.
Parameter | Description |
index
| The index for the control.
|
Remarks:
This method implements setIndex in the IUIComponent interface, and by default, does nothing. Components should override this method.
See Also: getIndex
public void setInvalidating(boolean on);
Sets the invalidating state of this object.
Return Value:
No return value.
Parameter | Description |
on
| The invalidating state setting.
|
public void setLocation(int x, int y);
Sets the location of the control, relative to its parent. Sends an EVENT_OBJECT_LOCATIONCHANGE event notification to the parent or child.
Return Value:
No return value.
Parameter | Description |
x
| The x coordinate for the upper-left corner of the control, relative to the parent.
|
y
| The y coordinate for the upper-left corner of the control, relative to the parent.
|
Remarks:
This method implements setLocation in the IUIComponent interface.
See Also: getLocation, com.ms.ui.UIWinEvent
public void setLocation(Point point);
Sets the location of the control, relative to its parent.
Return Value:
No return value.
Parameter | Description |
point
| The upper-left corner of the control, relative to the parent.
|
Remarks:
This method implements setLocation in the IUIComponent interface.
See Also: getLocation
public void setName(String name);
Set the control's name. Sends an EVENT_OBJECT_NAMECHANGE event notification to the parent or child.
Return Value:
No return value.
Parameter | Description |
name
| The name to be associated with the control.
|
Remarks:
This method implements setName in the IUIComponent interface. Components should override this method.
See Also: getName, setID, com.ms.ui.UIWinEvent
public void setParent(IUIContainer parent);
Sets the control's parent. Sends an EVENT_OBJECT_PARENTCHANGE event notification to the parent or child.
Return Value:
No return value.
Parameter | Description |
parent
| The new parent container of the control.
|
Remarks:
This method implements setParent in the IUIComponent interface. Components should override this method.
See Also: getParent, com.ms.ui.UIWinEvent
public void setPressed(boolean on);
Sets or clears the pressed state of the control.
Return Value:
No return value.
Parameter | Description |
on
| If true, the pressed state is set; otherwise, it is cleared.
|
Remarks:
This method implements setPressed in the IUIComponent interface. Components that have states should override this method.
setPressed is automatically invoked when the mouse button is pressed, released, or dragged over the control.
See Also: isPressed
public void setRedrawing(boolean on);
Sets or clears the redrawing state of the control. If the redrawing state is set, the control will be redrawn when a paint request is made. If the redrawing state is cleared, the control will not be redrawn.
Return Value:
No return value.
Parameter | Description |
on
| If true, the redrawing state is set; otherwise, it is cleared.
|
Remarks:
This method implements setRedrawing in the IUIComponent interface, and by default, simply returns false. Components should override this method.
See Also: isRedrawing
public void setSelected(boolean on);
Sets or clears the selected state of the control. Sends an EVENT_OBJECT_SELECTION event notification to the parent or child.
Return Value:
No return value.
Parameter | Description |
on
| If true, the selected state is set; otherwise, it is cleared.
|
Remarks:
This method implements setSelected in the IUIComponent interface. Components that have states should override this method.
See Also: isSelected, com.ms.ui.UIWinEvent
public void setSize(int width, int height);
Sets the size of the control, according to the specified dimensions. Sends an EVENT_OBJECT_LOCATIONCHANGE event notification to the parent or child.
Return Value:
No return value.
Parameter | Description |
width
| The new width for the control (in pixels).
|
height
| The new height for the control (in pixels).
|
Remarks:
This method implements setSize in the IUIComponent interface.
See Also: getSize, com.ms.ui.UIWinEvent
public void setSize(Dimension size);
Sets the size of the control, according to the specified Dimension object.
Return Value:
No return value.
Parameter | Description |
size
| The new width and height for the control (in pixels).
|
Remarks:
This method implements setSize in the IUIComponent interface.
See Also: getSize
public void setValid(boolean on);
Sets or clears the valid state of the control.
Return Value:
No return value.
Parameter | Description |
on
| If true, the control is validated; otherwise, the control is invalidated.
|
Remarks:
This method implements setValid in the IUIComponent interface. By default, the on parameter is ignored. Components should override this method.
See Also: isValid
public void setValueText(String value);
Sets the value of the control. Sends an EVENT_OBJECT_VALUECHANGE event notification to the parent or child.
Return Value:
No return value.
Parameter | Description |
value
| The string that describes the visual information contained in the control. This value expands on the information provided by getRoleCode, getStateCode, and getName.
|
Remarks:
This method implements setValueText in the IUIAccessible interface, and by default, does nothing. Components should override this method.
See Also: getValueText, com.ms.ui.UIWinEvent
public void setVisible(boolean show);
Sets or clears the visible state of the control. Sends an EVENT_OBJECT_SELECTION or EVENT_OBJECT_HIDE event notification to the parent or child.
Return Value:
No return value.
Parameter | Description |
show
| If true, the visible state is set; otherwise, it is cleared.
|
Remarks:
This method implements setVisible in the IUIComponent interface. Components that have states should override this method.
See Also: isVisible, com.ms.ui.UIWinEvent
public String toString();
Retrieves a text description of the control.
Return Value:
Returns a string that contains the name of the control's class and the control's name.
Remarks:
This method implements toString in the IUIComponent interface.
See Also: getName
public void update(FxGraphics g);
Updates the drawing of the control, using the specified graphics context.
Return Value:
No return value.
Parameter | Description |
g
| The graphics context.
|
Remarks:
This method implements update in the IUIComponent interface. update fills the control with its background color, and then calls paint to redraw the control using the control's foreground color.
See Also: getBackground, getForeground, setRedrawing
public void validate();
Note This method is replaced by setValid.