Save This Page
Home » openjdk-7 » java » awt » [javadoc | source]
java.awt
abstract public class: Component [javadoc | source]
java.lang.Object
   java.awt.Component

All Implemented Interfaces:
    MenuContainer, Serializable, ImageObserver

Direct Known Subclasses:
    SynthTableCellRenderer, Canvas, JTabbedPane, Choice, DateRenderer, JPanel, TestCellRenderer, Button, NoFocusButton, MetalTitlePane, SwatchPanel, DefaultEditor, TextArea, HeavyWeightWindow, DefaultPreviewPanel, SynthComboPopup, JInternalFrame, FileRenderer, IconRenderer, BasicArrowButton, JEditorPane, JMenuItem, DefaultSwatchChooserPanel, JTextField, TaskBar, SynthComboBoxRenderer, SharedOwnerFrame, JComboBox, AlignedLabel, ScrollableTabPanel, JList, JToolTip, ScrollableTabViewport, SynthArrowButton, BasicComboBoxRenderer, ChooserComboPopup, MainSwatchPanel, AbstractColorChooserPanel, JDesktopPane, MetalComboPopup, DefaultCellRenderer, SwatchChooserPanel, JTableHeader, MetalInternalFrameTitlePane, DefaultFrame, RecentSwatchPanel, MetalComboBoxButton, TabContainer, ListEditor, SystemMenuBar, Box, List, JSlider, TextComponent, SynthTreeCellRenderer, ProgressOptionPane, MultiplexingTextField, AbstractButton, SwatchPanel, DoubleRenderer, JFormattedTextField, JToolBar, DefaultTextField, JScrollBar, JProgressBar, JFileChooser, FrameEditorPane, UIResource, BasicComboPopup, JButton, MainSwatchPanel, ColorChooserDialog, JPasswordField, BooleanRenderer, JTextArea, JCheckBox, FilterComboBoxRenderer, DragWindow, SynthBooleanTableCellRenderer, JMenuBar, DefaultListCellRenderer, JPopupMenu, DefaultRGBChooserPanel, JDialog, Dialog, SystemMenuBar, BorderDialog, JColorChooser, JLayeredPane, CroppedEdge, JToggleButton, JScrollPane, JSeparator, DefaultTreeCellRenderer, JWindow, JRadioButton, JOptionPane, JRootPane, UIResource, SynthListCellRenderer, RecentSwatchPanel, JViewport, Checkbox, JDesktopIcon, SynthInternalFrameTitlePane, JTable, UIResource, DefaultHSBChooserPanel, JRadioButtonMenuItem, JMenu, Frame, Container, ConstrainedButton, Separator, NumberEditor, ScrollBar, Separator, MetalScrollButton, JTree, JTextComponent, JSpinner, JCheckBoxMenuItem, Panel, JPopupMenuUIResource, JFrame, BorderlessTextField, JLabel, Filler, DirectoryComboBoxRenderer, JTextPane, JSplitPane, DateEditor, SynthScrollableTabButton, Window, HeaderRenderer, ChooserComboButton, Label, BasicInternalFrameTitlePane, ScrollableTabButton, NumberRenderer, Scrollbar, BorderChooser, TextField, JComponent, DefaultTableCellRenderer

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.

