Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.awt

Class Component

java.lang.Object
|
+--java.awt.Component

All Implemented Interfaces:

ImageObserver, MenuContainer, Serializable


public abstract class Component

extends Object

implements ImageObserver, MenuContainer, Serializable

The root of all evil. All graphical representations are subclasses of this giant class, which is designed for screen display and user interaction. This class can be extended directly to build a lightweight component (one not associated with a native window); lightweight components must reside inside a heavyweight window.

This class is Serializable, which has some big implications. A user can save the state of all graphical components in one VM, and reload them in another. Note that this class will only save Serializable listeners, and ignore the rest, without causing any serialization exceptions. However, by making a listener serializable, and adding it to another element, you link in that entire element to the state of this component. To get around this, use the idiom shown in the example below - make listeners non-serializable in inner classes, rather than using this object itself as the listener, if external objects do not need to save the state of this object.

 import java.awt.*;
 import java.awt.event.*;
 import java.io.Serializable;
 class MyApp implements Serializable
 {
   BigObjectThatShouldNotBeSerializedWithAButton bigOne;
   // Serializing aButton will not suck in an instance of MyApp, with its
   // accompanying field bigOne.
   Button aButton = new Button();
   class MyActionListener implements ActionListener
   {
     public void actionPerformed(ActionEvent e)
     {
       System.out.println("Hello There");
     }
   }
   MyApp()
   {
     aButton.addActionListener(new MyActionListener());
   }
 }

 

Status: Incomplete. The event dispatch mechanism is implemented. All other methods defined in the J2SE 1.3 API javadoc exist, but are mostly incomplete or only stubs; except for methods relating to the Drag and Drop, Input Method, and Accessibility frameworks: These methods are present but commented out.

Since:Authors:

Field Summary

static floatBOTTOM_ALIGNMENT

Constant returned by the getAlignmentY method to indicate that the component wishes to be aligned to the bottom relative to other components.
static floatCENTER_ALIGNMENT

Constant returned by the getAlignmentY and getAlignmentX methods to indicate that the component wishes to be aligned to the center relative to other components.
static floatLEFT_ALIGNMENT

Constant returned by the getAlignmentX method to indicate that the component wishes to be aligned to the left relative to other components.
static floatRIGHT_ALIGNMENT

Constant returned by the getAlignmentX method to indicate that the component wishes to be aligned to the right relative to other components.
static floatTOP_ALIGNMENT

Constant returned by the getAlignmentY method to indicate that the component wishes to be aligned to the top relative to other components.

Constructor Summary

Component()

Default constructor for subclasses.

Method Summary

booleanaction(java.awt.Event evt, java.lang.Object what)

AWT 1.0 action event processor.
synchronized voidadd(java.awt.PopupMenu popup)

Adds the specified popup menu to this component.
synchronized voidaddComponentListener(java.awt.event.ComponentListener l)

Adds the specified listener to this component.
synchronized voidaddFocusListener(java.awt.event.FocusListener l)

Adds the specified listener to this component.
synchronized voidaddHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener l)

Adds the specified listener to this component.
synchronized voidaddHierarchyListener(java.awt.event.HierarchyListener l)

Adds the specified listener to this component.
synchronized voidaddInputMethodListener(java.awt.event.InputMethodListener l)

Adds the specified listener to this component.
synchronized voidaddKeyListener(java.awt.event.KeyListener l)

Adds the specified listener to this component.
synchronized voidaddMouseListener(java.awt.event.MouseListener l)

Adds the specified listener to this component.
synchronized voidaddMouseMotionListener(java.awt.event.MouseMotionListener l)

Adds the specified listener to this component.
synchronized voidaddMouseWheelListener(java.awt.event.MouseWheelListener l)

Adds the specified listener to this component.
voidaddNotify()

Called to inform this component it has been added to a container.
voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)

Adds the specified property listener to this component.
voidaddPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)

Adds the specified property listener to this component.
voidapplyComponentOrientation(java.awt.ComponentOrientation o)

Sets the text layout orientation of this component.
booleanareFocusTraversalKeysSet(int id)

Tests whether the focus traversal keys for a given action are explicitly set or inherited.
java.awt.Rectanglebounds()

Returns a bounding rectangle for this component.
intcheckImage(java.awt.Image image, java.awt.image.ImageObserver observer)

Returns the status of the loading of the specified image.
intcheckImage(java.awt.Image image, int width, int height, java.awt.image.ImageObserver observer)

Returns the status of the loading of the specified image.
java.awt.AWTEventcoalesceEvents(java.awt.AWTEvent existingEvent, java.awt.AWTEvent newEvent)

This is called by the EventQueue if two events with the same event id and owner component are queued.
booleancontains(int x, int y)

Tests whether or not the specified point is contained within this component.
booleancontains(java.awt.Point p)

Tests whether or not the specified point is contained within this component.
java.awt.ImagecreateImage(java.awt.image.ImageProducer producer)

Creates an image from the specified producer.
java.awt.ImagecreateImage(int width, int height)

Creates an image with the specified width and height for use in double buffering.
java.awt.image.VolatileImagecreateVolatileImage(int width, int height)

Creates an image with the specified width and height for use in double buffering.
java.awt.image.VolatileImagecreateVolatileImage(int width, int height, java.awt.ImageCapabilities caps)

Creates an image with the specified width and height for use in double buffering.
voiddeliverEvent(java.awt.Event e)

AWT 1.0 event dispatcher.
voiddisable()

Disables this component.
voiddisableEvents(long eventsToDisable)

Disables the specified events.
voiddispatchEvent(java.awt.AWTEvent e)

Forwards AWT events to processEvent() if:
  • Events have been enabled for this type of event via enableEvents()
  • ,
  • There is at least one registered listener for this type of event
voiddoLayout()

Calls the layout manager to re-layout the component.
voidenable()

Enables this component.
voidenable(boolean b)

Enables or disables this component.
voidenableEvents(long eventsToEnable)

Enables the specified events.
voidenableInputMethods(boolean enable)

Enables or disables input method support for this component.
voidfirePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)

Report a change in a bound property to any registered property listeners.
voidfirePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)

Report a change in a bound property to any registered property listeners.
voidfirePropertyChange(java.lang.String propertyName, int oldValue, int newValue)

Report a change in a bound property to any registered property listeners.
javax.accessibility.AccessibleContextgetAccessibleContext()

Returns the accessibility framework context of this class.
floatgetAlignmentX()

Returns the preferred horizontal alignment of this component.
floatgetAlignmentY()

Returns the preferred vertical alignment of this component.
java.awt.ColorgetBackground()

Returns this component's background color.
java.awt.RectanglegetBounds()

Returns a bounding rectangle for this component.
java.awt.RectanglegetBounds(java.awt.Rectangle r)

Returns the bounds of this component.
java.awt.image.ColorModelgetColorModel()

Returns the color model of the device this componet is displayed on.
java.awt.ComponentgetComponentAt(int x, int y)

Returns the component occupying the position (x,y).
java.awt.ComponentgetComponentAt(java.awt.Point p)

Returns the component occupying the position (x,y).
synchronized java.awt.event.ComponentListener[]getComponentListeners()

Returns an array of all specified listeners registered on this component.
java.awt.ComponentOrientationgetComponentOrientation()

Determines the text layout orientation used by this component.
java.awt.CursorgetCursor()

Returns the cursor for this component.
java.awt.dnd.DropTargetgetDropTarget()

Gets the associated drag-and-drop target, if there is one.
java.awt.ContainergetFocusCycleRootAncestor()

Returns the root container that owns the focus cycle where this component resides.
synchronized java.awt.event.FocusListener[]getFocusListeners()

