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 window. On the contrary, a heavyweight
component is associated with a native window. The isLightweight()
method may be used to distinguish between the two kinds of the components.
Lightweight and heavyweight components may be mixed in a single component
hierarchy. However, for correct operating of such a mixed hierarchy of
components, the whole hierarchy must be valid. When the hierarchy gets
invalidated, like after changing the bounds of components, or
adding/removing components to/from containers, the whole hierarchy must be
validated afterwards by means of the Container#validate() method
invoked on the top-most invalid container of the hierarchy.
Serializable protocol will be saved when
the object is stored. If an AWT object has listeners that
aren't marked serializable, they will be dropped at
writeObject time. Developers will need, as always,
to consider the implications of making an object serializable.
One situation to watch out for is this:
import java.awt.*;
import java.awt.event.*;
import java.io.Serializable;
class MyApp implements ActionListener, Serializable
{
BigObjectThatShouldNotBeSerializedWithAButton bigOne;
Button aButton = new Button();
MyApp()
{
// Oops, now aButton has a listener with a reference
// to bigOne!
aButton.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
System.out.println("Hello There");
}
}
In this example, serializing aButton by itself
will cause MyApp and everything it refers to
to be serialized as well. The problem is that the listener
is serializable by coincidence, not by design. To separate
the decisions about MyApp and the
ActionListener being serializable one can use a
nested class, as in the following example:
import java.awt.*;
import java.awt.event.*;
import java.io.Serializable;
class MyApp implements java.io.Serializable
{
BigObjectThatShouldNotBeSerializedWithAButton bigOne;
Button aButton = new Button();
static class MyActionListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
System.out.println("Hello There");
}
}
MyApp()
{
aButton.addActionListener(new MyActionListener());
}
}
Note
For more information on the paint mechanisms utilized by AWT and Swing, including information on how to write the most efficient painting code, see Painting in AWT and Swing.
For details on the focus subsystem, see How to Use the Focus Subsystem, a section in The Java Tutorial, and the Focus Specification for more information.
| Modifier and Type | Class and Description |
|---|---|
| protected abstract class | Component.
Inner class of Component used to provide default support for accessibility. |
| pack-priv static class | |
| public static enum | Component.
Enumeration of the common ways the baseline of a component can change as the size changes. |
| protected class | Component.
Inner class for blitting offscreen surfaces to a component. |
| private class | Component.
Private class to perform sub-region blitting. |
| private static class | |
| protected class | Component.
Inner class for flipping buffers on a component. |
| private class | Component.
Private class to perform sub-region flipping. |
| private static class | Component.
This is a proxy capabilities class used when a FlipBufferStrategy is created instead of the requested Blit strategy. |
| private class | Component.
Inner class for flipping buffers on a component. |
| Modifier and Type | Field and Description |
|---|---|
| protected AccessibleContext | accessibleContext
The |
| pack-priv static final String | actionListenerK
Internal, constants for serialization |
| pack-priv static final String | |
| private boolean | |
| pack-priv Color | background
The background color for this component. |
| pack-priv transient boolean | |
| public static final float | BOTTOM_ALIGNMENT
Ease-of-use constant for |
| private int | |
| private transient BufferStrategy | bufferStrategy
A reference to a |
| public static final float | CENTER_ALIGNMENT
Ease-of-use constant for |
| private PropertyChangeSupport | changeSupport
If any |
| private static final Class | coalesceEventsParams
Parameter types of coalesceEvents(AWTEvent,AWTEVent). |
| private static final Map | coalesceMap
Weak map of known coalesceEvent overriders. |
| private transient boolean | |
| pack-priv transient ComponentListener | |
| pack-priv static final String | |
| pack-priv transient ComponentOrientation | componentOrientation
The orientation for this component. |
| private int | componentSerializedDataVersion
Component Serialized Data Version. |
| private transient Region | |
| pack-priv static final String | |
| pack-priv Cursor | cursor
The cursor displayed when pointer is over this component. |
| pack-priv DropTarget | dropTarget
The |
| pack-priv boolean | enabled
True when the object is enabled. |
| pack-priv transient EventQueueItem[] | |
| private static final PlatformLogger | |
| pack-priv long | eventMask
The |
| private static final int | |
| private static final int | |
| private static final int | |
| private boolean | focusable
Indicates whether this Component can be focused. |
| pack-priv transient FocusListener | |
| pack-priv static final String | |
| private static final PlatformLogger | |
| private static final String[] | |
| pack-priv Set | focusTraversalKeys
The focus traversal keys. |
| private boolean | focusTraversalKeysEnabled
Indicates whether focus traversal keys are enabled for this Component. |
| pack-priv volatile Font | font
The font used by this component. |
| pack-priv Color | foreground
The foreground color for this component. |
| private transient volatile GraphicsConfiguration | graphicsConfig
A reference to a |
| pack-priv int | height
The height of the component. |
| pack-priv transient HierarchyBoundsListener | |
| pack-priv static final String | |
| pack-priv transient HierarchyListener | |
| pack-priv static final String | |
| pack-priv boolean | ignoreRepaint
True when the object should ignore all repaint events. |
| pack-priv static int | |
| pack-priv transient InputMethodListener | |
| pack-priv static final String | |
| private transient boolean | |
| private int | isFocusTraversableOverridden
Tracks whether this Component is relying on default focus traversability. |
| pack-priv static boolean | isInc
Static properties for incremental drawing. |
| pack-priv boolean | |
| pack-priv static final String | |
| pack-priv transient KeyListener | |
| pack-priv static final String | |
| public static final float | LEFT_ALIGNMENT
Ease-of-use constant for |
| pack-priv Locale | locale
The locale for the component. |
| pack-priv static final Object | LOCK
The locking object for AWT component-tree and layout operations. |
| private static final PlatformLogger | |
| pack-priv Dimension | maxSize
Maximum size |
| pack-priv boolean | |
| pack-priv Dimension | minSize
Minimum size. |
| pack-priv boolean | |
| private transient Region | |
| private static final PlatformLogger | |
| pack-priv transient MouseListener | |
| pack-priv static final String | |
| pack-priv transient MouseMotionListener | |
| pack-priv static final String | |
| pack-priv transient MouseWheelListener | |
| pack-priv static final String | |
| private String | name
A component's name. |
| private boolean | nameExplicitlySet
A bool to determine whether the name has been set explicitly. |
| pack-priv boolean | newEventsOnly
|
| private transient Object | |
| pack-priv static final String | |
| pack-priv transient Container | parent
The parent of the object. |
| pack-priv transient volatile ComponentPeer | peer
The peer of the component. |
| pack-priv Font | |
| pack-priv Vector | |
| pack-priv Dimension | prefSize
Preferred size. |
| pack-priv boolean | |
| private static RequestFocusController | |
| public static final float | RIGHT_ALIGNMENT
Ease-of-use constant for |
| private static final long | serialVersionUID
Use serialVersionUID from JDK 1.1 for interoperability. |
| pack-priv static final String | |
| public static final float | TOP_ALIGNMENT
Ease-of-use constant for |
| private volatile boolean | valid
True when the object is valid. |
| pack-priv boolean | visible
True when the object is visible. |
| pack-priv int | width
The width of the component. |
| pack-priv static final String | |
| pack-priv static final String | |
| pack-priv static final String | |
| pack-priv int | x
The x position of the component in the parent's coordinate system. |
| pack-priv int | y
The y position of the component in the parent's coordinate system. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public void | |
| public synchronized void | addComponentListener(ComponentListener
the component listener l)Adds the specified component listener to receive component events from this component. |
| public synchronized void | addFocusListener(FocusListener
the focus listener l)Adds the specified focus listener to receive focus events from this component when this component gains input focus. |
| public void | addHierarchyBoundsListener(HierarchyBoundsListener
the hierarchy bounds listener l)Adds the specified hierarchy bounds listener to receive hierarchy bounds events from this component when the hierarchy to which this container belongs changes. |
| public void | addHierarchyListener(HierarchyListener
the hierarchy listener l)Adds the specified hierarchy listener to receive hierarchy changed events from this component when the hierarchy to which this container belongs changes. |
| public synchronized void | addInputMethodListener(InputMethodListener
the input method listener l)Adds the specified input method listener to receive input method events from this component. |
| public synchronized void | addKeyListener(KeyListener
the key listener. l)Adds the specified key listener to receive key events from this component. |
| public synchronized void | addMouseListener(MouseListener
the mouse listener l)Adds the specified mouse listener to receive mouse events from this component. |
| public synchronized void | addMouseMotionListener(MouseMotionListener
the mouse motion listener l)Adds the specified mouse motion listener to receive mouse motion events from this component. |
| public synchronized void | addMouseWheelListener(MouseWheelListener
the mouse wheel listener l)Adds the specified mouse wheel listener to receive mouse wheel events from this component. |
| public void | |
| public void | addPropertyChangeListener(PropertyChangeListener
the property change listener to be added listener)Adds a PropertyChangeListener to the listener list. |
| public void | addPropertyChangeListener(String
one of the property names listed above propertyName, PropertyChangeListener the property change listener to be added listener)Adds a PropertyChangeListener to the listener list for a specific property. |
| pack-priv void | |
| public void | applyComponentOrientation(ComponentOrientation
the new component orientation of this component and
the components contained within it. orientation)Sets the |
| pack-priv void | applyCompoundShape(Region
Shape to be applied to the component shape)Applies the shape to the component |
| pack-priv void | |
| private void | |
| pack-priv final boolean | |
| public boolean | Returns: true if the Set of focus traversal keys for the
given focus traversal operation has been explicitly defined for
this Component; false otherwise.one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or
KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS id)Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Component. |
| pack-priv boolean | |
| pack-priv void | |
| public Rectangle | Returns: the bounding rectangle for this component
Deprecated
As of JDK version 1.1,
replaced by
getBounds().
Returns the bounding rectangle of this component. |
| private Region | |
| pack-priv final boolean | |
| pack-priv final boolean | canBeFocusOwnerRecursively()
Checks that this component meets the prerequisites to be focus owner: - it is enabled, visible, focusable - it's parents are all enabled and showing - top-level window is focusable - if focus cycle root has DefaultFocusTraversalPolicy then it also checks that this policy accepts this component as focus owner |
| private boolean | |
| pack-priv void | |
| public int | Returns: the bitwise inclusive OR ofImageObserver flags indicating what
information about the image is currently availablethe image, ImageObserver Image object whose status
is being checkedthe observer)ImageObserver
object to be notified as the image is being preparedReturns the status of the construction of a screen representation of the specified image. |
| public int | Returns: the bitwise inclusive OR ofImageObserver flags indicating what
information about the image is currently availablethe image, int Image object whose status
is being checkedthe width of the scaled version
whose status is to be checked width, int the height of the scaled version
whose status is to be checked height, ImageObserver the observer)ImageObserver object
to be notified as the image is being preparedReturns the status of the construction of a screen representation of the specified image. |
| pack-priv final void | |
| pack-priv void | |
| pack-priv void | |
| protected AWTEvent | Returns: a coalesced event, ornull indicating that no
coalescing was donethe event already on the existingEvent, AWTEvent EventQueuethe event being posted to the
newEvent)EventQueuePotentially coalesce an event being posted with an existing event. |
| pack-priv String | |
| public boolean | Returns: true if the point is within the component;
otherwise falsethe x coordinate of the point x, int the y coordinate of the point y)Checks whether this component "contains" the specified point,
where |
| public boolean | |
| pack-priv boolean | |
| pack-priv int | |
| pack-priv void | createBufferStrategy(int
number of buffers to create, including the front buffer numBuffers)Creates a new strategy for multi-buffering on this component. |
| pack-priv void | createBufferStrategy(int
number of buffers to create numBuffers, BufferCapabilities the required capabilities for creating the buffer strategy;
cannot be caps)nullCreates a new strategy for multi-buffering on this component with the required buffer capabilities. |
| pack-priv int | createHierarchyEvents(int id, Component changed, Container changedParent, long changeFlags, boolean enabledOnToolkit)
|
| public Image | Returns: the image producedthe image producer producer)Creates an image from the specified image producer. |
| public Image | Returns: an off-screen drawable image, which can be used for double buffering. Thenull value if the component is not
displayable or GraphicsEnvironment.isHeadless() returns
true.the specified width width, int the specified height height)Creates an off-screen drawable image to be used for double buffering. |
| public VolatileImage | Returns: an off-screen drawable image, which can be used for double buffering. Thenull value if the component is not
displayable or GraphicsEnvironment.isHeadless() returns
true.the specified width width, int the specified height height)Creates a volatile off-screen drawable image to be used for double buffering. |
| public VolatileImage | Returns: a VolatileImage object, which can be used to manage surface contents loss and capabilities. Thenull value if the
component is not displayable or
GraphicsEnvironment.isHeadless() returns true.the specified width width, int the specified height height, ImageCapabilities the image capabilities caps)Creates a volatile off-screen drawable image, with the given capabilities. |
| public void | deliverEvent(Event
the event to deliver e)
Deprecated
As of JDK version 1.1,
replaced by
dispatchEvent(AWTEvent e).
|
| public void | |
| protected final void | disableEvents(long
the event mask defining the event types eventsToDisable)Disables the events defined by the specified event mask parameter from being delivered to this component. |
| public final void | dispatchEvent(AWTEvent
the event e)Dispatches an event to this component or one of its sub components. |
| pack-priv void | |
| pack-priv boolean | |
| public void | |
| private void | |
| public void | |
| public void | enable(boolean
true to enable this component;
otherwise false
Deprecated
As of JDK version 1.1,
replaced by
setEnabled(boolean).
Enables or disables this component. |
| protected final void | enableEvents(long
the event mask defining the event types eventsToEnable)Enables the events defined by the specified event mask parameter to be delivered to this component. |
| public void | enableInputMethods(boolean
true to enable, false to disable enable)Enables or disables input method support for this component. |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv Component | findUnderMouseInWindow(PointerInfo pi)
Assuming that mouse location is stored in PointerInfo passed to this method, it finds a Component that is in the same Window as this Component and is located under the mouse pointer. |
| protected void | firePropertyChange(String
the property whose value has changed propertyName, Object the property's previous value oldValue, Object the property's new value newValue)Support for reporting bound property changes for Object properties. |
| protected void | firePropertyChange(String
the property whose value has changed propertyName, boolean the property's previous value oldValue, boolean the property's new value newValue)Support for reporting bound property changes for boolean properties. |
| protected void | firePropertyChange(String
the property whose value has changed propertyName, int the property's previous value oldValue, int the property's new value newValue)Support for reporting bound property changes for integer properties. |
| public void | firePropertyChange(String
the programmatic name of the property
that was changed propertyName, byte the old value of the property (as a byte) oldValue, byte the new value of the property (as a byte) newValue)Reports a bound property change. |
| public void | firePropertyChange(String
the programmatic name of the property
that was changed propertyName, char the old value of the property (as a char) oldValue, char the new value of the property (as a char) newValue)Reports a bound property change. |
| public void | firePropertyChange(String
the programmatic name of the property
that was changed propertyName, short the old value of the property (as a short) oldValue, short the new value of the property (as a short) newValue)Reports a bound property change. |
| public void | firePropertyChange(String
the programmatic name of the property
that was changed propertyName, long the old value of the property (as a long) oldValue, long the new value of the property (as a long) newValue)Reports a bound property change. |
| public void | firePropertyChange(String
the programmatic name of the property
that was changed propertyName, float the old value of the property (as a float) oldValue, float the new value of the property (as a float) newValue)Reports a bound property change. |
| public void | firePropertyChange(String
the programmatic name of the property
that was changed propertyName, double the old value of the property (as a double) oldValue, double the new value of the property (as a double) newValue)Reports a bound property change. |
| public AccessibleContext | Returns: theAccessibleContext of this
ComponentGets the |
| pack-priv int | Returns: the index of this object in its accessible parentGets the index of this object in its accessible parent. |
| pack-priv AccessibleStateSet | Returns: an instance ofAccessibleStateSet
containing the current state set of the objectGets the current state set of this object. |
| public float | Returns: the horizontal alignment of this componentReturns the alignment along the x axis. |
| public float | Returns: the vertical alignment of this componentReturns the alignment along the y axis. |
| private Region | |
| pack-priv Image | |
| public Color | Returns: this component's background color; if this component does not have a background color, the background color of its parent is returnedGets the background color of this component. |
| public int | Returns: the baseline or < 0 indicating there is no reasonable baselinethe width to get the baseline for width, int the height to get the baseline for height)Returns the baseline. |
| public Component. | Returns: an enum indicating how the baseline changes as the component size changesReturns an enum indicating how the baseline of the component changes as the size changes. |
| public Rectangle | Returns: a rectangle indicating this component's boundsGets the bounds of this component in the form of a
|
| public Rectangle | |
| pack-priv int | getBoundsOp()
Should only be used in subclass getBounds to check that part of bounds is actually changing |
| pack-priv BufferStrategy | |
| public ColorModel | Returns: the color model used by this componentGets the instance of |
| public Component | Returns: the component or subcomponent that contains the (x, y) location;null if the location
is outside this componentthe x coordinate x, int the y coordinate 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 | Returns: the component at the specified location ornullthe point p)Returns the component or subcomponent that contains the specified point. |
| pack-priv final ComponentFactory | |
| public synchronized ComponentListener[] | Returns: allComponentListeners of this component
or an empty array if no component
listeners are currently registeredReturns an array of all the component listeners registered on this component. |
| public ComponentOrientation | Returns: the orientation to order the elements or textRetrieves the language-sensitive orientation that is to be used to order the elements or text within this component. |
| pack-priv Container | |
| pack-priv Window | Returns: Window ancestor of the component or component by itself if it is Window; null, if component is not a part of window hierarchyReturns the |
| public Cursor | |
| pack-priv final Cursor | |
| public synchronized DropTarget | |
| public Container | Returns: this Component's nearest focus-cycle-root ancestorReturns the Container which is the focus cycle root of this Component's focus traversal cycle. |
| public synchronized FocusListener[] | Returns: all of this component'sFocusListeners
or an empty array if no component
listeners are currently registeredReturns an array of all the focus listeners registered on this component. |
| public Set | Returns: the Set of AWTKeyStrokes for the specified operation. The Set will be unmodifiable, and may be empty. null will never be returned.one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or
KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS id)Returns the Set of focus traversal keys for a given traversal operation for this Component. |
| pack-priv final Set | |
| public boolean | Returns: whether focus traversal keys are enabled for this ComponentReturns whether focus traversal keys are enabled for this Component. |
| public Font | Returns: this component's font; if a font has not been set for this component, the font of its parent is returnedImplements java. Gets the font of this component. |
| pack-priv final Font | |
| public FontMetrics | Returns: the font metrics forfontthe font for which font metrics is to be
obtained font)Gets the font metrics for the specified font. |
| public Color | Returns: this component's foreground color; if this component does not have a foreground color, the foreground color of its parent is returnedGets the foreground color of this component. |
| public Graphics | Returns: a graphics context for this component, ornull
if it has noneCreates a graphics context for this component. |
| pack-priv final Graphics | |
| public GraphicsConfiguration | Returns: theGraphicsConfiguration used by this
Component or nullGets the |
| pack-priv final GraphicsConfiguration | |
| public int | Returns: the current height of this componentReturns the current height of this component. |
| public synchronized HierarchyBoundsListener[] | Returns: all of this component'sHierarchyBoundsListeners
or an empty array if no hierarchy bounds
listeners are currently registeredReturns an array of all the hierarchy bounds listeners registered on this component. |
| public synchronized HierarchyListener[] | Returns: all of this component'sHierarchyListeners
or an empty array if no hierarchy
listeners are currently registeredReturns an array of all the hierarchy listeners registered on this component. |
| pack-priv final ComponentPeer | |
| public boolean | Returns: whether or not paint messages received from the operating system should be ignoredReturns whether or not paint messages received from the operating system should be ignored. |
| public InputContext | Returns: the input context used by this component;null if no context can be determinedGets the input context used by this component for handling the communication with input methods when text is entered in this component. |
| public synchronized InputMethodListener[] | Returns: all of this component'sInputMethodListeners
or an empty array if no input method
listeners are currently registeredReturns an array of all the input method listeners registered on this component. |
| public InputMethodRequests | Returns: the input method request handler for this component,null by defaultGets the input method request handler which supports requests from input methods for this component. |
| private Insets | |
| public synchronized KeyListener[] | Returns: all of this component'sKeyListeners
or an empty array if no key
listeners are currently registeredReturns an array of all the key listeners registered on this component. |
| public < the type of the listeners T extends EventListener> T[] | Returns: an array of all objects registered asFooListeners on this component,
or an empty array if no such listeners have been addedthe type of listeners requested; this parameter
should specify an interface that descends from
listenerType)java.util.EventListenerReturns an array of all the objects currently registered
as |
| public Locale | Returns: this component's locale; if this component does not have a locale, the locale of its parent is returnedGets the locale of this component. |
| public Point | Returns: an instance ofPoint representing
the top-left corner of the component's bounds in
the coordinate space of the component's parentGets the location of this component in the form of a point specifying the component's top-left corner. |
| public Point | Returns: rvthe return value, modified to the components location rv)Stores the x,y origin of this component into "return value" rv and return rv. |
| public Point | Returns: an instance ofPoint representing
the top-left corner of the component's bounds in the
coordinate space of the screenGets the location of this component in the form of a point specifying the component's top-left corner in the screen's coordinate space. |
| pack-priv final Point | |
| pack-priv Point | |
| public Dimension | Returns: a dimension object indicating this component's maximum sizeGets the maximum size of this component. |
| public Dimension | Returns: a dimension object indicating this component's minimum sizeGets the minimum size of this component. |
| public synchronized MouseListener[] | Returns: all of this component'sMouseListeners
or an empty array if no mouse
listeners are currently registeredReturns an array of all the mouse listeners registered on this component. |
| public synchronized MouseMotionListener[] | Returns: all of this component'sMouseMotionListeners
or an empty array if no mouse motion
listeners are currently registeredReturns an array of all the mouse motion listeners registered on this component. |
| public Point | Returns: mouse coordinates relative to thisComponent, or nullReturns the position of the mouse pointer in this |
| public synchronized MouseWheelListener[] | Returns: all of this component'sMouseWheelListeners
or an empty array if no mouse wheel
listeners are currently registeredReturns an array of all the mouse wheel listeners registered on this component. |
| public String | |
| pack-priv final Container | |
| pack-priv final Component | |
| pack-priv final Region | |
| pack-priv Object | |
| pack-priv Region | |
| public Container | |
| pack-priv final Container | |
| public Dimension | Returns: a dimension object indicating this component's preferred sizeGets the preferred size of this component. |
| public PropertyChangeListener[] | Returns: all of this component'sPropertyChangeListeners
or an empty array if no property change
listeners are currently registeredReturns an array of all the property change listeners registered on this component. |
| public PropertyChangeListener[] | Returns: all of thePropertyChangeListeners associated with
the named property; if no such listeners have been added or
if propertyName is null, an empty
array is returnedthe property name propertyName)Returns an array of all the listeners which have been associated with the named property. |
| private Rectangle | Returns: the visible part of boundsDetermines the bounds of a visible part of the component relative to its parent. |
| pack-priv final int | |
| pack-priv final int | |
| public Dimension | Returns: aDimension object that indicates the
size of this componentReturns the size of this component in the form of a
|
| public Dimension | |
| public Toolkit | |
| pack-priv final Toolkit | |
| pack-priv Container | |
| public final Object | Returns: this component's locking objectGets this component's locking object (the object that owns the thread synchronization monitor) for AWT component-tree and layout operations. |
| public int | |
| public int | Returns: the current x coordinate of the components originReturns the current x coordinate of the components origin. |
| public int | Returns: the current y coordinate of the components originReturns the current y coordinate of the components origin. |
| public boolean | |
| public boolean | handleEvent(Event
the event to handle evt)
Deprecated
As of JDK version 1.1
replaced by processEvent(AWTEvent).
Returns: |
| public boolean | Returns: true if this Component is the
focus owner; false otherwiseReturns |
| public void | |
| public boolean | Returns: false if the infoflags indicate that the
image is completely loaded; true otherwise.the image being observed img, int see infoflags, int imageUpdate for more informationthe x coordinate x, int the y coordinate y, int the width w, int the height h)Implements java. Repaints the component when the image has changed. |
| pack-priv void | |
| private static native void | |
| public boolean | Returns: true if the point is within the component;
otherwise falsethe x coordinate of the point x, int the y coordinate of the point y)
Deprecated
As of JDK version 1.1,
replaced by contains(int, int).
Checks whether the point is inside of this component. |
| public void | |
| pack-priv final void | |
| pack-priv void | |
| pack-priv boolean | |
| public boolean | Returns: true if the background color has been explicitly
set for this Component; false otherwise.Returns whether the background color has been explicitly set for this Component. |
| private static boolean | isCoalesceEventsOverriden(Class<?> clazz)
Indicates whether a class or its superclasses override coalesceEvents. |
| pack-priv final boolean | |
| public boolean | Returns: true if the cursor has been explicitly set for this
Component; false otherwise.Returns whether the cursor has been explicitly set for this Component. |
| public boolean | Returns: true if the component is displayable,
false otherwiseDetermines whether this component is displayable. |
| public boolean | Returns: false by defaultReturns true if this component is painted to an offscreen image ("buffer") that's copied to the screen later. |
| public boolean | Returns: true if the component is enabled,
false otherwiseDetermines whether this component is enabled. |
| pack-priv final boolean | |
| public boolean | Returns: true if this Component is focusable;
false otherwise.Returns whether this Component can be focused. |
| public boolean | Returns: true if the specified Container is a focus-cycle-
root of this Component; false otherwisethe Container to be tested container)Returns whether the specified Container is the focus cycle root of this Component's focus traversal cycle. |
| public boolean | Returns: true if this Component is the
focus owner; false otherwiseReturns |
| public boolean | Returns: true if this Component is
focusable; false otherwise
Deprecated
As of 1.4, replaced by
isFocusable().
Returns whether this |
| pack-priv final boolean | |
| public boolean | Returns: true if the font has been explicitly set for this
Component; false otherwise.Returns whether the font has been explicitly set for this Component. |
| public boolean | Returns: true if the foreground color has been explicitly
set for this Component; false otherwise.Returns whether the foreground color has been explicitly set for this Component. |
| pack-priv static boolean | Returns: true, if this object is instanceof given class, false, otherwise, or if obj or className is nullObject to be checked obj, String The name of the class. Must be fully-qualified class name. className)Checks that the given object is instance of the given class. |
| public boolean | Returns: true if this component has a lightweight peer; false if it has a native peer or no peerA lightweight component doesn't have a native toolkit peer. |
| public boolean | Returns: true ifmaximumSize is non-null,
false otherwiseReturns true if the maximum size has been set to a non- |
| public boolean | Returns: true ifsetMinimumSize has been invoked with a
non-null value.Returns whether or not |
| pack-priv final boolean | |
| pack-priv final boolean | |
| public boolean | Returns: true if this component is completely opaqueReturns true if this component is completely opaque, returns false by default. |
| public boolean | Returns: true ifsetPreferredSize has been invoked
with a non-null value.Returns true if the preferred size has been set to a
non- |
| pack-priv boolean | Returns: true if the component and all of its ancestors
until a toplevel window or null parent are visible,
false otherwiseDetermines whether this component will be displayed on the screen. |
| private boolean | isRequestFocusAccepted(boolean temporary, boolean focusedWindowChangeAllowed, FocusEvent.
|
| pack-priv boolean | |
| public boolean | Returns: true if the component is showing,
false otherwiseDetermines whether this component is showing on screen. |
| public boolean | Returns: true if the component is valid, false
otherwiseDetermines whether this component is valid. |
| public boolean | Returns: true if the component is visible,
false otherwiseDetermines whether this component should be visible when its parent is visible. |
| pack-priv final boolean | |
| public boolean | |
| public boolean | |
| public void | |
| pack-priv void | lightweightPaint(Graphics
the graphics context to use for painting g)Simulates the peer callbacks into java.awt for painting of lightweight Components. |
| pack-priv void | lightweightPrint(Graphics
the graphics context to use for printing g)Simulates the peer callbacks into java.awt for printing of lightweight Components. |
| public void | |
| public void | list(PrintStream
a print stream out)Prints a listing of this component to the specified output stream. |
| public void | list(PrintStream
a print stream out, int number of spaces to indent indent)Prints out a list, starting at the specified indentation, to the specified print stream. |
| public void | |
| public void | list(PrintWriter
the print writer to print to out, int the number of spaces to indent indent)Prints out a list, starting at the specified indentation, to the specified print writer. |
| public Component | Returns: the component at the specified location ornullthe x coordinate to search for components at x, int the y coordinate to search for components at y)
Deprecated
As of JDK version 1.1,
replaced by getComponentAt(int, int).
Returns the component occupying the position specified (this component, or immediate child component, or null if neither of the first two occupies the location). |
| public Point | Returns: the location of this component's top left corner
Deprecated
As of JDK version 1.1,
replaced by
getLocation().
Returns the location of this component's top left corner. |
| private Point | |
| public boolean | |
| public Dimension | Returns: the minimum size of this component
Deprecated
As of JDK version 1.1,
replaced by
getMinimumSize().
Returns the minimum size of this component. |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| public boolean | |
| public boolean | |
| public boolean | mouseEnter(Event
the event to handle evt, int the x coordinate x, int the y coordinate y)
Deprecated
As of JDK version 1.1,
replaced by processMouseEvent(MouseEvent).
Returns: |
| public boolean | |
| public boolean | |
| public boolean | |
| public void | move(int
the x-coordinate of the new location's
top-left corner in the parent's coordinate space x, int the y-coordinate of the new location's
top-left corner in the parent's coordinate space y)
Deprecated
As of JDK version 1.1,
replaced by
setLocation(int, int).
Moves this component to a new location. |
| public void | |
| private void | |
| pack-priv int | |
| public void | |
| public void | |
| pack-priv void | |
| protected String | Returns: a string representation of this component's stateReturns a string representing the state of this component. |
| pack-priv Point | pointRelativeToComponent(Point absolute)
Translates absolute coordinates into coordinates in the coordinate space of this component. |
| public boolean | postEvent(Event e)
Implements java.
Deprecated
As of JDK version 1.1,
replaced by dispatchEvent(AWTEvent).
Posts an event to the listeners. |
| pack-priv boolean | |
| public Dimension | Returns: the component's preferred size
Deprecated
As of JDK version 1.1,
replaced by
getPreferredSize().
Returns the component's preferred size. |
| public boolean | Returns: true if the image has already been fully
prepared; false otherwisethe image, ImageObserver Image for which to
prepare a screen representationthe observer)ImageObserver object
to be notified as the image is being preparedPrepares an image for rendering on this component. |
| public boolean | Returns: true if the image has already been fully
prepared; false otherwisethe instance of image, int Image
for which to prepare a screen representationthe width of the desired screen representation width, int the height of the desired screen representation height, ImageObserver the observer)ImageObserver object
to be notified as the image is being preparedPrepares an image for rendering on this component at the specified width and height. |
| public void | |
| public void | |
| pack-priv void | |
| protected void | processComponentEvent(ComponentEvent
the component event e)Processes component events occurring on this component by
dispatching them to any registered
|
| protected void | |
| protected void | processFocusEvent(FocusEvent
the focus event e)Processes focus events occurring on this component by
dispatching them to any registered
|
| protected void | processHierarchyBoundsEvent(HierarchyEvent
the hierarchy event e)Processes hierarchy bounds events occurring on this component by
dispatching them to any registered
|
| protected void | processHierarchyEvent(HierarchyEvent
the hierarchy event e)Processes hierarchy events occurring on this component by
dispatching them to any registered
|
| protected void | processInputMethodEvent(InputMethodEvent
the input method event e)Processes input method events occurring on this component by
dispatching them to any registered
|
| protected void | processKeyEvent(KeyEvent
the key event e)Processes key events occurring on this component by
dispatching them to any registered
|
| protected void | processMouseEvent(MouseEvent
the mouse event e)Processes mouse events occurring on this component by
dispatching them to any registered
|
| protected void | processMouseMotionEvent(MouseEvent
the mouse motion event e)Processes mouse motion events occurring on this component by
dispatching them to any registered
|
| protected void | processMouseWheelEvent(MouseWheelEvent
the mouse wheel event e)Processes mouse wheel events occurring on this component by
dispatching them to any registered
|
| private void | readObject(ObjectInputStream
the s)ObjectInputStream to readReads the |
| pack-priv final void | |
| public void | remove(MenuComponent
the popup menu to be removed popup)Implements java. Removes the specified popup menu from the component. |
| public synchronized void | removeComponentListener(ComponentListener
the component listener l)Removes the specified component listener so that it no longer receives component events from this component. |
| public synchronized void | removeFocusListener(FocusListener
the focus listener l)Removes the specified focus listener so that it no longer receives focus events from this component. |
| public void | removeHierarchyBoundsListener(HierarchyBoundsListener
the hierarchy bounds listener l)Removes the specified hierarchy bounds listener so that it no longer receives hierarchy bounds events from this component. |
| public void | removeHierarchyListener(HierarchyListener
the hierarchy listener l)Removes the specified hierarchy listener so that it no longer receives hierarchy changed events from this component. |
| public synchronized void | removeInputMethodListener(InputMethodListener
the input method listener l)Removes the specified input method listener so that it no longer receives input method events from this component. |
| public synchronized void | removeKeyListener(KeyListener
the key listener l)Removes the specified key listener so that it no longer receives key events from this component. |
| public synchronized void | removeMouseListener(MouseListener
the mouse listener l)Removes the specified mouse listener so that it no longer receives mouse events from this component. |
| public synchronized void | removeMouseMotionListener(MouseMotionListener
the mouse motion listener l)Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component. |
| public synchronized void | removeMouseWheelListener(MouseWheelListener
the mouse wheel listener. l)Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component. |
| public void | |
| public void | removePropertyChangeListener(PropertyChangeListener
the PropertyChangeListener to be removed listener)Removes a PropertyChangeListener from the listener list. |
| public void | removePropertyChangeListener(String
a valid property name propertyName, PropertyChangeListener the PropertyChangeListener to be removed listener)Removes a |
| public void | |
| public void | |
| public void | repaint(int
the x coordinate x, int the y coordinate y, int the width width, int the height height)Repaints the specified rectangle of this component. |
| public void | repaint(long
maximum time in milliseconds before update tm, int the x coordinate x, int the y coordinate y, int the width width, int the height height)Repaints the specified rectangle of this component within
|
| private void | |
| public void | requestFocus()
Requests that this Component get the input focus, and that this Component's top-level ancestor become the focused Window. |
| public void | requestFocus(FocusEvent.
the cause why the focus is requested causeRequests by the reason of |
| protected boolean | Returns: false if the focus change request is guaranteed to
fail; true if it is likely to succeedtrue if the focus change is temporary,
such as when the window loses the focus; for
more information on temporary focus changes see the
Focus Specification temporary)Requests that this |
| protected boolean | Returns: false if the focus change request is guaranteed to
fail; true if it is likely to succeedtrue if the focus change is temporary,
such as when the window loses the focus; for
more information on temporary focus changes see the
Focus Specification temporary, FocusEvent.the cause why the focus is requested causeRequests by the reason of |
| pack-priv final boolean | |
| pack-priv final boolean | |
| public boolean | Returns: false if the focus change request is guaranteed to
fail; true if it is likely to succeedRequests that this Component get the input focus, if this Component's top-level ancestor is already the focused Window. |
| public boolean | Returns: false if the focus change request is guaranteed to
fail; true if it is likely to succeedthe cause why the focus is requested causeRequests by the reason of |
| protected boolean | Returns: false if the focus change request is guaranteed to
fail; true if it is likely to succeedtrue if the focus change is temporary,
such as when the window loses the focus; for
more information on temporary focus changes see the
Focus Specification temporary)Requests that this |
| pack-priv boolean | |
| public void | reshape(int
the x coordinate of the upper left corner of the rectangle x, int the y coordinate of the upper left corner of the rectangle y, int the width of the rectangle width, int the height of the rectangle height)
Deprecated
As of JDK version 1.1,
replaced by
setBounds(int, int, int, int).
Reshapes the bounding rectangle for this component. |
| private void | |
| public void | resize(int
the new width of the component width, int the new height of the component height)
Deprecated
As of JDK version 1.1,
replaced by
setSize(int, int).
Resizes this component. |
| public void | |
| public void | |
| pack-priv final void | |
| pack-priv void | |
| public void | setBackground(Color
the color to become this component's color;
if this parameter is c)null, then this
component will inherit the background color of its parentSets the background color of this component. |
| public void | setBounds(int
the new x-coordinate of this component x, int the new y-coordinate of this component y, int the new width, int width of this componentthe new height)height of this
componentMoves and resizes this component. |
| public void | |
| pack-priv void | |
| public void | setComponentOrientation(ComponentOrientation
the orientation to be set o)Sets the language-sensitive orientation that is to be used to order the elements or text within this component. |
| public void | |
| public synchronized void | |
| public void | setEnabled(boolean
If b)true, this component is
enabled; otherwise this component is disabledEnables or disables this component, depending on the value of the
parameter |
| public void | setFocusable(boolean
indicates whether this Component is focusable focusable)Sets the focusable state of this Component to the specified value. |
| public void | setFocusTraversalKeys(int
one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or
KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS id, Set<? extends AWTKeyStroke> the Set of AWTKeyStroke for the specified operation keystrokes)Sets the focus traversal keys for a given traversal operation for this Component. |
| pack-priv final void | |
| public void | setFocusTraversalKeysEnabled(boolean
whether focus traversal keys are
enabled for this Component focusTraversalKeysEnabled)Sets whether focus traversal keys are enabled for this Component. |
| public void | |
| public void | setForeground(Color
the color to become this component's
foreground color; if this parameter is c)null
then this component will inherit
the foreground color of its parentSets the foreground color of this component. |
| pack-priv void | |
| public void | setIgnoreRepaint(boolean
true if the paint messages from the OS
should be ignored; otherwise falseSets whether or not paint messages received from the operating system should be ignored. |
| public void | |
| public void | setLocation(int
the x-coordinate of the new location's
top-left corner in the parent's coordinate space x, int the y-coordinate of the new location's
top-left corner in the parent's coordinate space y)Moves this component to a new location. |
| public void | setLocation(Point
the point defining the top-left corner
of the new location, given in the coordinate space of this
component's parent p)Moves this component to a new location. |
| public void | setMaximumSize(Dimension
a maximumSize)Dimension containing the
desired maximum allowable sizeSets the maximum size of this component to a constant value. |
| public void | setMinimumSize(Dimension
the new minimum size of this component minimumSize)Sets the minimum size of this component to a constant value. |
| public void | setMixingCutoutShape(Shape
the new 'mixing-cutout' shape shape)Sets a 'mixing-cutout' shape for this lightweight component. |
| public void | |
| public void | setPreferredSize(Dimension
The new preferred size, or null preferredSize)Sets the preferred size of this component to a constant value. |
| pack-priv static synchronized void | |
| public void | setSize(int
the new width of this component in pixels width, int the new height of this component in pixels height)Resizes this component so that it has width |
| public void | |
| public void | setVisible(boolean
if b)true, shows this component;
otherwise, hides this componentShows or hides this component depending on the value of parameter
|
| public void | |
| public void | show(boolean
true to make this component visible;
otherwise false
Deprecated
As of JDK version 1.1,
replaced by
setVisible(boolean).
Makes this component visible or invisible. |
| public Dimension | Returns: theDimension object that indicates the
size of this component
Deprecated
As of JDK version 1.1,
replaced by
getSize().
Returns the size of this component in the form of a
|
| pack-priv final void | |
| pack-priv final void | |
| public String | Returns: a string representation of this componentOverrides java. Returns a string representation of this component and its values. |
| public void | transferFocus()
Transfers the focus to the next component, as though this Component were the focus owner. |
| pack-priv boolean | |
| public void | transferFocusBackward()
Transfers the focus to the previous component, as though this Component were the focus owner. |
| pack-priv boolean | |
| public void | |
| public void | |
| pack-priv boolean | |
| pack-priv final void | |
| pack-priv final boolean | |
| private boolean | |
| pack-priv void | |
| public void | |
| private void | writeObject(ObjectOutputStream
the s)ObjectOutputStream to writeWrites default serializable fields to stream. |