Nested Class Summary:
class  Component.HeavyweightInLightweightListener  This class fixes the bounds for a Heavyweight component that is placed inside a Lightweight container. When the lightweight is moved or resized, setBounds for the lightweight peer does nothing. Therefore, it was never moved on the screen. This class is attached to the lightweight, and it adjusts the position and size of the peer when notified. This is the same for show and hide. 
abstract protected class  Component.AccessibleAWTComponent  This class provides accessibility support for subclasses of container. 
protected class  Component.BltBufferStrategy  This class provides support for blitting offscreen surfaces to a component. 
protected class  Component.FlipBufferStrategy  This class provides support for flipping component buffers. It can only be used on Canvases and Windows. 
Field Summary
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. 
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. 
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. 
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. 
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. 
static final  Object treeLock    Make the treelock a String so that it can easily be identified in debug dumps. We clone the String in order to avoid a conflict in the unlikely event that some other package uses exactly the same string as a lock object. 
 int x    The x position of the component in the parent's coordinate system. 
 int y    The y position of the component in the parent's coordinate system. 
 int width    The component width. 
 int height    The component height. 
 Color foreground    The foreground color for the component. This may be null. 
 Color background    The background color for the component. This may be null. 
 Font font    The default font used in the component. This may be null. 
 Font peerFont    The font in use by the peer, or null if there is no peer.
    serial: the - peer's font
 
 Cursor cursor    The cursor displayed when the pointer is over this component. This may be null. 
 Locale locale    The locale for the component. 
 boolean ignoreRepaint    True if the object should ignore repaint events (usually because it is not showing). 
 boolean visible    True when the object is visible (although it is only showing if all ancestors are likewise visible). For component, this defaults to true. 
 boolean enabled    True if the object is enabled, meaning it can interact with the user. For component, this defaults to true. 
 boolean valid    True if the object is valid. This is set to false any time a size adjustment means the component need to be layed out again. 
 DropTarget dropTarget    The DropTarget for drag-and-drop operations. 
 Vector popups    The list of popup menus for this component. 
 String name    The component's name. May be null, in which case a default name is generated on the first use. 
 boolean nameExplicitlySet    True once the user has set the name. Note that the user may set the name to null. 
 boolean focusable    Indicates if the object can be focused. Defaults to true for components. 
 int isFocusTraversableOverridden    Tracks whether this component's #isFocusTraversable method has been overridden.
    since: 1.4 -
 
 Set[] focusTraversalKeys    The focus traversal keys, if not inherited from the parent or default keyboard focus manager. These sets will contain only AWTKeyStrokes that represent press and release events to use as focus control. 
 boolean focusTraversalKeysEnabled    True if focus traversal keys are enabled. This defaults to true for Component. If this is true, keystrokes in focusTraversalKeys are trapped and processed automatically rather than being passed on to the component. 
 Dimension minSize    Cached information on the minimum size. Should have been transient.
    serial: ignore -
 
 Dimension prefSize    Cached information on the preferred size. Should have been transient.
    serial: ignore -
 
 boolean newEventsOnly    Set to true if an event is to be handled by this component, false if it is to be passed up the hierarcy. 
 long eventMask    Set by subclasses to enable event handling of particular events, and left alone when modifying listeners. For component, this defaults to enabling only input methods. 
 PropertyChangeSupport changeSupport    Describes all registered PropertyChangeListeners. 
 boolean isPacked    True if the component has been packed (layed out).
    serial: true - if this is packed
 
 int componentSerializedDataVersion    The serialization version for this class. Currently at version 4. XXX How do we handle prior versions?
    serial: the - serialization version
 
 AccessibleContext accessibleContext    The accessible context associated with this component. This is only set by subclasses. 
transient  ComponentListener componentListener    Component listener chain. 
transient  FocusListener focusListener    Focus listener chain. 
transient  KeyListener keyListener    Key listener chain. 
transient  MouseListener mouseListener    Mouse listener chain. 
transient  MouseMotionListener mouseMotionListener    Mouse motion listener chain. 
transient  MouseWheelListener mouseWheelListener    Mouse wheel listener chain.
    since: 1.4 -
 
transient  InputMethodListener inputMethodListener    Input method listener chain.
    since: 1.2 -
 
transient  HierarchyListener hierarchyListener    Hierarcy listener chain.
    since: 1.3 -
 
transient  HierarchyBoundsListener hierarchyBoundsListener    Hierarcy bounds listener chain.
    since: 1.3 -
 
transient  Container parent    The parent. 
transient  ComponentPeer peer    The associated native peer. 
transient  ComponentOrientation orientation    The preferred component orientation. 
transient  GraphicsConfiguration graphicsConfig    The associated graphics configuration.
    since: 1.4 -
 