Returns an array of all specified listeners registered on this component.
java.util.SetgetFocusTraversalKeys(int id)

Returns the set of keys for a given focus traversal action, as defined in setFocusTraversalKeys.
booleangetFocusTraversalKeysEnabled()

Tests whether focus traversal keys are enabled.
java.awt.FontgetFont()

Returns the font in use for this component.
java.awt.FontMetricsgetFontMetrics(java.awt.Font font)

Returns the font metrics for the specified font in this component.
java.awt.ColorgetForeground()

Returns this component's foreground color.
java.awt.GraphicsgetGraphics()

Returns a graphics object for this component.
java.awt.GraphicsConfigurationgetGraphicsConfiguration()

Returns the graphics configuration of this component, if there is one.
intgetHeight()

Gets the height of the component.
synchronized java.awt.event.HierarchyBoundsListener[]getHierarchyBoundsListeners()

Returns an array of all specified listeners registered on this component.
synchronized java.awt.event.HierarchyListener[]getHierarchyListeners()

Returns an array of all specified listeners registered on this component.
booleangetIgnoreRepaint()

Test whether paint events from the operating system are ignored.
java.awt.im.InputContextgetInputContext()

Gets the input context of this component, which is inherited from the parent unless this is overridden.
synchronized java.awt.event.InputMethodListener[]getInputMethodListeners()

Returns an array of all specified listeners registered on this component.
java.awt.im.InputMethodRequestsgetInputMethodRequests()

Returns the input method request handler, for subclasses which support on-the-spot text input.
synchronized java.awt.event.KeyListener[]getKeyListeners()

Returns an array of all specified listeners registered on this component.
java.util.EventListener[]getListeners(java.lang.Class listenerType)

Returns all registered EventListers of the given listenerType.
java.util.LocalegetLocale()

Returns the locale for this component.
java.awt.PointgetLocation()

Returns the location of this component's top left corner relative to its parent component.
java.awt.PointgetLocation(java.awt.Point p)

Returns the location of this component.
java.awt.PointgetLocationOnScreen()

Returns the location of this component's top left corner in screen coordinates.
java.awt.DimensiongetMaximumSize()

Returns the component's maximum size.
java.awt.DimensiongetMinimumSize()

Returns the component's minimum size.
synchronized java.awt.event.MouseListener[]getMouseListeners()

Returns an array of all specified listeners registered on this component.
synchronized java.awt.event.MouseMotionListener[]getMouseMotionListeners()

Returns an array of all specified listeners registered on this component.
synchronized java.awt.event.MouseWheelListener[]getMouseWheelListeners()

Returns an array of all specified listeners registered on this component.
java.lang.StringgetName()

Returns the name of this component.
java.awt.ContainergetParent()

Returns the parent of this component.
java.awt.peer.ComponentPeergetPeer()

Returns the native windowing system peer for this component.
java.awt.DimensiongetPreferredSize()

Returns the component's preferred size.
java.beans.PropertyChangeListener[]getPropertyChangeListeners()

Returns an array of all specified listeners registered on this component.
java.beans.PropertyChangeListener[]getPropertyChangeListeners(java.lang.String property)

Returns an array of all specified listeners on the named property that are registered on this component.
java.awt.DimensiongetSize()

Returns the size of this object.
java.awt.DimensiongetSize(java.awt.Dimension d)

Returns the size of this component.
java.awt.ToolkitgetToolkit()

Returns the toolkit in use for this component.
java.lang.ObjectgetTreeLock()

Returns the object used for synchronization locks on this component when performing tree and layout functions.
intgetWidth()

Gets the width of the component.
intgetX()

Gets the x coordinate of the upper left corner.
intgetY()

Gets the y coordinate of the upper left corner.
booleangotFocus(java.awt.Event evt, java.lang.Object what)

AWT 1.0 focus event.
booleanhandleEvent(java.awt.Event evt)

AWT 1.0 event processor.
booleanhasFocus()

Tests if this component is the focus owner.
voidhide()

Hides this component so that it is no longer shown on the screen.
booleanimageUpdate(java.awt.Image img, int flags, int x, int y, int w, int h)

Called when an image has changed so that this component is repainted.
booleaninside(int x, int y)

Tests whether or not the specified point is contained within this component.
voidinvalidate()

Invalidates this component and all of its parent components.
booleanisBackgroundSet()

Tests if the background was explicitly set, or just inherited from the parent.
booleanisCursorSet()

Tests if the cursor was explicitly set, or just inherited from the parent.
booleanisDisplayable()

Tests if the component is displayable.
booleanisDoubleBuffered()

Checks if this image is painted to an offscreen image buffer that is later copied to screen (double buffering reduces flicker).
booleanisEnabled()

Tests whether or not this component is enabled.
booleanisFocusCycleRoot(java.awt.Container c)

Tests if the container is the ancestor of the focus cycle that this component belongs to.
booleanisFocusOwner()

Tests if this component is the focus owner.
booleanisFocusTraversable()

Tests whether or not this component is in the group that can be traversed using the keyboard traversal mechanism (such as the TAB key).
booleanisFocusable()

Tests if this component can receive focus.
booleanisFontSet()

Tests if the font was explicitly set, or just inherited from the parent.
booleanisForegroundSet()

Tests if the foreground was explicitly set, or just inherited from the parent.
booleanisLightweight()

Return whether the component is lightweight.
booleanisOpaque()

Tests if this component is opaque.
booleanisShowing()

Tests whether or not this component is actually being shown on the screen.
booleanisValid()

Tests whether or not this component is valid.
booleanisVisible()

Tests whether or not this component is visible.
booleankeyDown(java.awt.Event evt, int key)

AWT 1.0 key press event.
booleankeyUp(java.awt.Event evt, int key)

AWT 1.0 key press event.
voidlayout()

Calls the layout manager to re-layout the component.
voidlist()

Prints a listing of this component to System.out.
voidlist(java.io.PrintStream out)

Prints a listing of this component to the specified print stream.
voidlist(java.io.PrintStream out, int indent)

Prints a listing of this component to the specified print stream, starting at the specified indentation point.
voidlist(java.io.PrintWriter out)

Prints a listing of this component to the specified print writer.
voidlist(java.io.PrintWriter out, int indent)

Prints a listing of this component to the specified print writer, starting at the specified indentation point.
java.awt.Componentlocate(int x, int y)

Returns the component occupying the position (x,y).
java.awt.Pointlocation()

Returns the location of this component's top left corner relative to its parent component.
booleanlostFocus(java.awt.Event evt, java.lang.Object what)

AWT 1.0 focus event.
java.awt.DimensionminimumSize()

Returns the component's minimum size.
booleanmouseDown(java.awt.Event evt, int x, int y)

AWT 1.0 mouse event.
booleanmouseDrag(java.awt.Event evt, int x, int y)

AWT 1.0 mouse event.
booleanmouseEnter(java.awt.Event evt, int x, int y)

AWT 1.0 mouse event.
booleanmouseExit(java.awt.Event evt, int x, int y)

AWT 1.0 mouse event.
booleanmouseMove(java.awt.Event evt, int x, int y)

AWT 1.0 mouse event.
booleanmouseUp(java.awt.Event evt, int x, int y)

AWT 1.0 mouse event.
voidmove(int x, int y)

Moves this component to the specified location, relative to the parent's coordinates.
voidnextFocus()

AWT 1.0 focus event processor.
voidpaint(java.awt.Graphics g)

Paints this component on the screen.
voidpaintAll(java.awt.Graphics g)

Paints this entire component, including any sub-components.
java.lang.StringparamString()

