| java.lang.Object java.awt.Component
All known Subclasses: java.awt.Choice, java.awt.Button, java.awt.Canvas, java.awt.Checkbox, java.awt.TextComponent, basis.DemoButton, java.awt.Container, java.awt.Scrollbar, java.awt.List, com.sun.jumpimpl.presentation.simplebasis.SimpleBasisAMSImageButton, basis.Bean, java.awt.Label,
Component | abstract public class Component implements ImageObserver,MenuContainer,Serializable(Code) | | A component is an object having a graphical representation
that can be displayed on the screen and that can interact with the
user. Examples of components are the buttons, checkboxes, and scrollbars
of a typical graphical user interface.
The Component class is the abstract superclass of
the nonmenu-related Abstract Window Toolkit components. Class
Component can also be extended directly to create a
lightweight component. A lightweight component is a component that is
not associated with a native opaque window.
NOTE: Changes to this class need to be synchronized with
src/share/optional/pjae/java/awt/Component.java
version: 1.9, 08/19/02 author: Nicholas Allen author: Sami Shaio |
Constructor Summary | |
protected | Component() Constructs a new component. |
Method Summary | |
public boolean | action(Event evt, Object what) | public synchronized void | add(PopupMenu popup) Adds the specified popup menu to the component. | public synchronized void | addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from
this component. | public synchronized void | addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from
this component. | public synchronized void | addKeyListener(KeyListener l) Adds the specified key listener to receive key events from
this component. | public synchronized void | addMouseListener(MouseListener l) Adds the specified mouse listener to receive mouse events from
this component. | public synchronized void | addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from
this component. | public void | addNotify() Notifies this component that it has been added to a container
and if a peer is required, it should be created. | boolean | areInputMethodsEnabled() | public Rectangle | bounds() | final void | checkEnableNewEventsOnly(Object listener) Checks if newEventsOnly should be enabled when the specified listener is added. | public int | checkImage(Image image, ImageObserver observer) Returns the status of the construction of a screen representation
of the specified image.
This method does not cause the image to begin loading. | public int | checkImage(Image image, int width, int height, ImageObserver observer) Returns the status of the construction of a screen representation
of the specified image.
This method does not cause the image to begin loading. | protected AWTEvent | coalesceEvents(AWTEvent existingEvent, AWTEvent newEvent) | String | constructComponentName() Construct a name for this component. | public boolean | contains(int x, int y) Checks whether this component "contains" the specified point,
where x and y are defined to be
relative to the coordinate system of this component. | public boolean | contains(Point p) Checks whether this component "contains" the specified point,
where the point's x and y coordinates are defined
to be relative to the coordinate system of this component. | public Image | createImage(ImageProducer producer) Creates an image from the specified image producer. | public Image | createImage(int width, int height) Creates an off-screen drawable image
to be used for double buffering.
Parameters: width - the specified width. Parameters: height - the specified height. | ComponentXWindow | createXWindow() | public void | deliverEvent(Event e) | public void | disable() | final protected void | disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter
from being delivered to this component. | final public void | dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components. | void | dispatchEventImpl(AWTEvent e) | public void | doLayout() Prompts the layout manager to lay out this component. | public void | enable() | public void | enable(boolean b) | final protected synchronized void | enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter
to be delivered to this component. | boolean | eventEnabled(AWTEvent e) | Component | findFocusDelegate(Container container) Recursively looks for the first component in container that is focus traversable. | public float | getAlignmentX() Returns the alignment along the x axis. | public float | getAlignmentY() Returns the alignment along the y axis. | public Color | getBackground() Gets the background color of this component.
This component's background color. | public Rectangle | getBounds() Gets the bounds of this component in the form of a
Rectangle object. | public ColorModel | getColorModel() Gets the instance of ColorModel used to display
the component on the output device. | public Component | getComponentAt(int x, int y) Determines if this component or one of its immediate
subcomponents contains the (x, y) location,
and if so, returns the containing component. | public Component | getComponentAt(Point p) Returns the component or subcomponent that contains the
specified point. | public Cursor | getCursor() Gets this component's cursor image. | Component | getFocusDelegate() Gets the component to which key events should be deleagted to when this component
has the focus. | public Font | getFont() Gets the font of this component.
This component's font. | Component | getFontAndColorDelegate() Gets the component used to delegate setFont, setBackground, setForeground to. | public FontMetrics | getFontMetrics(Font font) Gets the font metrics for the specified font.
font The font for which font metrics is to beobtained. | public Color | getForeground() Gets the foreground color of this component.
This component's foreground color. | public Graphics | getGraphics() Creates a graphics context for this component. | InputContext | getInputContext() Gets the input context used by this component for handling the communication
with input methods when text is entered in this component. | public Locale | getLocale() Gets the locale of this component.
This component's locale. | public Point | getLocation() Gets the location of this component in the form of a
point specifying the component's top-left corner. | public Point | getLocationOnScreen() Gets the location of this component in the form of a point
specifying the component's top-left corner in the screen's
coordinate space. | public Dimension | getMaximumSize() Gets the maximum size of this component. | public Dimension | getMinimumSize() Gets the mininimum size of this component. | public String | getName() Gets the name of the component. | Container | getNativeContainer() | public Container | getParent() Gets the parent of this component. | public Dimension | getPreferredSize() Gets the preferred size of this component. | public Dimension | getSize() Returns the size of this component in the form of a
Dimension object. | public Toolkit | getToolkit() Gets this component's toolkit.
Note that the frame that contains a component controls which
toolkit is used by that component. | final public Object | getTreeLock() Gets this component's locking object (the object that owns the thread
sychronization monitor) for AWT component-tree and layout
operations. | public boolean | gotFocus(Event evt, Object what) | public boolean | handleEvent(Event evt) | public void | hide() | public boolean | imageUpdate(Image img, int flags, int x, int y, int w, int h) Repaints the component when the image has changed.
This imageUpdate method of an ImageObserver
is called when more information about an
image which had been previously requested using an asynchronous
routine such as the drawImage method of
Graphics becomes available.
See the definition of imageUpdate for
more information on this method and its arguments.
The imageUpdate method of Component
incrementally draws an image on the component as more of the bits
of the image are available.
If the system property awt.image.incrementalDraw
is missing or has the value true , the image is
incrementally drawn, If the system property has any other value,
then the image is not drawn until it has been completely loaded.
Also, if incremental drawing is in effect, the value of the
system property awt.image.redrawrate is interpreted
as an integer to give the maximum redraw rate, in milliseconds. | public boolean | inside(int x, int y) | public void | invalidate() Invalidates this component. | static void | invokeAndWait(Runnable runnable) Invokes the supplied Runnable's run method on the event dispatch thread. | public boolean | isDisplayable() | public boolean | isEnabled() Determines whether this component is enabled. | public boolean | isFocusTraversable() Returns the value of a flag that indicates whether
this component can be traversed using
Tab or Shift-Tab keyboard focus traversal. | public boolean | isLightweight() | boolean | isLightweightWhenDisplayable() Returns whether this component is lightweight. | public boolean | isOpaque() Returns true if this component is completely opaque, returns
false by default.
An opaque component paints every pixel within its
rectangular region. | public boolean | isShowing() Determines whether this component is showing on screen. | public boolean | isValid() Determines whether this component is valid. | public boolean | isVisible() Determines whether this component is visible. | public boolean | keyDown(Event evt, int key) | public boolean | keyUp(Event evt, int key) | public void | layout() | void | lightweightPrint(Graphics g) Simulates the peer callbacks into java.awt for printing of
lightweight Components. | public void | list() Prints a listing of this component to the standard system output
stream System.out . | public void | list(PrintStream out) Prints a listing of this component to the specified output
stream. | public void | list(PrintStream out, int indent) Prints out a list, starting at the specified indention, to the
specified print stream. | public void | list(PrintWriter out) Prints a listing to the specified print writer. | public void | list(PrintWriter out, int indent) Prints out a list, starting at the specified indention, to
the specified print writer. | public Component | locate(int x, int y) | public Point | location() | public boolean | lostFocus(Event evt, Object what) | public Dimension | minimumSize() | public boolean | mouseDown(Event evt, int x, int y) | public boolean | mouseDrag(Event evt, int x, int y) | public boolean | mouseEnter(Event evt, int x, int y) | public boolean | mouseExit(Event evt, int x, int y) | public boolean | mouseMove(Event evt, int x, int y) | public boolean | mouseUp(Event evt, int x, int y) | public void | move(int x, int y) | public void | nextFocus() | public void | paint(Graphics g) Paints this component. | public void | paintAll(Graphics g) Paints this component and all of its subcomponents.
The origin of the graphics context, its
(0 , 0 ) coordinate point, is the
top-left corner of this component. | protected String | paramString() Returns the parameter string representing the state of this
component. | public boolean | postEvent(Event e) | public Dimension | preferredSize() | public boolean | prepareImage(Image image, ImageObserver observer) Prepares an image for rendering on this component. | public boolean | prepareImage(Image image, int width, int height, ImageObserver observer) Prepares an image for rendering on this component at the
specified width and height.
The image data is downloaded asynchronously in another thread,
and an appropriately scaled screen representation of the image is
generated.
Parameters: image - the instance of Image for which to prepare a screen representation. Parameters: width - the width of the desired screen representation. Parameters: height - the height of the desired screen representation. Parameters: observer - the ImageObserver objectto be notified as the image is being prepared. | public void | print(Graphics g) Prints this component. | public void | printAll(Graphics g) Prints this component and all of its subcomponents.
The origin of the graphics context, its
(0 , 0 ) coordinate point, is the
top-left corner of this component. | protected void | processComponentEvent(ComponentEvent e) Processes component events occurring on this component by
dispatching them to any registered
ComponentListener objects.
This method is not called unless component events are
enabled for this component. | protected void | processEvent(AWTEvent e) Processes events occurring on this component. | protected void | processFocusEvent(FocusEvent e) Processes focus events occurring on this component by
dispatching them to any registered
FocusListener objects.
This method is not called unless focus events are
enabled for this component. | protected void | processKeyEvent(KeyEvent e) Processes key events occurring on this component by
dispatching them to any registered
objects.
This method is not called unless key events are
enabled for this component. | protected void | processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by
dispatching them to any registered
MouseListener objects.
This method is not called unless mouse events are
enabled for this component. | protected void | processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by
dispatching them to any registered
MouseMotionListener objects.
This method is not called unless mouse motion events are
enabled for this component. | public synchronized void | remove(MenuComponent popup) Removes the specified popup menu from the component. | public synchronized void | removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer
receives component events from this component. | public synchronized void | removeFocusListener(FocusListener l) Removes the specified focus listener so that it no longer
receives focus events from this component. | public synchronized void | removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer
receives key events from this component. | public synchronized void | removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer
receives mouse events from this component. | public synchronized void | removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer
receives mouse motion events from this component. | public void | removeNotify() Notifies this component that it has been removed from its
container and if a peers exists, it destroys it. | public void | repaint() Repaints this component. | public void | repaint(long tm) Repaints the component. | public void | repaint(int x, int y, int width, int height) Repaints the specified rectangle of this component. | public void | repaint(long tm, int x, int y, int width, int height) Repaints the specified rectangle of this component within
tm milliseconds. | public void | requestFocus() Requests that this component get the input focus.
This component's gotFocus method is called when this
method is successful. | public void | reshape(int x, int y, int width, int height) | public void | resize(int width, int height) | public void | resize(Dimension d) | public void | setBackground(Color c) Sets the background color of this component. | public void | setBounds(int x, int y, int width, int height) Moves and resizes this component. | public void | setBounds(Rectangle r) Moves and resizes this component to conform to the new
bounding rectangle r . | public synchronized void | setCursor(Cursor cursor) Sets this components cursor image. | public void | setEnabled(boolean b) Enables or disables this component, depending on the value of the
parameter b . | public void | setFont(Font f) Sets the font of this component. | public void | setForeground(Color c) Sets the foreground color of this component. | public void | setLocale(Locale l) Sets the locale of this component. | public void | setLocation(int x, int y) Moves this component to a new location. | public void | setLocation(Point p) Moves this component to a new location. | public void | setName(String name) Sets the name of the component to the specified string. | public void | setSize(int width, int height) Resizes this component so that it has width width
and height .
width The new width of this component in pixels. | public void | setSize(Dimension d) Resizes this component so that it has width d.width
and height d.height . | public void | setVisible(boolean b) Shows or hides this component depending on the value of parameter
b . | public void | show() | public void | show(boolean b) | public Dimension | size() | public String | toString() Returns a string representation of this component and its values. | public void | transferFocus() Transfers the focus to the next component. | public void | update(Graphics g) Updates this component.
The AWT calls the update method in response to a
call to repaint | public void | validate() Ensures that this component has a valid layout. |
BOTTOM_ALIGNMENT | final public static float BOTTOM_ALIGNMENT(Code) | | Ease-of-use constant for getAlignmentY . Specifies an
alignment to the bottom of the component.
See Also: Component.getAlignmentY |
LEFT_ALIGNMENT | final public static float LEFT_ALIGNMENT(Code) | | Ease-of-use constant for getAlignmentX . Specifies an
alignment to the left side of the component.
See Also: Component.getAlignmentX |
RIGHT_ALIGNMENT | final public static float RIGHT_ALIGNMENT(Code) | | Ease-of-use constant for getAlignmentX . Specifies an
alignment to the right side of the component.
See Also: Component.getAlignmentX |
TOP_ALIGNMENT | final public static float TOP_ALIGNMENT(Code) | | Ease-of-use constant for getAlignmentY() . Specifies an
alignment to the top of the component.
See Also: Component.getAlignmentY |
actionListenerK | final static String actionListenerK(Code) | | Internal, constants for serialization
|
adjustmentListenerK | final static String adjustmentListenerK(Code) | | |
componentListenerK | final static String componentListenerK(Code) | | |
containerListenerK | final static String containerListenerK(Code) | | |
defaultNewEventsOnly | final static boolean defaultNewEventsOnly(Code) | | |
delegate | transient Component delegate(Code) | | If this component delegates to another component then this is the component
it delegates to.
|
delegateSource | transient Component delegateSource(Code) | | If this component is a delegate for an AWT Component then this represents the
AWT component that delagtes to it.
|
eventMask | long eventMask(Code) | | |
incRate | static int incRate(Code) | | |
mouseMotionListenerK | final static String mouseMotionListenerK(Code) | | |
newEventsOnly | boolean newEventsOnly(Code) | | |
Component | protected Component()(Code) | | Constructs a new component. Class Component can be
extended directly to create a lightweight component that does not
utilize an opaque native window. A lightweight component must be
hosted by a native container somewhere higher up in the component
tree (for example, by a Frame object).
|
addNotify | public void addNotify()(Code) | | Notifies this component that it has been added to a container
and if a peer is required, it should be created.
This method should be called by Container.add , and
not by user code directly.
See Also: Component.removeNotify since: JDK1.0 |
areInputMethodsEnabled | boolean areInputMethodsEnabled()(Code) | | |
checkEnableNewEventsOnly | final void checkEnableNewEventsOnly(Object listener)(Code) | | Checks if newEventsOnly should be enabled when the specified listener is added.
|
checkImage | public int checkImage(Image image, int width, int height, ImageObserver observer)(Code) | | Returns the status of the construction of a screen representation
of the specified image.
This method does not cause the image to begin loading. An
application must use the prepareImage method
to force the loading of an image.
The checkImage method of Component
calls its peer's checkImage method to calculate
the flags. If this component does not yet have a peer, the
component's toolkit's checkImage method is called
instead.
Information on the flags returned by this method can be found
with the discussion of the ImageObserver interface.
Parameters: image - the Image object whose statusis being checked. Parameters: width - the width of the scaled versionwhose status is to be checked. Parameters: height - the height of the scaled versionwhose status is to be checked. Parameters: observer - the ImageObserver objectto be notified as the image is being prepared. the bitwise inclusive OR ofImageObserver flags indicating whatinformation about the image is currently available. See Also: java.awt.Component.prepareImage(java.awt.Imageintintjava.awt.image.ImageObserver) See Also: java.awt.Toolkit.checkImage(java.awt.Imageintintjava.awt.image.ImageObserver) See Also: java.awt.image.ImageObserver since: JDK1.0 |
constructComponentName | String constructComponentName()(Code) | | Construct a name for this component. Called by getName() when the
name is null.
|
contains | public boolean contains(int x, int y)(Code) | | Checks whether this component "contains" the specified point,
where x and y are defined to be
relative to the coordinate system of this component.
Parameters: x - the x coordinate of the point. Parameters: y - the y coordinate of the point. See Also: java.awt.Component.getComponentAt(intint) since: JDK1.1 |
contains | public boolean contains(Point p)(Code) | | Checks whether this component "contains" the specified point,
where the point's x and y coordinates are defined
to be relative to the coordinate system of this component.
Parameters: p - the point. See Also: java.awt.Component.getComponentAt(java.awt.Point) since: JDK1.1 |
createImage | public Image createImage(ImageProducer producer)(Code) | | Creates an image from the specified image producer.
Parameters: producer - the image producer the image produced. since: JDK1.0 |
createImage | public Image createImage(int width, int height)(Code) | | Creates an off-screen drawable image
to be used for double buffering.
Parameters: width - the specified width. Parameters: height - the specified height. an off-screen drawable image,which can be used for double buffering. since: JDK1.0 |
disable | public void disable()(Code) | | |
disableEvents | final protected void disableEvents(long eventsToDisable)(Code) | | Disables the events defined by the specified event mask parameter
from being delivered to this component.
Parameters: eventsToDisable - the event mask defining the event types See Also: java.awt.Component.enableEvents since: JDK1.1 |
dispatchEvent | final public void dispatchEvent(AWTEvent e)(Code) | | Dispatches an event to this component or one of its sub components.
Parameters: e - the event |
doLayout | public void doLayout()(Code) | | Prompts the layout manager to lay out this component. This is
usually called when the component (more specifically, container)
is validated.
See Also: Component.validate See Also: LayoutManager |
enable | public void enable()(Code) | | |
enable | public void enable(boolean b)(Code) | | |
enableEvents | final protected synchronized void enableEvents(long eventsToEnable)(Code) | | Enables the events defined by the specified event mask parameter
to be delivered to this component.
Event types are automatically enabled when a listener for
that event type is added to the component.
This method only needs to be invoked by subclasses of
Component which desire to have the specified event
types delivered to processEvent regardless of whether
or not a listener is registered.
Parameters: eventsToEnable - the event mask defining the event types. See Also: java.awt.Component.processEvent See Also: java.awt.Component.disableEvents since: JDK1.1 |
findFocusDelegate | Component findFocusDelegate(Container container)(Code) | | Recursively looks for the first component in container that is focus traversable.
|
getAlignmentX | public float getAlignmentX()(Code) | | Returns the alignment along the x axis. This specifies how
the component would like to be aligned relative to other
components. The value should be a number between 0 and 1
where 0 represents alignment along the origin, 1 is aligned
the furthest away from the origin, 0.5 is centered, etc.
|
getAlignmentY | public float getAlignmentY()(Code) | | Returns the alignment along the y axis. This specifies how
the component would like to be aligned relative to other
components. The value should be a number between 0 and 1
where 0 represents alignment along the origin, 1 is aligned
the furthest away from the origin, 0.5 is centered, etc.
|
getBackground | public Color getBackground()(Code) | | Gets the background color of this component.
This component's background color. If this component doesnot have a background color, the background color of its parentis returned. See Also: java.awt.Component.setBackground(java.awt.Color) since: JDK1.0 |
getComponentAt | public Component getComponentAt(int x, int y)(Code) | | Determines if this component or one of its immediate
subcomponents contains the (x, y) location,
and if so, returns the containing component. This method only
looks one level deep. If the point (x, y) is
inside a subcomponent that itself has subcomponents, it does not
go looking down the subcomponent tree.
The locate method of Component simply
returns the component itself if the (x, y)
coordinate location is inside its bounding box, and null
otherwise.
Parameters: x - the x coordinate. Parameters: y - the y coordinate. the component or subcomponent that contains the(x, y) location;null if the locationis outside this component. See Also: java.awt.Component.contains(intint) since: JDK1.0 |
getCursor | public Cursor getCursor()(Code) | | Gets this component's cursor image.
Compatibility
If setCursor is not always ignored, getCursor() must provide a
cursor that will not be ignored when setCursor is called so that an
application may restore the cursor after setting it.
The cursor for this component. See Also: java.awt.Component.setCursor See Also: java.awt.Cursor since: JDK1.1 |
getFocusDelegate | Component getFocusDelegate()(Code) | | Gets the component to which key events should be deleagted to when this component
has the focus.
|
getFont | public Font getFont()(Code) | | Gets the font of this component.
This component's font. If a font has not been setfor this component, the font of its parent is returned. See Also: Component.setFont since: JDK1.0 |
getFontAndColorDelegate | Component getFontAndColorDelegate()(Code) | | Gets the component used to delegate setFont, setBackground, setForeground to.
|
getForeground | public Color getForeground()(Code) | | Gets the foreground color of this component.
This component's foreground color. If this component doesnot have a foreground color, the foreground color of its parentis returned. See Also: Component.setForeground(java.awt.Color) since: JDK1.0 |
getGraphics | public Graphics getGraphics()(Code) | | Creates a graphics context for this component. This method will
return null if this component is currently not on
the screen.
A graphics context for this component, or null if it has none. See Also: java.awt.Component.paint since: JDK1.0 |
getInputContext | InputContext getInputContext()(Code) | | Gets the input context used by this component for handling the communication
with input methods when text is entered in this component. By default, the
input context used for the parent component is returned. Components may
override this to return a private input context.
The input context used by this component. Null if no context canbe determined. |
getLocale | public Locale getLocale()(Code) | | Gets the locale of this component.
This component's locale. If this component does nothave a locale, the locale of its parent is returned. See Also: Component.setLocale exception: IllegalComponentStateException - If the Componentdoes not have its own locale and has not yet been added toa containment hierarchy such that the locale can be determinedfrom the containing parent. since: JDK1.1 |
getLocation | public Point getLocation()(Code) | | Gets the location of this component in the form of a
point specifying the component's top-left corner.
The location will be relative to the parent's coordinate space.
An instance of Point representingthe top-left corner of the component's bounds in the coordinatespace of the component's parent. See Also: Component.setLocation See Also: Component.getLocationOnScreen since: JDK1.1 |
getLocationOnScreen | public Point getLocationOnScreen()(Code) | | Gets the location of this component in the form of a point
specifying the component's top-left corner in the screen's
coordinate space.
An instance of Point representingthe top-left corner of the component's bounds in thecoordinate space of the screen. See Also: Component.setLocation See Also: Component.getLocation |
getParent | public Container getParent()(Code) | | Gets the parent of this component.
The parent container of this component. since: JDK1.0 |
getSize | public Dimension getSize()(Code) | | Returns the size of this component in the form of a
Dimension object. The height
field of the Dimension object contains
this component's height, and the width
field of the Dimension object contains
this component's width.
A Dimension object that indicates thesize of this component. See Also: Component.setSize since: JDK1.1 |
getToolkit | public Toolkit getToolkit()(Code) | | Gets this component's toolkit.
Note that the frame that contains a component controls which
toolkit is used by that component. Therefore if the component
is moved from one frame to another, the toolkit it uses may change.
Compatibility
Personal Profile does not require that an AWT implementation use the
peer interfaces, so many methods in the toolkit may throw an
UnsupportedOperationException.
The toolkit of this component. See Also: Component.getPeer See Also: java.awt.Toolkit since: JDK1.0 |
getTreeLock | final public Object getTreeLock()(Code) | | Gets this component's locking object (the object that owns the thread
sychronization monitor) for AWT component-tree and layout
operations.
This component's locking object. |
imageUpdate | public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h)(Code) | | Repaints the component when the image has changed.
This imageUpdate method of an ImageObserver
is called when more information about an
image which had been previously requested using an asynchronous
routine such as the drawImage method of
Graphics becomes available.
See the definition of imageUpdate for
more information on this method and its arguments.
The imageUpdate method of Component
incrementally draws an image on the component as more of the bits
of the image are available.
If the system property awt.image.incrementalDraw
is missing or has the value true , the image is
incrementally drawn, If the system property has any other value,
then the image is not drawn until it has been completely loaded.
Also, if incremental drawing is in effect, the value of the
system property awt.image.redrawrate is interpreted
as an integer to give the maximum redraw rate, in milliseconds. If
the system property is missing or cannot be interpreted as an
integer, the redraw rate is once every 100ms.
The interpretation of the x , y ,
width , and height arguments depends on
the value of the infoflags argument.
Parameters: img - the image being observed. Parameters: infoflags - see imageUpdate for more information. Parameters: x - the x coordinate. Parameters: y - the y coordinate. Parameters: width - the width. Parameters: height - the height. true if the flags indicate that theimage is completely loaded;false otherwise. See Also: java.awt.image.ImageObserver See Also: java.awt.Graphics.drawImage(java.awt.Imageintintjava.awt.Colorjava.awt.image.ImageObserver) See Also: java.awt.Graphics.drawImage(java.awt.Imageintintjava.awt.image.ImageObserver) See Also: java.awt.Graphics.drawImage(java.awt.Imageintintintintjava.awt.Colorjava.awt.image.ImageObserver) See Also: java.awt.Graphics.drawImage(java.awt.Imageintintintintjava.awt.image.ImageObserver) See Also: java.awt.image.ImageObserver.imageUpdate(java.awt.Imageintintintintint) since: JDK1.0 |
inside | public boolean inside(int x, int y)(Code) | | |
invokeAndWait | static void invokeAndWait(Runnable runnable)(Code) | | Invokes the supplied Runnable's run method on the event dispatch thread. This is slightly
different from the EventQueue.invokeAndWait because it can be called from any thread whereas
EventQueue.invokeAndWait cannot be called from the event dispatch thread. If called from the
event dispatch thread the run method will be run immediately. Also, any exceptions thrown are
caught. This method is convienient if you need to invoke code on a delegate component that is
not thread safe (e.g. Swing components).
|
isDisplayable | public boolean isDisplayable()(Code) | | |
isEnabled | public boolean isEnabled()(Code) | | Determines whether this component is enabled. An enabled component
can respond to user input and generate events. Components are
enabled initially by default. A component may be enabled or disabled by
calling its setEnabled method.
true if the component is enabled;false otherwise. See Also: Component.setEnabled since: JDK1.0 |
isFocusTraversable | public boolean isFocusTraversable()(Code) | | Returns the value of a flag that indicates whether
this component can be traversed using
Tab or Shift-Tab keyboard focus traversal. If this method
returns "false", this component may still request the keyboard
focus using requestFocus() , but it will not automatically
be assigned focus during tab traversal.
true if this component isfocus-traverable; false otherwise. since: JDK1.1 |
isLightweight | public boolean isLightweight()(Code) | | |
isLightweightWhenDisplayable | boolean isLightweightWhenDisplayable()(Code) | | Returns whether this component is lightweight. This method exists because
isLightweight is defined to return false when this component is not displayable.
This allows us to determine if this component is really lightweight, regardless
of whether it is displayable or not.
|
isOpaque | public boolean isOpaque()(Code) | | Returns true if this component is completely opaque, returns
false by default.
An opaque component paints every pixel within its
rectangular region. A non-opaque component paints only some of
its pixels, allowing the pixels underneath it to "show through".
A component that does not fully paint its pixels therefore
provides a degree of transparency. Only lightweight
components can be transparent.
Subclasses that guarantee to always completely paint their
contents should override this method and return true. All
of the "heavyweight" AWT components are opaque.
true if this component is completely opaque. See Also: Component.isLightweight since: 1.2 |
isShowing | public boolean isShowing()(Code) | | Determines whether this component is showing on screen. This means
that the component must be visible, and it must be in a container
that is visible and showing.
true if the component is showing;false otherwise. See Also: Component.setVisible since: JDK1.0 |
isValid | public boolean isValid()(Code) | | Determines whether this component is valid. Components are
invalidated when they are first shown on the screen.
true if the component is valid; false otherwise. See Also: Component.validate See Also: Component.invalidate since: JDK1.0 |
isVisible | public boolean isVisible()(Code) | | Determines whether this component is visible. Components are
initially visible, with the exception of top level components such
as Frame objects.
true if the component is visible;false otherwise. See Also: Component.setVisible since: JDK1.0 |
keyDown | public boolean keyDown(Event evt, int key)(Code) | | |
layout | public void layout()(Code) | | |
lightweightPrint | void lightweightPrint(Graphics g)(Code) | | Simulates the peer callbacks into java.awt for printing of
lightweight Components.
Parameters: g - the graphics context to use for printing. See Also: Component.printAll |
list | public void list()(Code) | | Prints a listing of this component to the standard system output
stream System.out .
See Also: java.lang.System.out since: JDK1.0 |
list | public void list(PrintStream out)(Code) | | Prints a listing of this component to the specified output
stream.
Parameters: out - a print stream. since: JDK1.0 |
list | public void list(PrintWriter out)(Code) | | Prints a listing to the specified print writer.
Parameters: out - The print writer to print to. since: JDK1.1 |
list | public void list(PrintWriter out, int indent)(Code) | | Prints out a list, starting at the specified indention, to
the specified print writer.
Parameters: out - The print writer to print to. Parameters: indent - The number of spaces to indent. See Also: java.io.PrintStream.println(java.lang.Object) since: JDK1.1 |
mouseDown | public boolean mouseDown(Event evt, int x, int y)(Code) | | |
mouseDrag | public boolean mouseDrag(Event evt, int x, int y)(Code) | | |
mouseEnter | public boolean mouseEnter(Event evt, int x, int y)(Code) | | |
mouseExit | public boolean mouseExit(Event evt, int x, int y)(Code) | | |
mouseMove | public boolean mouseMove(Event evt, int x, int y)(Code) | | |
mouseUp | public boolean mouseUp(Event evt, int x, int y)(Code) | | |
move | public void move(int x, int y)(Code) | | |
nextFocus | public void nextFocus()(Code) | | |
paint | public void paint(Graphics g)(Code) | | Paints this component. This method is called when the contents
of the component should be painted in response to the component
first being shown or damage needing repair. The clip rectangle
in the Graphics parameter will be set to the area which needs
to be painted.
g The graphics context to use for painting. See Also: java.awt.Component.update since: JDK1.0 |
paintAll | public void paintAll(Graphics g)(Code) | | Paints this component and all of its subcomponents.
The origin of the graphics context, its
(0 , 0 ) coordinate point, is the
top-left corner of this component. The clipping region of the
graphics context is the bounding rectangle of this component.
Parameters: g - the graphics context to use for painting. See Also: java.awt.Component.paint since: JDK1.0 |
paramString | protected String paramString()(Code) | | Returns the parameter string representing the state of this
component. This string is useful for debugging.
the parameter string of this component. since: JDK1.0 |
prepareImage | public boolean prepareImage(Image image, ImageObserver observer)(Code) | | Prepares an image for rendering on this component. The image
data is downloaded asynchronously in another thread and the
appropriate screen representation of the image is generated.
Parameters: image - the Image for which toprepare a screen representation. Parameters: observer - the ImageObserver objectto be notified as the image is being prepared. true if the image has already been fully prepared;false otherwise. since: JDK1.0 |
prepareImage | public boolean prepareImage(Image image, int width, int height, ImageObserver observer)(Code) | | Prepares an image for rendering on this component at the
specified width and height.
The image data is downloaded asynchronously in another thread,
and an appropriately scaled screen representation of the image is
generated.
Parameters: image - the instance of Image for which to prepare a screen representation. Parameters: width - the width of the desired screen representation. Parameters: height - the height of the desired screen representation. Parameters: observer - the ImageObserver objectto be notified as the image is being prepared. true if the image has already been fully prepared;false otherwise. See Also: java.awt.image.ImageObserver since: JDK1.0 |
print | public void print(Graphics g)(Code) | | Prints this component. Applications should override this method
for components that must do special processing before being
printed or should be printed differently than they are painted.
The default implementation of this method calls the
paint method.
The origin of the graphics context, its
(0 , 0 ) coordinate point, is the
top-left corner of this component. The clipping region of the
graphics context is the bounding rectangle of this component.
Parameters: g - the graphics context to use for printing. See Also: java.awt.Component.paint(java.awt.Graphics) since: JDK1.0 |
printAll | public void printAll(Graphics g)(Code) | | Prints this component and all of its subcomponents.
The origin of the graphics context, its
(0 , 0 ) coordinate point, is the
top-left corner of this component. The clipping region of the
graphics context is the bounding rectangle of this component.
Parameters: g - the graphics context to use for printing. See Also: java.awt.Component.print(java.awt.Graphics) since: JDK1.0 |
removeNotify | public void removeNotify()(Code) | | Notifies this component that it has been removed from its
container and if a peers exists, it destroys it.
This method should be called by Container.remove ,
and not by user code directly.
See Also: Component.addNotify |
repaint | public void repaint(int x, int y, int width, int height)(Code) | | Repaints the specified rectangle of this component.
This method causes a call to this component's update
method as soon as possible.
Parameters: x - the x coordinate. Parameters: y - the y coordinate. Parameters: width - the width. Parameters: height - the height. See Also: java.awt.Component.update(java.awt.Graphics) since: JDK1.0 |
repaint | public void repaint(long tm, int x, int y, int width, int height)(Code) | | Repaints the specified rectangle of this component within
tm milliseconds.
This method causes a call to this component's
update method.
Parameters: tm - maximum time in milliseconds before update. Parameters: x - the x coordinate. Parameters: y - the y coordinate. Parameters: width - the width. Parameters: height - the height. See Also: java.awt.Component.update(java.awt.Graphics) since: JDK1.0 |
reshape | public void reshape(int x, int y, int width, int height)(Code) | | |
resize | public void resize(int width, int height)(Code) | | |
setBackground | public void setBackground(Color c)(Code) | | Sets the background color of this component.
c The color to become this component'sbackground color. See Also: Component.getBackground since: JDK1.0 |
setCursor | public synchronized void setCursor(Cursor cursor)(Code) | | Sets this components cursor image.
Compatibility
In PersonalJava and PersonalProfile, if the underlying platform does
not support cursors or has limited cursor support, the setCursor method
can be ignored.
If the setCuror method ignores some, but not all cursors, it is important
that getCursor() returns a cursor that will not be ignored so that an
application can restore the cursor accordingly.
cursor the non-null cursor image. See Also: java.awt.Component.getCursor See Also: java.awt.Cursor since: JDK1.1 |
setEnabled | public void setEnabled(boolean b)(Code) | | Enables or disables this component, depending on the value of the
parameter b . An enabled component can respond to user
input and generate events. Components are enabled initially by default.
b If true , this component isenabled; otherwise this component is disabled. See Also: Component.isEnabled since: JDK1.1 |
setFont | public void setFont(Font f)(Code) | | Sets the font of this component.
f The font to become this component's font. See Also: Component.getFont since: JDK1.0 |
setForeground | public void setForeground(Color c)(Code) | | Sets the foreground color of this component.
c The color to become this component'sforeground color. See Also: Component.getForeground since: JDK1.0 |
setLocale | public void setLocale(Locale l)(Code) | | Sets the locale of this component.
l The locale to become this component's locale. See Also: Component.getLocale since: JDK1.1 |
setLocation | public void setLocation(int x, int y)(Code) | | Moves this component to a new location. The top-left corner of
the new location is specified by the x and y
parameters in the coordinate space of this component's parent.
x The x-coordinate of the new location'stop-left corner in the parent's coordinate space. y The y-coordinate of the new location'stop-left corner in the parent's coordinate space. See Also: Component.getLocation See Also: Component.setBounds since: JDK1.1 |
setLocation | public void setLocation(Point p)(Code) | | Moves this component to a new location. The top-left corner of
the new location is specified by point p . Point
p is given in the parent's coordinate space.
p The point defining the top-left cornerof the new location, given in the coordinate space of thiscomponent's parent. See Also: Component.getLocation See Also: Component.setBounds since: JDK1.1 |
setName | public void setName(String name)(Code) | | Sets the name of the component to the specified string.
name The string that is to be thiscomponent's name. See Also: Component.getName since: JDK1.1 |
setSize | public void setSize(int width, int height)(Code) | | Resizes this component so that it has width width
and height .
width The new width of this component in pixels. height The new height of this component in pixels. See Also: Component.getSize See Also: Component.setBounds since: JDK1.1 |
setVisible | public void setVisible(boolean b)(Code) | | Shows or hides this component depending on the value of parameter
b .
b If true , shows this component;otherwise, hides this component. See Also: Component.isVisible since: JDK1.1 |
show | public void show(boolean b)(Code) | | |
toString | public String toString()(Code) | | Returns a string representation of this component and its values.
a string representation of this component. since: JDK1.0 |
update | public void update(Graphics g)(Code) | | Updates this component.
The AWT calls the update method in response to a
call to repaintupdate or paint . You can assume that
the background is not cleared.
The update method of Component
does the following:
- Clears this component by filling it
with the background color.
- Sets the color of the graphics context to be
the foreground color of this component.
- Calls this component's
paint
method to completely redraw this component.
The origin of the graphics context, its
(0 , 0 ) coordinate point, is the
top-left corner of this component. The clipping region of the
graphics context is the bounding rectangle of this component.
Parameters: g - the specified context to use for updating. See Also: java.awt.Component.paint See Also: java.awt.Component.repaint since: JDK1.0 |
|
|