transient  BufferStrategy bufferStrategy    The buffer strategy for repainting.
    since: 1.4 -
 
Constructor:
 protected Component() 
Method from java.awt.Component Summary:
action,   add,   addComponentListener,   addFocusListener,   addHierarchyBoundsListener,   addHierarchyListener,   addInputMethodListener,   addKeyListener,   addMouseListener,   addMouseMotionListener,   addMouseWheelListener,   addNotify,   addPropertyChangeListener,   addPropertyChangeListener,   applyComponentOrientation,   areFocusTraversalKeysSet,   bounds,   checkImage,   checkImage,   coalesceEvents,   contains,   contains,   createImage,   createImage,   createVolatileImage,   createVolatileImage,   deliverEvent,   disable,   disableEvents,   dispatchEvent,   dispatchEventImpl,   doLayout,   enable,   enable,   enableEvents,   enableInputMethods,   eventTypeEnabled,   findNextFocusComponent,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   generateName,   getAccessibleContext,   getAlignmentX,   getAlignmentY,   getBackground,   getBounds,   getBounds,   getColorModel,   getComponentAt,   getComponentAt,   getComponentListeners,   getComponentOrientation,   getCursor,   getDropTarget,   getFocusCycleRootAncestor,   getFocusListeners,   getFocusTraversalKeys,   getFocusTraversalKeysEnabled,   getFont,   getFontMetrics,   getForeground,   getGraphics,   getGraphicsConfiguration,   getGraphicsConfigurationImpl,   getHeight,   getHierarchyBoundsListeners,   getHierarchyListeners,   getIgnoreRepaint,   getInputContext,   getInputMethodListeners,   getInputMethodRequests,   getKeyListeners,   getListeners,   getLocale,   getLocation,   getLocation,   getLocationOnScreen,   getMaximumSize,   getMinimumSize,   getMouseListeners,   getMouseMotionListeners,   getMouseWheelListeners,   getName,   getParent,   getPeer,   getPreferredSize,   getPropertyChangeListeners,   getPropertyChangeListeners,   getSize,   getSize,   getToolkit,   getTreeLock,   getWidth,   getX,   getY,   gotFocus,   handleEvent,   hasFocus,   hide,   imageUpdate,   inside,   invalidate,   isBackgroundSet,   isCursorSet,   isDisplayable,   isDoubleBuffered,   isEnabled,   isFocusCycleRoot,   isFocusOwner,   isFocusTraversable,   isFocusable,   isFontSet,   isForegroundSet,   isLightweight,   isOpaque,   isShowing,   isValid,   isVisible,   keyDown,   keyUp,   layout,   list,   list,   list,   list,   list,   locate,   location,   lostFocus,   minimumSize,   mouseDown,   mouseDrag,   mouseEnter,   mouseExit,   mouseMove,   mouseUp,   move,   nextFocus,   paint,   paintAll,   paramString,   postEvent,   preferredSize,   prepareImage,   prepareImage,   print,   printAll,   processComponentEvent,   processEvent,   processFocusEvent,   processHierarchyBoundsEvent,   processHierarchyEvent,   processInputMethodEvent,   processKeyEvent,   processMouseEvent,   processMouseMotionEvent,   processMouseWheelEvent,   remove,   removeComponentListener,   removeFocusListener,   removeHierarchyBoundsListener,   removeHierarchyListener,   removeInputMethodListener,   removeKeyListener,   removeMouseListener,   removeMouseMotionListener,   removeMouseWheelListener,   removeNotify,   removePropertyChangeListener,   removePropertyChangeListener,   repaint,   repaint,   repaint,   repaint,   requestFocus,   requestFocus,   requestFocusInWindow,   requestFocusInWindow,   reshape,   resize,   resize,   setBackground,   setBounds,   setBounds,   setComponentOrientation,   setCursor,   setDropTarget,   setEnabled,   setFocusTraversalKeys,   setFocusTraversalKeysEnabled,   setFocusable,   setFont,   setForeground,   setIgnoreRepaint,   setLocale,   setLocation,   setLocation,   setName,   setPeer,   setSize,   setSize,   setVisible,   show,   show,   size,   toString,   transferFocus,   transferFocusBackward,   transferFocusUpCycle,   translateEvent,   update,   validate
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.awt.Component Detail:
 public boolean action(Event evt,
    Object what) 