Returns a debugging string representing this component.
booleanpostEvent(java.awt.Event e)

AWT 1.0 event dispatcher.
java.awt.DimensionpreferredSize()

Returns the component's preferred size.
booleanprepareImage(java.awt.Image image, java.awt.image.ImageObserver observer)

Prepares the specified image for rendering on this component.
booleanprepareImage(java.awt.Image image, int width, int height, java.awt.image.ImageObserver observer)

Prepares the specified image for rendering on this component at the specified scaled width and height
voidprint(java.awt.Graphics g)

Prints this component.
voidprintAll(java.awt.Graphics g)

Prints this component, including all sub-components.
voidprocessComponentEvent(java.awt.event.ComponentEvent e)

Called when a component event is dispatched and component events are enabled.
voidprocessEvent(java.awt.AWTEvent e)

Processes the specified event.
voidprocessFocusEvent(java.awt.event.FocusEvent e)

Called when a focus event is dispatched and component events are enabled.
voidprocessHierarchyBoundsEvent(java.awt.event.HierarchyEvent e)

Called when a hierarchy bounds event is dispatched and component events are enabled.
voidprocessHierarchyEvent(java.awt.event.HierarchyEvent e)

Called when a hierarchy change event is dispatched and component events are enabled.
voidprocessInputMethodEvent(java.awt.event.InputMethodEvent e)

Called when an input method event is dispatched and component events are enabled.
voidprocessKeyEvent(java.awt.event.KeyEvent e)

Called when a key event is dispatched and component events are enabled.
voidprocessMouseEvent(java.awt.event.MouseEvent e)

Called when a regular mouse event is dispatched and component events are enabled.
voidprocessMouseMotionEvent(java.awt.event.MouseEvent e)

Called when a mouse motion event is dispatched and component events are enabled.
voidprocessMouseWheelEvent(java.awt.event.MouseWheelEvent e)

Called when a mouse wheel event is dispatched and component events are enabled.
synchronized voidremove(java.awt.MenuComponent popup)

Removes the specified popup menu from this component.
synchronized voidremoveComponentListener(java.awt.event.ComponentListener l)

Removes the specified listener from the component.
synchronized voidremoveFocusListener(java.awt.event.FocusListener l)

Removes the specified listener from the component.
synchronized voidremoveHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener l)

Removes the specified listener from the component.
synchronized voidremoveHierarchyListener(java.awt.event.HierarchyListener l)

Removes the specified listener from the component.
synchronized voidremoveInputMethodListener(java.awt.event.InputMethodListener l)

Removes the specified listener from the component.
synchronized voidremoveKeyListener(java.awt.event.KeyListener l)

Removes the specified listener from the component.
synchronized voidremoveMouseListener(java.awt.event.MouseListener l)

Removes the specified listener from the component.
synchronized voidremoveMouseMotionListener(java.awt.event.MouseMotionListener l)

Removes the specified listener from the component.
synchronized voidremoveMouseWheelListener(java.awt.event.MouseWheelListener l)

Removes the specified listener from the component.
voidremoveNotify()

Called to inform this component is has been removed from its container.
voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)

Removes the specified property listener from the component.
voidremovePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)

Removes the specified property listener on a particular property from the component.
voidrepaint()

Repaint this entire component.
voidrepaint(long tm)

Repaint this entire component.
voidrepaint(int x, int y, int w, int h)

Repaints the specified rectangular region within this component.
voidrepaint(long tm, int x, int y, int width, int height)

Repaints the specified rectangular region within this component.
voidrequestFocus()

Requests that this component be given focus.
booleanrequestFocus(boolean temporary)

Requests that this component be given focus.
booleanrequestFocusInWindow()

Requests that this component be given focus, if it resides in the top-level window which already has focus.
booleanrequestFocusInWindow(boolean temporary)

Requests that this component be given focus, if it resides in the top-level window which already has focus.
voidreshape(int x, int y, int width, int height)

Sets the bounding rectangle for this component to the specified values.
voidresize(int width, int height)

Sets the size of this component to the specified value.
voidresize(java.awt.Dimension d)

Sets the size of this component to the specified value.
voidsetBackground(java.awt.Color c)

Sets this component's background color to the specified color.
voidsetBounds(int x, int y, int w, int h)

Sets the bounding rectangle for this component to the specified values.
voidsetBounds(java.awt.Rectangle r)

Sets the bounding rectangle for this component to the specified rectangle.
voidsetComponentOrientation(java.awt.ComponentOrientation o)

Sets the text layout orientation of this component.
voidsetCursor(java.awt.Cursor cursor)

Sets the cursor for this component to the specified cursor.
voidsetDropTarget(java.awt.dnd.DropTarget dt)

Set the associated drag-and-drop target, which receives events when this is enabled.
voidsetEnabled(boolean b)

Enables or disables this component.
voidsetFocusTraversalKeys(int id, java.util.Set keystrokes)

Sets the focus traversal keys for a given type of focus events.
voidsetFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled)

Sets whether focus traversal keys are enabled, which consumes traversal keys and performs the focus event automatically.
voidsetFocusable(boolean focusable)

Specify whether this component can receive focus.
voidsetFont(java.awt.Font f)

Sets the font for this component to the specified font.
voidsetForeground(java.awt.Color c)

Sets this component's foreground color to the specified color.
voidsetIgnoreRepaint(boolean ignoreRepaint)

Sets whether paint messages delivered by the operating system should be ignored.
voidsetLocale(java.util.Locale l)

Sets the locale for this component to the specified locale.
voidsetLocation(int x, int y)

Moves this component to the specified location, relative to the parent's coordinates.
voidsetLocation(java.awt.Point p)

Moves this component to the specified location, relative to the parent's coordinates.
voidsetName(java.lang.String name)

Sets the name of this component to the specified name.
voidsetSize(int width, int height)

Sets the size of this component to the specified width and height.
voidsetSize(java.awt.Dimension d)

Sets the size of this component to the specified value.
voidsetVisible(boolean b)

Makes this component visible or invisible.
voidshow()

Makes this component visible on the screen.
voidshow(boolean b)

Makes this component visible or invisible.
java.awt.Dimensionsize()

Returns the size of this object.
java.lang.StringtoString()

Returns a string representation of this component.
voidtransferFocus()

Transfers focus to the next component in the focus traversal order, as though this were the current focus owner.
voidtransferFocusBackward()

Transfers focus to the previous component in the focus traversal order, as though this were the current focus owner.
voidtransferFocusUpCycle()

Transfers focus to the focus cycle root of this component.
voidupdate(java.awt.Graphics g)

Updates this component.
voidvalidate()

Called to ensure that the layout for this component is valid.

Field Details

BOTTOM_ALIGNMENT

public static final float BOTTOM_ALIGNMENT

Constant returned by the getAlignmentY method to indicate that the component wishes to be aligned to the bottom relative to other components.

See Also:


CENTER_ALIGNMENT

public static final float CENTER_ALIGNMENT

Constant returned by the getAlignmentY and getAlignmentX methods to indicate that the component wishes to be aligned to the center relative to other components.

See Also:


LEFT_ALIGNMENT

public static final float LEFT_ALIGNMENT

Constant returned by the getAlignmentX method to indicate that the component wishes to be aligned to the left relative to other components.

See Also:


RIGHT_ALIGNMENT

public static final float RIGHT_ALIGNMENT

Constant returned by the getAlignmentX method to indicate that the component wishes to be aligned to the right relative to other components.

See Also:


TOP_ALIGNMENT

public static final float TOP_ALIGNMENT

Constant returned by the getAlignmentY method to indicate that the component wishes to be aligned to the top relative to other components.

See Also:


Constructor Details

Component

protected Component()

Default constructor for subclasses. When Component is extended directly, it forms a lightweight component that must be hosted in an opaque native container higher in the tree.


Method Details

action

public boolean action(java.awt.Event evt, java.lang.Object what)

AWT 1.0 action event processor.

Parameters:

Returns:


add

public synchronized void add(java.awt.PopupMenu popup)

Adds the specified popup menu to this component.

Since:Parameters:

See Also:


addComponentListener

public synchronized void addComponentListener(java.awt.event.ComponentListener l)

Adds the specified listener to this component. This is harmless if the listener is null, but if the listener has already been registered, it will now be registered twice.

Since:Parameters:

See Also:


addFocusListener

public synchronized void addFocusListener(java.awt.event.FocusListener l)

Adds the specified listener to this component. This is harmless if the listener is null, but if the listener has already been registered, it will now be registered twice.

Since:Parameters:

See Also:


addHierarchyBoundsListener

public synchronized void addHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener l)

Adds the specified listener to this component. This is harmless if the listener is null, but if the listener has already been registered, it will now be registered twice.

Since:Parameters:

See Also:


addHierarchyListener

public synchronized void addHierarchyListener(java.awt.event.HierarchyListener l)

Adds the specified listener to this component. This is harmless if the listener is null, but if the listener has already been registered, it will now be registered twice.

Since:Parameters:

See Also:


addInputMethodListener

public synchronized void addInputMethodListener(java.awt.event.InputMethodListener l)

Adds the specified listener to this component. This is harmless if the listener is null, but if the listener has already been registered, it will now be registered twice.

Since:Parameters:

See Also:


addKeyListener

public synchronized void addKeyListener(java.awt.event.KeyListener l)

Adds the specified listener to this component. This is harmless if the listener is null, but if the listener has already been registered, it will now be registered twice.

Since:Parameters:

See Also:


addMouseListener

public synchronized void addMouseListener(java.awt.event.MouseListener l)

Adds the specified listener to this component. This is harmless if the listener is null, but if the listener has already been registered, it will now be registered twice.

Since:Parameters:

See Also:


addMouseMotionListener

public synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener l)

Adds the specified listener to this component. This is harmless if the listener is null, but if the listener has already been registered, it will now be registered twice.

Since:Parameters:

See Also:


addMouseWheelListener

public synchronized void addMouseWheelListener(java.awt.event.MouseWheelListener l)

Adds the specified listener to this component. This is harmless if the listener is null, but if the listener has already been registered, it will now be registered twice.

Since:Parameters:

See Also:


addNotify

public void addNotify()

Called to inform this component it has been added to a container. A native peer - if any - is created at this time. This method is called automatically by the AWT system and should not be called by user level code.

See Also:


addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

Adds the specified property listener to this component. This is harmless if the listener is null, but if the listener has already been registered, it will now be registered twice. The property listener ignores inherited properties. Recognized properties include:

Since:Parameters:

See Also:


addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)

Adds the specified property listener to this component. This is harmless if the listener is null, but if the listener has already been registered, it will now be registered twice. The property listener ignores inherited properties. The listener is keyed to a single property. Recognized properties include:

Since:Parameters:

See Also:


applyComponentOrientation

public void applyComponentOrientation(java.awt.ComponentOrientation o)

Sets the text layout orientation of this component. New components default to UNKNOWN (which behaves like LEFT_TO_RIGHT). This method affects the entire hierarchy, while #setComponentOrientation(ComponentOrientation) affects only the current component.

Since:Parameters:

Throws:

See Also:


areFocusTraversalKeysSet

public boolean areFocusTraversalKeysSet(int id)

Tests whether the focus traversal keys for a given action are explicitly set or inherited.

Since:Parameters:

Returns:

Throws:

See Also:


bounds

public Rectangle bounds()

Returns a bounding rectangle for this component. Note that the returned rectange is relative to this component's parent, not to the screen.

Returns:


checkImage

public int checkImage(java.awt.Image image, int width, int height, java.awt.image.ImageObserver observer)

Returns the status of the loading of the specified image. The value returned will be those flags defined in ImageObserver.

Parameters:

Returns:

See Also:


checkImage

public int checkImage(java.awt.Image image, java.awt.image.ImageObserver observer)

Returns the status of the loading of the specified image. The value returned will be those flags defined in ImageObserver.

Parameters:

Returns:

Throws:

See Also:


coalesceEvents

protected AWTEvent coalesceEvents(java.awt.AWTEvent existingEvent, java.awt.AWTEvent newEvent)

This is called by the EventQueue if two events with the same event id and owner component are queued. Returns a new combined event, or null if no combining is done. The coelesced events are currently mouse moves (intermediate ones are discarded) and paint events (a merged paint is created in place of the two events).

Parameters:

Returns:


contains

public boolean contains(int x, int y)

Tests whether or not the specified point is contained within this component. Coordinates are relative to this component.

Parameters:

Returns:

See Also:


contains

public boolean contains(java.awt.Point p)

Tests whether or not the specified point is contained within this component. Coordinates are relative to this component.

Since:Parameters:

Returns:

Throws:

See Also:


createImage

public Image createImage(int width, int height)

Creates an image with the specified width and height for use in double buffering. Headless environments do not support images.

Parameters:

Returns:


createImage

public Image createImage(java.awt.image.ImageProducer producer)

Creates an image from the specified producer.

Parameters:

Returns:


createVolatileImage

public VolatileImage createVolatileImage(int width, int height)

Creates an image with the specified width and height for use in double buffering. Headless environments do not support images.

Since:Parameters:

Returns:


createVolatileImage

public VolatileImage createVolatileImage(int width, int height, java.awt.ImageCapabilities caps)

Creates an image with the specified width and height for use in double buffering. Headless environments do not support images. The image will support the specified capabilities.

Since:Parameters:

Returns:

Throws:


deliverEvent

public void deliverEvent(java.awt.Event e)

AWT 1.0 event dispatcher.

Parameters:


disable

public void disable()

Disables this component.


disableEvents

protected final void disableEvents(long eventsToDisable)

Disables the specified events. The events to disable are specified by OR-ing together the desired masks from AWTEvent.

Since:Parameters:

See Also:


dispatchEvent

public final void dispatchEvent(java.awt.AWTEvent e)

Forwards AWT events to processEvent() if:

Parameters:


doLayout

public void doLayout()

Calls the layout manager to re-layout the component. This is called during validation of a container in most cases.

See Also:


enable

public void enable()

Enables this component.


enable

public void enable(boolean b)

Enables or disables this component.

Parameters:


enableEvents

protected final void enableEvents(long eventsToEnable)

Enables the specified events. The events to enable are specified by OR-ing together the desired masks from AWTEvent.

Events are enabled by default when a listener is attached to the component for that event type. This method can be used by subclasses to ensure the delivery of a specified event regardless of whether or not a listener is attached.

Since:Parameters:

See Also:


enableInputMethods

public void enableInputMethods(boolean enable)

Enables or disables input method support for this component. By default, components have this enabled. Input methods are given the opportunity to process key events before this component and its listeners.

Since:Parameters:

See Also:


firePropertyChange

protected void firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)

Report a change in a bound property to any registered property listeners.

Parameters:


firePropertyChange

protected void firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)

Report a change in a bound property to any registered property listeners.

Parameters:


firePropertyChange

protected void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)

Report a change in a bound property to any registered property listeners.

Parameters:


getAccessibleContext

public AccessibleContext getAccessibleContext()