Deprecated! in - classes which support actions, use processActionEvent(ActionEvent) instead

    AWT 1.0 ACTION_EVENT event handler. This method is meant to be overridden by components providing their own action event handler. The default implementation simply returns false.
 public synchronized  void add(PopupMenu popup) 
    Adds the specified popup menu to this component.
 public synchronized  void addComponentListener(ComponentListener listener) 
    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.
 public synchronized  void addFocusListener(FocusListener listener) 
    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.
 public synchronized  void addHierarchyBoundsListener(HierarchyBoundsListener listener) 
    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.
 public synchronized  void addHierarchyListener(HierarchyListener listener) 
    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.
 public synchronized  void addInputMethodListener(InputMethodListener listener) 
    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.
 public synchronized  void addKeyListener(KeyListener listener) 
    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.
 public synchronized  void addMouseListener(MouseListener listener) 
    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.
 public synchronized  void addMouseMotionListener(MouseMotionListener listener) 
    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.
 public synchronized  void addMouseWheelListener(MouseWheelListener listener) 
    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.
 public  void addNotify() 
    Called when the parent of this Component is made visible or when the Component is added to an already visible Container and needs to be shown. 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.
 public  void addPropertyChangeListener(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:
    • the font ("font")
    • the background color ("background")
    • the foreground color ("foreground")
    • the focusability ("focusable")
    • the focus key traversal enabled state ("focusTraversalKeysEnabled")
    • the set of forward traversal keys ("forwardFocusTraversalKeys")
    • the set of backward traversal keys ("backwardFocusTraversalKeys")
    • the set of up-cycle traversal keys ("upCycleFocusTraversalKeys")
 public  void addPropertyChangeListener(String propertyName,
    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:
    • the font ("font")
    • the background color ("background")
    • the foreground color ("foreground")
    • the focusability ("focusable")
    • the focus key traversal enabled state ("focusTraversalKeysEnabled")
    • the set of forward traversal keys ("forwardFocusTraversalKeys")
    • p *
    • the set of backward traversal keys ("backwardFocusTraversalKeys")
    • the set of up-cycle traversal keys ("upCycleFocusTraversalKeys")
 public  void applyComponentOrientation(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.
 public boolean areFocusTraversalKeysSet(int id) 
    Tests whether the focus traversal keys for a given action are explicitly set or inherited.
 public Rectangle bounds() 
Deprecated! use - #getBounds() instead

    Returns a bounding rectangle for this component. Note that the returned rectange is relative to this component's parent, not to the screen.
 public int checkImage(Image image,
    ImageObserver observer) 
    Returns the status of the loading of the specified image. The value returned will be those flags defined in ImageObserver.
 public int checkImage(Image image,
    int width,
    int height,
    ImageObserver observer) 
    Returns the status of the loading of the specified image. The value returned will be those flags defined in ImageObserver.
 protected AWTEvent coalesceEvents(AWTEvent existingEvent,
    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).
 public boolean contains(Point p) 
    Tests whether or not the specified point is contained within this component. Coordinates are relative to this component.
 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.
 public Image createImage(ImageProducer producer) 
    Creates an image from the specified producer.
 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.
 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.
 public VolatileImage createVolatileImage(int width,
    int height,
    ImageCapabilities caps) throws AWTException 
    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.
 public  void deliverEvent(Event e) 
Deprecated! use - (AWTEvent) instead

    AWT 1.0 event delivery. Deliver an AWT 1.0 event to this Component. This method simply calls #postEvent .
 public  void disable() 
Deprecated! use - #setEnabled(boolean) instead

    Disables this component.
 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.
 public final  void dispatchEvent(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
  void dispatchEventImpl(AWTEvent e) 
    Implementation of dispatchEvent. Allows trusted package classes to dispatch additional events first. This implementation first translates e to an AWT 1.0 event and sends the result to #postEvent . If the AWT 1.0 event is not handled, and events of type e are enabled for this component, e is passed on to #processEvent .
 public  void doLayout() 
    Calls the layout manager to re-layout the component. This is called during validation of a container in most cases.
 public  void enable() 
Deprecated! use - #setEnabled(boolean) instead

    Enables this component.
 public  void enable(boolean enabled) 
Deprecated! use - #setEnabled(boolean) instead

    Enables or disables this component.
 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.

 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.
 boolean eventTypeEnabled(int type) 
    Tells whether or not an event type is enabled.
 Component findNextFocusComponent(Component child) 
    This method is used to implement transferFocus(). CHILD is the child making the request. This is overridden by Container; when called for an ordinary component there is no child and so we always return null. FIXME: is this still needed, in light of focus traversal policies?
 protected  void firePropertyChange(String propertyName,
    Object oldValue,
    Object newValue) 
    Report a change in a bound property to any registered property listeners.
 protected  void firePropertyChange(String propertyName,
    boolean oldValue,
    boolean newValue) 
    Report a change in a bound property to any registered property listeners.
 protected  void firePropertyChange(String propertyName,
    int oldValue,
    int newValue) 
    Report a change in a bound property to any registered property listeners.
 public  void firePropertyChange(String propertyName,
    byte oldValue,
    byte newValue) 
    Report a change in a bound property to any registered property listeners.
 public  void firePropertyChange(String propertyName,
    char oldValue,
    char newValue) 
    Report a change in a bound property to any registered property listeners.
 public  void firePropertyChange(String propertyName,
    short oldValue,
    short newValue) 
    Report a change in a bound property to any registered property listeners.
 public  void firePropertyChange(String propertyName,
    long oldValue,
    long newValue) 
    Report a change in a bound property to any registered property listeners.
 public  void firePropertyChange(String propertyName,
    float oldValue,
    float newValue) 
    Report a change in a bound property to any registered property listeners.
 public  void firePropertyChange(String propertyName,
    double oldValue,
    double newValue) 
    Report a change in a bound property to any registered property listeners.
 String generateName() 
    Subclasses should override this to return unique component names like "menuitem0".
 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 .
 public float getAlignmentX() 
 public float getAlignmentY() 
 public Color getBackground() 
    Returns this component's background color. If not set, this is inherited from the parent.
 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.
 public Rectangle getBounds(Rectangle r) 
    Returns the bounds of this component. This allows reuse of an existing rectangle, if r is non-null.
 public ColorModel getColorModel() 
    Returns the color model of the device this componet is displayed on.
 public Component getComponentAt(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.
 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.
 public synchronized ComponentListener[] getComponentListeners() 
    Returns an array of all specified listeners registered on this component.
 public ComponentOrientation getComponentOrientation() 
    Determines the text layout orientation used by this component.
 public Cursor getCursor() 
    Returns the cursor for this component. If not set, this is inherited from the parent, or from Cursor.getDefaultCursor().
 public DropTarget getDropTarget() 
    Gets the associated drag-and-drop target, if there is one.
 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.
 public synchronized FocusListener[] getFocusListeners() 
    Returns an array of all specified listeners registered on this component.
 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.
 public boolean getFocusTraversalKeysEnabled() 
    Check whether or not focus traversal keys are enabled on this Component. If they are, then the keyboard focus manager consumes and acts on key press and release events that trigger focus traversal, and discards the corresponding key typed events. If focus traversal keys are disabled, then all key events that would otherwise trigger focus traversal are sent to this Component.
 public Font getFont() 
    Returns the font in use for this component. If not set, this is inherited from the parent.
 public FontMetrics getFontMetrics(Font font) 
    Returns the font metrics for the specified font in this component.
 public Color getForeground() 
    Returns this component's foreground color. If not set, this is inherited from the parent.
 public Graphics getGraphics() 
    Returns a graphics object for this component. Returns null if this component is not currently displayed on the screen.
 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.
 GraphicsConfiguration getGraphicsConfigurationImpl() 
    Implementation method that allows classes such as Canvas and Window to override the graphics configuration without violating the published API.
 public int getHeight() 
    Gets the height of the component. This is more efficient than getBounds().height or getSize().height.
 public synchronized HierarchyBoundsListener[] getHierarchyBoundsListeners() 
    Returns an array of all specified listeners registered on this component.
 public synchronized HierarchyListener[] getHierarchyListeners() 
    Returns an array of all specified listeners registered on this component.
 public boolean getIgnoreRepaint() 
    Test whether paint events from the operating system are ignored.
 public InputContext getInputContext() 
    Gets the input context of this component, which is inherited from the parent unless this is overridden.
 public synchronized InputMethodListener[] getInputMethodListeners() 
    Returns an array of all specified listeners registered on this component.
 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.
 public synchronized KeyListener[] getKeyListeners() 
    Returns an array of all specified listeners registered on this component.
 public EventListener[] getListeners(Class listenerType) 
    Returns all registered EventListener s of the given listenerType.
 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.
 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.
 public Point getLocation(Point p) 
    Returns the location of this component. This allows reuse of an existing point, if p is non-null.
 public Point getLocationOnScreen() 
    Returns the location of this component's top left corner in screen coordinates.
 public Dimension getMaximumSize() 
    Returns the component's maximum size.
 public Dimension getMinimumSize() 
    Returns the component's minimum size.
 public synchronized MouseListener[] getMouseListeners() 
    Returns an array of all specified listeners registered on this component.
 public synchronized MouseMotionListener[] getMouseMotionListeners() 
    Returns an array of all specified listeners registered on this component.
 public synchronized MouseWheelListener[] getMouseWheelListeners() 
    Returns an array of all specified listeners registered on this component.
 public String getName() 
    Returns the name of this component.
 public Container getParent() 
    Returns the parent of this component.
 public ComponentPeer getPeer() 
Deprecated! user - programs should not directly manipulate peers; use #isDisplayable() instead

    Returns the native windowing system peer for this component. Only the platform specific implementation code should call this method.
 public Dimension getPreferredSize() 
    Returns the component's preferred size.
 public PropertyChangeListener[] getPropertyChangeListeners() 
    Returns an array of all specified listeners registered on this component.
 public PropertyChangeListener[] getPropertyChangeListeners(String property) 
    Returns an array of all specified listeners on the named property that are registered on this component.
 public Dimension getSize() 
    Returns the size of this object.
 public Dimension getSize(Dimension d) 
    Returns the size of this component. This allows reuse of an existing dimension, if d is non-null.
 public Toolkit getToolkit() 
    Returns the toolkit in use for this component. The toolkit is associated with the frame this component belongs to.
 public final Object getTreeLock() 
    Returns the object used for synchronization locks on this component when performing tree and layout functions.
 public int getWidth() 
    Gets the width of the component. This is more efficient than getBounds().width or getSize().width.
 public int getX() 
    Gets the x coordinate of the upper left corner. This is more efficient than getBounds().x or getLocation().x.
 public int getY() 
    Gets the y coordinate of the upper left corner. This is more efficient than getBounds().y or getLocation().y.
 public boolean gotFocus(Event evt,
    Object what) 
Deprecated! use - #processFocusEvent(FocusEvent) instead

    AWT 1.0 GOT_FOCUS event handler. This method is meant to be overridden by components providing their own GOT_FOCUS handler. The default implementation simply returns false.
 public boolean handleEvent(Event evt)