Returns the accessibility framework context of this class. Component is not accessible, so the default implementation returns null. Subclasses must override this behavior, and return an appropriate subclass of AccessibleAWTComponent.

Returns:


getAlignmentX

public float getAlignmentX()

Returns the preferred horizontal alignment of this component. The value returned will be between #LEFT_ALIGNMENT and #RIGHT_ALIGNMENT, inclusive.

Returns:


getAlignmentY

public float getAlignmentY()

Returns the preferred vertical alignment of this component. The value returned will be between #TOP_ALIGNMENT and #BOTTOM_ALIGNMENT, inclusive.

Returns:


getBackground

public Color getBackground()

Returns this component's background color. If not set, this is inherited from the parent.

Returns:

See Also:


getBounds

public Rectangle getBounds()

Returns a bounding rectangle for this component. Note that the returned rectange is relative to this component's parent, not to the screen.

Returns:

See Also:


getBounds

public Rectangle getBounds(java.awt.Rectangle r)

Returns the bounds of this component. This allows reuse of an existing rectangle, if r is non-null.

Parameters:

Returns:


getColorModel

public ColorModel getColorModel()

Returns the color model of the device this componet is displayed on.

Returns:

See Also:


getComponentAt

public Component getComponentAt(int x, int y)

Returns the component occupying the position (x,y). This will either be this component, an immediate child component, or null if neither of the first two occupies the specified location.

Parameters:

Returns:

See Also:


getComponentAt

public Component getComponentAt(java.awt.Point p)

Returns the component occupying the position (x,y). This will either be this component, an immediate child component, or null if neither of the first two occupies the specified location.

Since:Parameters:

Returns:

Throws:

See Also:


getComponentListeners

public synchronized ComponentListener[] getComponentListeners()

Returns an array of all specified listeners registered on this component.

Since:Returns:

See Also:


getComponentOrientation

public ComponentOrientation getComponentOrientation()

Determines the text layout orientation used by this component.

Returns:

See Also:


getCursor

public Cursor getCursor()

Returns the cursor for this component. If not set, this is inherited from the parent, or from Cursor.getDefaultCursor().

Returns:


getDropTarget

public DropTarget getDropTarget()

Gets the associated drag-and-drop target, if there is one.

Returns:


getFocusCycleRootAncestor

public Container getFocusCycleRootAncestor()

Returns the root container that owns the focus cycle where this component resides. A focus cycle root is in two cycles, one as the ancestor, and one as the focusable element; this call always returns the ancestor.

Since:Returns:


getFocusListeners

public synchronized FocusListener[] getFocusListeners()

Returns an array of all specified listeners registered on this component.

Since:Returns:

See Also:


getFocusTraversalKeys

public Set getFocusTraversalKeys(int id)

Returns the set of keys for a given focus traversal action, as defined in setFocusTraversalKeys. If not set, this is inherited from the parent component, which may have gotten it from the KeyboardFocusManager.

Since:Parameters:

Throws:

See Also:


getFocusTraversalKeysEnabled

public boolean getFocusTraversalKeysEnabled()

Tests whether focus traversal keys are enabled. If they are, then focus traversal keys are consumed and focus events performed automatically, without the component seeing the keystrokes.

Since:Returns:

See Also:


getFont

public Font getFont()

Returns the font in use for this component. If not set, this is inherited from the parent.

Returns:

See Also:


getFontMetrics

public FontMetrics getFontMetrics(java.awt.Font font)

Returns the font metrics for the specified font in this component.

Parameters:

Returns:

Throws:

See Also:


getForeground

public Color getForeground()

Returns this component's foreground color. If not set, this is inherited from the parent.

Returns:

See Also:


getGraphics

public Graphics getGraphics()

Returns a graphics object for this component. Returns null if this component is not currently displayed on the screen.

Returns:

See Also:


getGraphicsConfiguration

public GraphicsConfiguration getGraphicsConfiguration()

Returns the graphics configuration of this component, if there is one. If it has not been set, it is inherited from the parent.

Since:Returns:


getHeight

public int getHeight()

Gets the height of the component. This is more efficient than getBounds().height or getSize().height.

Since:Returns:


getHierarchyBoundsListeners

public synchronized HierarchyBoundsListener[] getHierarchyBoundsListeners()

Returns an array of all specified listeners registered on this component.

Since:Returns:

See Also:


getHierarchyListeners

public synchronized HierarchyListener[] getHierarchyListeners()

Returns an array of all specified listeners registered on this component.

Since:Returns:

See Also:


getIgnoreRepaint

public boolean getIgnoreRepaint()

Test whether paint events from the operating system are ignored.

Since:Returns:

See Also:


getInputContext

public InputContext getInputContext()

Gets the input context of this component, which is inherited from the parent unless this is overridden.

Since:Returns:


getInputMethodListeners

public synchronized InputMethodListener[] getInputMethodListeners()

Returns an array of all specified listeners registered on this component.

Since:Returns:

See Also:


getInputMethodRequests

public InputMethodRequests getInputMethodRequests()

Returns the input method request handler, for subclasses which support on-the-spot text input. By default, input methods are handled by AWT, and this returns null.

Since:Returns:


getKeyListeners

public synchronized KeyListener[] getKeyListeners()

Returns an array of all specified listeners registered on this component.

Since:Returns:

See Also:


getListeners

public EventListener[] getListeners(java.lang.Class listenerType)

Returns all registered EventListers of the given listenerType.

Since:Parameters:

Returns:

See Also:


getLocale

public Locale getLocale()

Returns the locale for this component. If this component does not have a locale, the locale of the parent component is returned.

Since:Returns:

Throws:

See Also:


getLocation

public Point getLocation()

Returns the location of this component's top left corner relative to its parent component. This may be outdated, so for synchronous behavior, you should use a component listner.

Since:Returns:

See Also:


getLocation

public Point getLocation(java.awt.Point p)

Returns the location of this component. This allows reuse of an existing point, if p is non-null.

Parameters:

Returns:


getLocationOnScreen

public Point getLocationOnScreen()

Returns the location of this component's top left corner in screen coordinates.

Returns:

Throws:


getMaximumSize

public Dimension getMaximumSize()

Returns the component's maximum size.

Returns:

See Also:


getMinimumSize

public Dimension getMinimumSize()

Returns the component's minimum size.

Returns:

See Also:


getMouseListeners

public synchronized MouseListener[] getMouseListeners()

Returns an array of all specified listeners registered on this component.

Since:Returns:

See Also:


getMouseMotionListeners

public synchronized MouseMotionListener[] getMouseMotionListeners()

Returns an array of all specified listeners registered on this component.

Since:Returns:

See Also:


getMouseWheelListeners

public synchronized MouseWheelListener[] getMouseWheelListeners()

Returns an array of all specified listeners registered on this component.

Since:Returns:

See Also:


getName

public String getName()

Returns the name of this component.

Since:Returns:

See Also:


getParent

public Container getParent()

Returns the parent of this component.

Returns:


getPeer

public ComponentPeer getPeer()

Returns the native windowing system peer for this component. Only the platform specific implementation code should call this method. #isDisplayable() instead

Returns:


getPreferredSize

public Dimension getPreferredSize()

Returns the component's preferred size.

Returns:

See Also:


getPropertyChangeListeners

public PropertyChangeListener[] getPropertyChangeListeners()

Returns an array of all specified listeners registered on this component.

Since:Returns:

See Also:


getPropertyChangeListeners

public PropertyChangeListener[] getPropertyChangeListeners(java.lang.String property)

Returns an array of all specified listeners on the named property that are registered on this component.

Since:Parameters:

Returns:

See Also:


getSize

public Dimension getSize()

Returns the size of this object.

Since:Returns:

See Also:


getSize

public Dimension getSize(java.awt.Dimension d)

Returns the size of this component. This allows reuse of an existing dimension, if d is non-null.

Parameters:

Returns:


getToolkit

public Toolkit getToolkit()

Returns the toolkit in use for this component. The toolkit is associated with the frame this component belongs to.

Returns:


getTreeLock

public final Object getTreeLock()

Returns the object used for synchronization locks on this component when performing tree and layout functions.

Returns:


getWidth

public int getWidth()

Gets the width of the component. This is more efficient than getBounds().width or getSize().width.

Since:Returns:


getX

public int getX()

Gets the x coordinate of the upper left corner. This is more efficient than getBounds().x or getLocation().x.

Since:Returns:


getY

public int getY()

Gets the y coordinate of the upper left corner. This is more efficient than getBounds().y or getLocation().y.

Since:Returns:


gotFocus

public boolean gotFocus(java.awt.Event evt, java.lang.Object what)

AWT 1.0 focus event.

Parameters:

Returns:


handleEvent

public boolean handleEvent(java.awt.Event evt)

AWT 1.0 event processor.

Parameters:

Returns:


hasFocus

public boolean hasFocus()

Tests if this component is the focus owner. Use #isFocusOwner() instead.

Since:Returns:


hide

public void hide()

Hides this component so that it is no longer shown on the screen.


imageUpdate

public boolean imageUpdate(java.awt.Image img, int flags, int x, int y, int w, int h)

Called when an image has changed so that this component is repainted. This incrementally draws an image as more bits are available, when possible. Incremental drawing is enabled if the system property awt.image.incrementalDraw is not present or is true, in which case the redraw rate is set to 100ms or the value of the system property awt.image.redrawrate.

The coordinate system used depends on the particular flags.

Parameters:

Returns:

See Also:


inside

public boolean inside(int x, int y)

Tests whether or not the specified point is contained within this component. Coordinates are relative to this component.

Parameters:

Returns:


invalidate

public void invalidate()

Invalidates this component and all of its parent components. This will cause them to have their layout redone. This is called frequently, so make it fast.


isBackgroundSet

public boolean isBackgroundSet()

Tests if the background was explicitly set, or just inherited from the parent.

Since:Returns:


isCursorSet

public boolean isCursorSet()

Tests if the cursor was explicitly set, or just inherited from the parent.

Since:Returns:


isDisplayable

public boolean isDisplayable()

Tests if the component is displayable. It must be connected to a native screen resource, and all its ancestors must be displayable. A containment hierarchy is made displayable when a window is packed or made visible.

Since:Returns:

See Also:


isDoubleBuffered

public boolean isDoubleBuffered()

Checks if this image is painted to an offscreen image buffer that is later copied to screen (double buffering reduces flicker). This version returns false, so subclasses must override it if they provide double buffering.

Returns:


isEnabled

public boolean isEnabled()

Tests whether or not this component is enabled. Components are enabled by default, and must be enabled to receive user input or generate events.

Returns:

See Also:


isFocusCycleRoot

public boolean isFocusCycleRoot(java.awt.Container c)

Tests if the container is the ancestor of the focus cycle that this component belongs to.

Since:Parameters:

Returns:


isFocusOwner

public boolean isFocusOwner()

Tests if this component is the focus owner.

Since:Returns:


isFocusTraversable

public boolean isFocusTraversable()

Tests whether or not this component is in the group that can be traversed using the keyboard traversal mechanism (such as the TAB key).

Since:Returns:

See Also:


isFocusable

public boolean isFocusable()

Tests if this component can receive focus.

Since:Returns:


isFontSet

public boolean isFontSet()

Tests if the font was explicitly set, or just inherited from the parent.

Since:Returns:


isForegroundSet

public boolean isForegroundSet()

Tests if the foreground was explicitly set, or just inherited from the parent.

Since:Returns:


isLightweight

public boolean isLightweight()

Return whether the component is lightweight. That means the component has no native peer, but is displayable. This applies to subclasses of Component not in this package, such as javax.swing.

Since:Returns:

See Also:


isOpaque

public boolean isOpaque()

Tests if this component is opaque. All "heavyweight" (natively-drawn) components are opaque. A component is opaque if it draws all pixels in the bounds; a lightweight component is partially transparent if it lets pixels underneath show through. Subclasses that guarantee that all pixels will be drawn should override this.

Since:Returns:

See Also:


isShowing

public boolean isShowing()

Tests whether or not this component is actually being shown on the screen. This will be true if and only if it this component is visible and its parent components are all visible.

Returns:

See Also:


isValid

public boolean isValid()

Tests whether or not this component is valid. A invalid component needs to have its layout redone.

Returns:

See Also:


isVisible

public boolean isVisible()

Tests whether or not this component is visible. Except for top-level frames, components are initially visible.

Returns:

See Also:


keyDown

public boolean keyDown(java.awt.Event evt, int key)

AWT 1.0 key press event.

Parameters:

Returns:


keyUp

public boolean keyUp(java.awt.Event evt, int key)

AWT 1.0 key press event.

Parameters:

Returns:


layout

public void layout()

Calls the layout manager to re-layout the component. This is called during validation of a container in most cases.


list

public void list()

Prints a listing of this component to System.out.

See Also:


list

public void list(java.io.PrintStream out)

Prints a listing of this component to the specified print stream.

Parameters:


list

public void list(java.io.PrintStream out, int indent)

Prints a listing of this component to the specified print stream, starting at the specified indentation point.

Parameters:


list

public void list(java.io.PrintWriter out)

Prints a listing of this component to the specified print writer.

Since:Parameters:


list

public void list(java.io.PrintWriter out, int indent)

Prints a listing of this component to the specified print writer, starting at the specified indentation point.

Since:Parameters:


locate

public Component locate(int x, int y)

Returns the component occupying the position (x,y). This will either be this component, an immediate child component, or null if neither of the first two occupies the specified location.

Parameters:

Returns:


location

public Point location()

Returns the location of this component's top left corner relative to its parent component.

Returns:


lostFocus

public boolean lostFocus(java.awt.Event evt, java.lang.Object what)

AWT 1.0 focus event.

Parameters:

Returns:


minimumSize

public Dimension minimumSize()

Returns the component's minimum size.

Returns:


mouseDown

public boolean mouseDown(java.awt.Event evt, int x, int y)

AWT 1.0 mouse event.

Parameters:

Returns:


mouseDrag

public boolean mouseDrag(java.awt.Event evt, int x, int y)

AWT 1.0 mouse event.

Parameters:

Returns:


mouseEnter

public boolean mouseEnter(java.awt.Event evt, int x, int y)

AWT 1.0 mouse event.

Parameters:

Returns:


mouseExit

public boolean mouseExit(java.awt.Event evt, int x, int y)

AWT 1.0 mouse event.

Parameters:

Returns:


mouseMove

public boolean mouseMove(java.awt.Event evt, int x, int y)

AWT 1.0 mouse event.

Parameters:

Returns:


mouseUp

public boolean mouseUp(java.awt.Event evt, int x, int y)

AWT 1.0 mouse event.

Parameters:

Returns:


move

public void move(int x, int y)

Moves this component to the specified location, relative to the parent's coordinates. The coordinates are the new upper left corner of this component.

Parameters:


nextFocus

public void nextFocus()

AWT 1.0 focus event processor.


paint

public void paint(java.awt.Graphics g)

Paints this component on the screen. The clipping region in the graphics context will indicate the region that requires painting. This is called whenever the component first shows, or needs to be repaired because something was temporarily drawn on top. It is not necessary for subclasses to call super.paint(g). Components with no area are not painted.

Parameters:

See Also:


paintAll

public void paintAll(java.awt.Graphics g)

Paints this entire component, including any sub-components.

Parameters:

See Also:


paramString

protected String paramString()

Returns a debugging string representing this component. The string may be empty but not null.

Returns:


postEvent

public boolean postEvent(java.awt.Event e)

AWT 1.0 event dispatcher.

Parameters:

Returns:


preferredSize

public Dimension preferredSize()

Returns the component's preferred size.

Returns:


prepareImage

public boolean prepareImage(java.awt.Image image, int width, int height, java.awt.image.ImageObserver observer)

Prepares the specified image for rendering on this component at the specified scaled width and height

Parameters:

Returns:


prepareImage

public boolean prepareImage(java.awt.Image image, java.awt.image.ImageObserver observer)

Prepares the specified image for rendering on this component.

Parameters:

Returns:

Throws:


print

public void print(java.awt.Graphics g)

Prints this component. This method is provided so that printing can be done in a different manner from painting. However, the implementation in this class simply calls the paint() method.

Parameters:

See Also:


printAll

public void printAll(java.awt.Graphics g)

Prints this component, including all sub-components. This method is provided so that printing can be done in a different manner from painting. However, the implementation in this class simply calls the paintAll() method.

Parameters:

See Also:


processComponentEvent

protected void processComponentEvent(java.awt.event.ComponentEvent e)

Called when a component event is dispatched and component events are enabled. This method passes the event along to any listeners that are attached.

Since:Parameters:

Throws:

See Also:


processEvent

protected void processEvent(java.awt.AWTEvent e)

Processes the specified event. In this class, this method simply calls one of the more specific event handlers.

Since:Parameters:

Throws:

See Also:


processFocusEvent

protected void processFocusEvent(java.awt.event.FocusEvent e)

Called when a focus event is dispatched and component events are enabled. This method passes the event along to any listeners that are attached.

Since:Parameters:

Throws:

See Also:


processHierarchyBoundsEvent

protected void processHierarchyBoundsEvent(java.awt.event.HierarchyEvent e)

Called when a hierarchy bounds event is dispatched and component events are enabled. This method passes the event along to any listeners that are attached.

Since:Parameters:

Throws:

See Also:


processHierarchyEvent

protected void processHierarchyEvent(java.awt.event.HierarchyEvent e)

Called when a hierarchy change event is dispatched and component events are enabled. This method passes the event along to any listeners that are attached.

Since:Parameters:

Throws:

See Also:


processInputMethodEvent

protected void processInputMethodEvent(java.awt.event.InputMethodEvent e)

Called when an input method event is dispatched and component events are enabled. This method passes the event along to any listeners that are attached.

Since:Parameters:

Throws:

See Also:


processKeyEvent

protected void processKeyEvent(java.awt.event.KeyEvent e)

Called when a key event is dispatched and component events are enabled. This method passes the event along to any listeners that are attached.

Since:Parameters:

Throws:

See Also:


processMouseEvent

protected void processMouseEvent(java.awt.event.MouseEvent e)

Called when a regular mouse event is dispatched and component events are enabled. This method passes the event along to any listeners that are attached.

Since:Parameters:

Throws:

See Also:


processMouseMotionEvent

protected void processMouseMotionEvent(java.awt.event.MouseEvent e)

Called when a mouse motion event is dispatched and component events are enabled. This method passes the event along to any listeners that are attached.

Since:Parameters:

Throws:

See Also:


processMouseWheelEvent

protected void processMouseWheelEvent(java.awt.event.MouseWheelEvent e)

Called when a mouse wheel event is dispatched and component events are enabled. This method passes the event along to any listeners that are attached.

Since:Parameters:

Throws:

See Also:


remove

public synchronized void remove(java.awt.MenuComponent popup)

Removes the specified popup menu from this component.

Since:Parameters:

See Also:


removeComponentListener

public synchronized void removeComponentListener(java.awt.event.ComponentListener l)

Removes the specified listener from the component. This is harmless if the listener was not previously registered.

Since:Parameters:

See Also:


removeFocusListener

public synchronized void removeFocusListener(java.awt.event.FocusListener l)

Removes the specified listener from the component. This is harmless if the listener was not previously registered.

Since:Parameters:

See Also:


removeHierarchyBoundsListener

public synchronized void removeHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener l)

Removes the specified listener from the component. This is harmless if the listener was not previously registered.

Since:Parameters:

See Also:


removeHierarchyListener

public synchronized void removeHierarchyListener(java.awt.event.HierarchyListener l)

Removes the specified listener from the component. This is harmless if the listener was not previously registered.

Since:Parameters:

See Also:


removeInputMethodListener

public synchronized void removeInputMethodListener(java.awt.event.InputMethodListener l)

Removes the specified listener from the component. This is harmless if the listener was not previously registered.

Since:Parameters:

See Also:


removeKeyListener

public synchronized void removeKeyListener(java.awt.event.KeyListener l)

Removes the specified listener from the component. This is harmless if the listener was not previously registered.

Since:Parameters:

See Also:


removeMouseListener

public synchronized void removeMouseListener(java.awt.event.MouseListener l)

Removes the specified listener from the component. This is harmless if the listener was not previously registered.

Since:Parameters:

See Also:


removeMouseMotionListener

public synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener l)

Removes the specified listener from the component. This is harmless if the listener was not previously registered.

Since:Parameters:

See Also:


removeMouseWheelListener

public synchronized void removeMouseWheelListener(java.awt.event.MouseWheelListener l)

Removes the specified listener from the component. This is harmless if the listener was not previously registered.

Since:Parameters:

See Also:


removeNotify

public void removeNotify()

Called to inform this component is has been removed from its container. Its native peer - if any - is destroyed at this time. This method is called automatically by the AWT system and should not be called by user level code.

See Also:


removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

Removes the specified property listener from the component. This is harmless if the listener was not previously registered.

Since:Parameters:

See Also:


removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)

Removes the specified property listener on a particular property from the component. This is harmless if the listener was not previously registered.

Since:Parameters:

See Also:


repaint

public void repaint()

Repaint this entire component. The update() method on this component will be called as soon as possible.

See Also:


repaint

public void repaint(int x, int y, int w, int h)

Repaints the specified rectangular region within this component. The update method on this component will be called as soon as possible. The coordinates are relative to this component.

Parameters:

See Also:


repaint

public void repaint(long tm)

Repaint this entire component. The update() method on this component will be called in approximate the specified number of milliseconds.

Parameters:

See Also:


repaint

public void repaint(long tm, int x, int y, int width, int height)

Repaints the specified rectangular region within this component. The update method on this component will be called in approximately the specified number of milliseconds. The coordinates are relative to this component.

Parameters:

See Also:


requestFocus

public void requestFocus()

Requests that this component be given focus. A FOCUS_GAINED event will be fired if and only if this request is successful. To be successful, the component must be displayable, visible, and focusable, and the top-level Window must be able to receive focus. Thus, this request may fail, or be delayed until the window receives focus. It is recommended that requestFocusInWindow be used where possible to be more platform-independent.

See Also:


requestFocus

protected boolean requestFocus(boolean temporary)

Requests that this component be given focus. A FOCUS_GAINED event will be fired if and only if this request is successful. To be successful, the component must be displayable, visible, and focusable, and the top-level Window must be able to receive focus. Thus, this request may fail, or be delayed until the window receives focus. It is recommended that requestFocusInWindow be used where possible to be more platform-independent.

If the return value is false, the request is guaranteed to fail. If it is true, it will likely succeed unless the action is vetoed or something in the native windowing system intervenes. The temporary flag, and thus this method in general, is not designed for public use; rather it is a hook for lightweight components to notify their container in an attempt to reduce the amount of repainting necessary.

Since:Parameters:

Returns:

See Also:


requestFocusInWindow

public boolean requestFocusInWindow()

Requests that this component be given focus, if it resides in the top-level window which already has focus. A FOCUS_GAINED event will be fired if and only if this request is successful. To be successful, the component must be displayable, visible, and focusable, and the top-level Window must be focused.

If the return value is false, the request is guaranteed to fail. If it is true, it will likely succeed unless the action is vetoed or something in the native windowing system intervenes. The temporary flag, and thus this method in general, is not designed for public use; rather it is a hook for lightweight components to notify their container in an attempt to reduce the amount of repainting necessary.

Since:Returns:

See Also:


requestFocusInWindow

protected boolean requestFocusInWindow(boolean temporary)

Requests that this component be given focus, if it resides in the top-level window which already has focus. A FOCUS_GAINED event will be fired if and only if this request is successful. To be successful, the component must be displayable, visible, and focusable, and the top-level Window must be focused.

If the return value is false, the request is guaranteed to fail. If it is true, it will likely succeed unless the action is vetoed or something in the native windowing system intervenes. The temporary flag, and thus this method in general, is not designed for public use; rather it is a hook for lightweight components to notify their container in an attempt to reduce the amount of repainting necessary.

Since:Parameters:

Returns:

See Also:


reshape

public void reshape(int x, int y, int width, int height)

Sets the bounding rectangle for this component to the specified values. Note that these coordinates are relative to the parent, not to the screen.

Parameters:


resize

public void resize(int width, int height)

Sets the size of this component to the specified value.

Parameters:


resize

public void resize(java.awt.Dimension d)

Sets the size of this component to the specified value.

Parameters:

Throws:


setBackground

public void setBackground(java.awt.Color c)

Sets this component's background color to the specified color. The parts of the component affected by the background color may by system dependent. This is a bound property.

Parameters:

See Also:


setBounds

public void setBounds(int x, int y, int w, int h)

Sets the bounding rectangle for this component to the specified values. Note that these coordinates are relative to the parent, not to the screen.

Since:Parameters:

See Also:


setBounds

public void setBounds(java.awt.Rectangle r)

Sets the bounding rectangle for this component to the specified rectangle. Note that these coordinates are relative to the parent, not to the screen.

Since:Parameters:

Throws:

See Also:


setComponentOrientation

public void setComponentOrientation(java.awt.ComponentOrientation o)

Sets the text layout orientation of this component. New components default to UNKNOWN (which behaves like LEFT_TO_RIGHT). This method affects only the current component, while #applyComponentOrientation(ComponentOrientation) affects the entire hierarchy.

Parameters:

Throws:

See Also:


setCursor

public void setCursor(java.awt.Cursor cursor)

Sets the cursor for this component to the specified cursor. The cursor is displayed when the point is contained by the component, and the component is visible, displayable, and enabled. This is inherited by subcomponents unless they set their own cursor.

Parameters:

See Also:


setDropTarget

public void setDropTarget(java.awt.dnd.DropTarget dt)

Set the associated drag-and-drop target, which receives events when this is enabled.

Parameters:

See Also:


setEnabled

public void setEnabled(boolean b)

Enables or disables this component. The component must be enabled to receive events (except that lightweight components always receive mouse events).

Since:Parameters:

See Also:


setFocusTraversalKeys

public void setFocusTraversalKeys(int id, java.util.Set keystrokes)

Sets the focus traversal keys for a given type of focus events. Normally, the default values should match the operating system's native choices. To disable a given traversal, use Collections.EMPTY_SET. The event dispatcher will consume PRESSED, RELEASED, and TYPED events for the specified key, although focus can only transfer on PRESSED or RELEASED.

The defauts are:

IdentifierMeaningDefault
KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS Normal forward traversal TAB on KEY_PRESSED, Ctrl-TAB on KEY_PRESSED
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS Normal backward traversal Shift-TAB on KEY_PRESSED, Ctrl-Shift-TAB on KEY_PRESSED
KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS Go up a traversal cycleNone

Specifying null allows inheritance from the parent, or from the current KeyboardFocusManager default set. If not null, the set must contain only AWTKeyStrokes that are not already focus keys and are not KEY_TYPED events.

Since:Parameters:

Throws:

See Also:


setFocusTraversalKeysEnabled

public void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled)

Sets whether focus traversal keys are enabled, which consumes traversal keys and performs the focus event automatically.

Since:Parameters:

See Also:


setFocusable

public void setFocusable(boolean focusable)

Specify whether this component can receive focus.

Since:Parameters:


setFont

public void setFont(java.awt.Font f)

Sets the font for this component to the specified font. This is a bound property.

Parameters:

See Also:


setForeground

public void setForeground(java.awt.Color c)

Sets this component's foreground color to the specified color. This is a bound property.

Parameters:

See Also:


setIgnoreRepaint

public void setIgnoreRepaint(boolean ignoreRepaint)

Sets whether paint messages delivered by the operating system should be ignored. This does not affect messages from AWT, except for those triggered by OS messages. Setting this to true can allow faster performance in full-screen mode or page-flipping.

Since:Parameters:

See Also:


setLocale

public void setLocale(java.util.Locale l)

Sets the locale for this component to the specified locale. This is a bound property.

Parameters:


setLocation

public void setLocation(int x, int y)

Moves this component to the specified location, relative to the parent's coordinates. The coordinates are the new upper left corner of this component.

Parameters:

See Also:


setLocation

public void setLocation(java.awt.Point p)

Moves this component to the specified location, relative to the parent's coordinates. The coordinates are the new upper left corner of this component.

Since:Parameters:

Throws:

See Also:


setName

public void setName(java.lang.String name)

Sets the name of this component to the specified name.

Since:Parameters:

See Also:


setSize

public void setSize(int width, int height)

Sets the size of this component to the specified width and height.

Parameters:

See Also:


setSize

public void setSize(java.awt.Dimension d)

Sets the size of this component to the specified value.

Since:Parameters:

Throws:

See Also:


setVisible

public void setVisible(boolean b)

Makes this component visible or invisible. Note that it wtill might not show the component, if a parent is invisible.

Since:Parameters:

See Also:


show

public void show()

Makes this component visible on the screen.


show

public void show(boolean b)

Makes this component visible or invisible.

Parameters:


size

public Dimension size()

Returns the size of this object.

Returns:


toString

public String toString()

Returns a string representation of this component. This is implemented as getClass().getName() + '[' + paramString() + ']'.

Returns:


transferFocus

public void transferFocus()

Transfers focus to the next component in the focus traversal order, as though this were the current focus owner.

Since:See Also:


transferFocusBackward

public void transferFocusBackward()

Transfers focus to the previous component in the focus traversal order, as though this were the current focus owner.

Since:See Also:


transferFocusUpCycle

public void transferFocusUpCycle()

Transfers focus to the focus cycle root of this component. However, if this is a Window, the default focus owner in the window in the current focus cycle is focused instead.

Since:See Also:


update

public void update(java.awt.Graphics g)

Updates this component. This is called in response to repaint. This method fills the component with the background color, then sets the foreground color of the specified graphics context to the foreground color of this component and calls the paint() method. The coordinates of the graphics are relative to this component. Subclasses should call either super.update(g) or paint(g).

Parameters:

See Also:


validate

public void validate()

Called to ensure that the layout for this component is valid. This is usually called on containers.

See Also: