java.lang.Object | +--java.awt.ComponentAll Implemented Interfaces:
static float | BOTTOM_ALIGNMENT Constant returned by the |
static float | CENTER_ALIGNMENT Constant returned by the |
static float | LEFT_ALIGNMENT Constant returned by the |
static float | RIGHT_ALIGNMENT Constant returned by the |
static float | TOP_ALIGNMENT Constant returned by the |
Component() Default constructor for subclasses. |
boolean | action(java.awt.Event evt, java.lang.Object what) AWT 1.0 action event processor. |
synchronized void | add(java.awt.PopupMenu popup) Adds the specified popup menu to this component. |
synchronized void | addComponentListener(java.awt.event.ComponentListener l) Adds the specified listener to this component. |
synchronized void | addFocusListener(java.awt.event.FocusListener l) Adds the specified listener to this component. |
synchronized void | addHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener l) Adds the specified listener to this component. |
synchronized void | addHierarchyListener(java.awt.event.HierarchyListener l) Adds the specified listener to this component. |
synchronized void | addInputMethodListener(java.awt.event.InputMethodListener l) Adds the specified listener to this component. |
synchronized void | addKeyListener(java.awt.event.KeyListener l) Adds the specified listener to this component. |
synchronized void | addMouseListener(java.awt.event.MouseListener l) Adds the specified listener to this component. |
synchronized void | addMouseMotionListener(java.awt.event.MouseMotionListener l) Adds the specified listener to this component. |
synchronized void | addMouseWheelListener(java.awt.event.MouseWheelListener l) Adds the specified listener to this component. |
void | addNotify() Called to inform this component it has been added to a container. |
void | addPropertyChangeListener(java.beans.PropertyChangeListener listener) Adds the specified property listener to this component. |
void | addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener) Adds the specified property listener to this component. |
void | applyComponentOrientation(java.awt.ComponentOrientation o) Sets the text layout orientation of this component. |
boolean | areFocusTraversalKeysSet(int id) Tests whether the focus traversal keys for a given action are explicitly set or inherited. |
java.awt.Rectangle | bounds() Returns a bounding rectangle for this component. |
int | checkImage(java.awt.Image image, java.awt.image.ImageObserver observer) Returns the status of the loading of the specified image. |
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. |
java.awt.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. |
boolean | contains(int x, int y) Tests whether or not the specified point is contained within this component. |
boolean | contains(java.awt.Point p) Tests whether or not the specified point is contained within this component. |
java.awt.Image | createImage(java.awt.image.ImageProducer producer) Creates an image from the specified producer. |
java.awt.Image | createImage(int width, int height) Creates an image with the specified width and height for use in double buffering. |
java.awt.image.VolatileImage | createVolatileImage(int width, int height) Creates an image with the specified width and height for use in double buffering. |
java.awt.image.VolatileImage | createVolatileImage(int width, int height, java.awt.ImageCapabilities caps) Creates an image with the specified width and height for use in double buffering. |
void | deliverEvent(java.awt.Event e) AWT 1.0 event dispatcher. |
void | disable() Disables this component. |
void | disableEvents(long eventsToDisable) Disables the specified events. |
void | dispatchEvent(java.awt.AWTEvent e) Forwards AWT events to processEvent() if: |
void | doLayout() Calls the layout manager to re-layout the component. |
void | enable() Enables this component. |
void | enable(boolean b) Enables or disables this component. |
void | enableEvents(long eventsToEnable) Enables the specified events. |
void | enableInputMethods(boolean enable) Enables or disables input method support for this component. |
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. |
void | firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue) Report a change in a bound property to any registered property listeners. |
void | firePropertyChange(java.lang.String propertyName, int oldValue, int newValue) Report a change in a bound property to any registered property listeners. |
javax.accessibility.AccessibleContext | getAccessibleContext() Returns the accessibility framework context of this class. |
float | getAlignmentX() Returns the preferred horizontal alignment of this component. |
float | getAlignmentY() Returns the preferred vertical alignment of this component. |
java.awt.Color | getBackground() Returns this component's background color. |
java.awt.Rectangle | getBounds() Returns a bounding rectangle for this component. |
java.awt.Rectangle | getBounds(java.awt.Rectangle r) Returns the bounds of this component. |
java.awt.image.ColorModel | getColorModel() Returns the color model of the device this componet is displayed on. |
java.awt.Component | getComponentAt(int x, int y) Returns the component occupying the position (x,y). |
java.awt.Component | getComponentAt(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.ComponentOrientation | getComponentOrientation() Determines the text layout orientation used by this component. |
java.awt.Cursor | getCursor() Returns the cursor for this component. |
java.awt.dnd.DropTarget | getDropTarget() Gets the associated drag-and-drop target, if there is one. |
java.awt.Container | getFocusCycleRootAncestor() 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.Set | getFocusTraversalKeys(int id) Returns the set of keys for a given focus traversal action, as defined
in |
boolean | getFocusTraversalKeysEnabled() Tests whether focus traversal keys are enabled. |
java.awt.Font | getFont() Returns the font in use for this component. |
java.awt.FontMetrics | getFontMetrics(java.awt.Font font) Returns the font metrics for the specified font in this component. |
java.awt.Color | getForeground() Returns this component's foreground color. |
java.awt.Graphics | getGraphics() Returns a graphics object for this component. |
java.awt.GraphicsConfiguration | getGraphicsConfiguration() Returns the graphics configuration of this component, if there is one. |
int | getHeight() 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. |
boolean | getIgnoreRepaint() Test whether paint events from the operating system are ignored. |
java.awt.im.InputContext | getInputContext() 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.InputMethodRequests | getInputMethodRequests() 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.Locale | getLocale() Returns the locale for this component. |
java.awt.Point | getLocation() Returns the location of this component's top left corner relative to its parent component. |
java.awt.Point | getLocation(java.awt.Point p) Returns the location of this component. |
java.awt.Point | getLocationOnScreen() Returns the location of this component's top left corner in screen coordinates. |
java.awt.Dimension | getMaximumSize() Returns the component's maximum size. |
java.awt.Dimension | getMinimumSize() 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.String | getName() Returns the name of this component. |
java.awt.Container | getParent() Returns the parent of this component. |
java.awt.peer.ComponentPeer | getPeer() Returns the native windowing system peer for this component. |
java.awt.Dimension | getPreferredSize() 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.Dimension | getSize() Returns the size of this object. |
java.awt.Dimension | getSize(java.awt.Dimension d) Returns the size of this component. |
java.awt.Toolkit | getToolkit() Returns the toolkit in use for this component. |
java.lang.Object | getTreeLock() Returns the object used for synchronization locks on this component when performing tree and layout functions. |
int | getWidth() Gets the width of the component. |
int | getX() Gets the x coordinate of the upper left corner. |
int | getY() Gets the y coordinate of the upper left corner. |
boolean | gotFocus(java.awt.Event evt, java.lang.Object what) AWT 1.0 focus event. |
boolean | handleEvent(java.awt.Event evt) AWT 1.0 event processor. |
boolean | hasFocus() Tests if this component is the focus owner. |
void | hide() Hides this component so that it is no longer shown on the screen. |
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. |
boolean | inside(int x, int y) Tests whether or not the specified point is contained within this component. |
void | invalidate() Invalidates this component and all of its parent components. |
boolean | isBackgroundSet() Tests if the background was explicitly set, or just inherited from the parent. |
boolean | isCursorSet() Tests if the cursor was explicitly set, or just inherited from the parent. |
boolean | isDisplayable() Tests if the component is displayable. |
boolean | isDoubleBuffered() Checks if this image is painted to an offscreen image buffer that is later copied to screen (double buffering reduces flicker). |
boolean | isEnabled() Tests whether or not this component is enabled. |
boolean | isFocusCycleRoot(java.awt.Container c) Tests if the container is the ancestor of the focus cycle that this component belongs to. |
boolean | isFocusOwner() Tests if this component is the focus owner. |
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). |
boolean | isFocusable() Tests if this component can receive focus. |
boolean | isFontSet() Tests if the font was explicitly set, or just inherited from the parent. |
boolean | isForegroundSet() Tests if the foreground was explicitly set, or just inherited from the parent. |
boolean | isLightweight() Return whether the component is lightweight. |
boolean | isOpaque() Tests if this component is opaque. |
boolean | isShowing() Tests whether or not this component is actually being shown on the screen. |
boolean | isValid() Tests whether or not this component is valid. |
boolean | isVisible() Tests whether or not this component is visible. |
boolean | keyDown(java.awt.Event evt, int key) AWT 1.0 key press event. |
boolean | keyUp(java.awt.Event evt, int key) AWT 1.0 key press event. |
void | layout() Calls the layout manager to re-layout the component. |
void | list() Prints a listing of this component to |
void | list(java.io.PrintStream out) Prints a listing of this component to the specified print stream. |
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. |
void | list(java.io.PrintWriter out) Prints a listing of this component to the specified print writer. |
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. |
java.awt.Component | locate(int x, int y) Returns the component occupying the position (x,y). |
java.awt.Point | location() Returns the location of this component's top left corner relative to its parent component. |
boolean | lostFocus(java.awt.Event evt, java.lang.Object what) AWT 1.0 focus event. |
java.awt.Dimension | minimumSize() Returns the component's minimum size. |
boolean | mouseDown(java.awt.Event evt, int x, int y) AWT 1.0 mouse event. |
boolean | mouseDrag(java.awt.Event evt, int x, int y) AWT 1.0 mouse event. |
boolean | mouseEnter(java.awt.Event evt, int x, int y) AWT 1.0 mouse event. |
boolean | mouseExit(java.awt.Event evt, int x, int y) AWT 1.0 mouse event. |
boolean | mouseMove(java.awt.Event evt, int x, int y) AWT 1.0 mouse event. |
boolean | mouseUp(java.awt.Event evt, int x, int y) AWT 1.0 mouse event. |
void | move(int x, int y) Moves this component to the specified location, relative to the parent's coordinates. |
void | nextFocus() AWT 1.0 focus event processor. |
void | paint(java.awt.Graphics g) Paints this component on the screen. |
void | paintAll(java.awt.Graphics g) Paints this entire component, including any sub-components. |
java.lang.String | paramString() Returns a debugging string representing this component. |
boolean | postEvent(java.awt.Event e) AWT 1.0 event dispatcher. |
java.awt.Dimension | preferredSize() Returns the component's preferred size. |
boolean | prepareImage(java.awt.Image image, java.awt.image.ImageObserver observer) Prepares the specified image for rendering on this component. |
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 |
void | print(java.awt.Graphics g) Prints this component. |
void | printAll(java.awt.Graphics g) Prints this component, including all sub-components. |
void | processComponentEvent(java.awt.event.ComponentEvent e) Called when a component event is dispatched and component events are enabled. |
void | processEvent(java.awt.AWTEvent e) Processes the specified event. |
void | processFocusEvent(java.awt.event.FocusEvent e) Called when a focus event is dispatched and component events are enabled. |
void | processHierarchyBoundsEvent(java.awt.event.HierarchyEvent e) Called when a hierarchy bounds event is dispatched and component events are enabled. |
void | processHierarchyEvent(java.awt.event.HierarchyEvent e) Called when a hierarchy change event is dispatched and component events are enabled. |
void | processInputMethodEvent(java.awt.event.InputMethodEvent e) Called when an input method event is dispatched and component events are enabled. |
void | processKeyEvent(java.awt.event.KeyEvent e) Called when a key event is dispatched and component events are enabled. |
void | processMouseEvent(java.awt.event.MouseEvent e) Called when a regular mouse event is dispatched and component events are enabled. |
void | processMouseMotionEvent(java.awt.event.MouseEvent e) Called when a mouse motion event is dispatched and component events are enabled. |
void | processMouseWheelEvent(java.awt.event.MouseWheelEvent e) Called when a mouse wheel event is dispatched and component events are enabled. |
synchronized void | remove(java.awt.MenuComponent popup) Removes the specified popup menu from this component. |
synchronized void | removeComponentListener(java.awt.event.ComponentListener l) Removes the specified listener from the component. |
synchronized void | removeFocusListener(java.awt.event.FocusListener l) Removes the specified listener from the component. |
synchronized void | removeHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener l) Removes the specified listener from the component. |
synchronized void | removeHierarchyListener(java.awt.event.HierarchyListener l) Removes the specified listener from the component. |
synchronized void | removeInputMethodListener(java.awt.event.InputMethodListener l) Removes the specified listener from the component. |
synchronized void | removeKeyListener(java.awt.event.KeyListener l) Removes the specified listener from the component. |
synchronized void | removeMouseListener(java.awt.event.MouseListener l) Removes the specified listener from the component. |
synchronized void | removeMouseMotionListener(java.awt.event.MouseMotionListener l) Removes the specified listener from the component. |
synchronized void | removeMouseWheelListener(java.awt.event.MouseWheelListener l) Removes the specified listener from the component. |
void | removeNotify() Called to inform this component is has been removed from its container. |
void | removePropertyChangeListener(java.beans.PropertyChangeListener listener) Removes the specified property listener from the component. |
void | removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener) Removes the specified property listener on a particular property from the component. |
void | repaint() Repaint this entire component. |
void | repaint(long tm) Repaint this entire component. |
void | repaint(int x, int y, int w, int h) Repaints the specified rectangular region within this component. |
void | repaint(long tm, int x, int y, int width, int height) Repaints the specified rectangular region within this component. |
void | requestFocus() Requests that this component be given focus. |
boolean | requestFocus(boolean temporary) Requests that this component be given focus. |
boolean | requestFocusInWindow() Requests that this component be given focus, if it resides in the top-level window which already has focus. |
boolean | requestFocusInWindow(boolean temporary) Requests that this component be given focus, if it resides in the top-level window which already has focus. |
void | reshape(int x, int y, int width, int height) Sets the bounding rectangle for this component to the specified values. |
void | resize(int width, int height) Sets the size of this component to the specified value. |
void | resize(java.awt.Dimension d) Sets the size of this component to the specified value. |
void | setBackground(java.awt.Color c) Sets this component's background color to the specified color. |
void | setBounds(int x, int y, int w, int h) Sets the bounding rectangle for this component to the specified values. |
void | setBounds(java.awt.Rectangle r) Sets the bounding rectangle for this component to the specified rectangle. |
void | setComponentOrientation(java.awt.ComponentOrientation o) Sets the text layout orientation of this component. |
void | setCursor(java.awt.Cursor cursor) Sets the cursor for this component to the specified cursor. |
void | setDropTarget(java.awt.dnd.DropTarget dt) Set the associated drag-and-drop target, which receives events when this is enabled. |
void | setEnabled(boolean b) Enables or disables this component. |
void | setFocusTraversalKeys(int id, java.util.Set keystrokes) Sets the focus traversal keys for a given type of focus events. |
void | setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled, which consumes traversal keys and performs the focus event automatically. |
void | setFocusable(boolean focusable) Specify whether this component can receive focus. |
void | setFont(java.awt.Font f) Sets the font for this component to the specified font. |
void | setForeground(java.awt.Color c) Sets this component's foreground color to the specified color. |
void | setIgnoreRepaint(boolean ignoreRepaint) Sets whether paint messages delivered by the operating system should be ignored. |
void | setLocale(java.util.Locale l) Sets the locale for this component to the specified locale. |
void | setLocation(int x, int y) Moves this component to the specified location, relative to the parent's coordinates. |
void | setLocation(java.awt.Point p) Moves this component to the specified location, relative to the parent's coordinates. |
void | setName(java.lang.String name) Sets the name of this component to the specified name. |
void | setSize(int width, int height) Sets the size of this component to the specified width and height. |
void | setSize(java.awt.Dimension d) Sets the size of this component to the specified value. |
void | setVisible(boolean b) Makes this component visible or invisible. |
void | show() Makes this component visible on the screen. |
void | show(boolean b) Makes this component visible or invisible. |
java.awt.Dimension | size() Returns the size of this object. |
java.lang.String | toString() Returns a string representation of this component. |
void | transferFocus() Transfers focus to the next component in the focus traversal order, as though this were the current focus owner. |
void | transferFocusBackward() Transfers focus to the previous component in the focus traversal order, as though this were the current focus owner. |
void | transferFocusUpCycle() Transfers focus to the focus cycle root of this component. |
void | update(java.awt.Graphics g) Updates this component. |
void | validate() Called to ensure that the layout for this component is valid. |
public static final float BOTTOM_ALIGNMENT
getAlignmentY
method to indicate
that the component wishes to be aligned to the bottom relative to
other components.
public static final float CENTER_ALIGNMENT
getAlignmentY
and
getAlignmentX
methods to indicate
that the component wishes to be aligned to the center relative to
other components.
public static final float LEFT_ALIGNMENT
getAlignmentX
method to indicate
that the component wishes to be aligned to the left relative to
other components.
public static final float RIGHT_ALIGNMENT
getAlignmentX
method to indicate
that the component wishes to be aligned to the right relative to
other components.
public static final float TOP_ALIGNMENT
getAlignmentY
method to indicate
that the component wishes to be aligned to the top relative to
other components.
protected Component()
public boolean action(java.awt.Event evt, java.lang.Object what)
evt
- the event to handlewhat
- the object acted on, ignoredpublic synchronized void add(java.awt.PopupMenu popup)
popup
- the popup menu to be addedpublic synchronized void addComponentListener(java.awt.event.ComponentListener l)
l
- the new listener to addpublic synchronized void addFocusListener(java.awt.event.FocusListener l)
l
- the new listener to addpublic synchronized void addHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener l)
l
- the new listener to addpublic synchronized void addHierarchyListener(java.awt.event.HierarchyListener l)
l
- the new listener to addpublic synchronized void addInputMethodListener(java.awt.event.InputMethodListener l)
l
- the new listener to addInputMethodEvent
removeInputMethodListener(InputMethodListener)
getInputMethodListeners()
getInputMethodRequests()
public synchronized void addKeyListener(java.awt.event.KeyListener l)
l
- the new listener to addpublic synchronized void addMouseListener(java.awt.event.MouseListener l)
l
- the new listener to addpublic synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener l)
l
- the new listener to addpublic synchronized void addMouseWheelListener(java.awt.event.MouseWheelListener l)
l
- the new listener to addpublic void addNotify()
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
"font"
)"background"
)"foreground"
)"focusable"
)"focusTraversalKeysEnabled"
)"forwardFocusTraversalKeys"
)"backwardFocusTraversalKeys"
)"upCycleFocusTraversalKeys"
)listener
- the new listener to addremovePropertyChangeListener(PropertyChangeListener)
getPropertyChangeListeners()
addPropertyChangeListener(String, PropertyChangeListener)
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
"font"
)"background"
)"foreground"
)"focusable"
)"focusTraversalKeysEnabled"
)"forwardFocusTraversalKeys"
)"backwardFocusTraversalKeys"
)"upCycleFocusTraversalKeys"
)propertyName
- the property name to filter onlistener
- the new listener to addremovePropertyChangeListener(String, PropertyChangeListener)
getPropertyChangeListeners(String)
addPropertyChangeListener(PropertyChangeListener)
public void applyComponentOrientation(java.awt.ComponentOrientation o)
o
- the new orientationNullPointerException
- if o is nullpublic boolean areFocusTraversalKeysSet(int id)
id
- one of FORWARD_TRAVERSAL_KEYS, BACKWARD_TRAVERSAL_KEYS, or
UP_CYCLE_TRAVERSAL_KEYSIllegalArgumentException
- if id is invalidgetFocusTraversalKeys(int)
KeyboardFocusManager#FORWARD_TRAVERSAL_KEYS
KeyboardFocusManager#BACKWARD_TRAVERSAL_KEYS
KeyboardFocusManager#UP_CYCLE_TRAVERSAL_KEYS
public Rectangle bounds()
public int checkImage(java.awt.Image image, int width, int height, java.awt.image.ImageObserver observer)
ImageObserver
.
image
- the image to check onwidth
- the scaled image widthheight
- the scaled image heightobserver
- the observer to notify of image loading progresspublic int checkImage(java.awt.Image image, java.awt.image.ImageObserver observer)
ImageObserver
.
image
- the image to check onobserver
- the observer to notify of image loading progressNullPointerException
- if image is nullprotected AWTEvent coalesceEvents(java.awt.AWTEvent existingEvent, java.awt.AWTEvent newEvent)
existingEvent
- the event on the queuenewEvent
- the new event that might be entered on the queuepublic boolean contains(int x, int y)
x
- the X coordinate of the point to testy
- the Y coordinate of the point to testpublic boolean contains(java.awt.Point p)
p
- the point to testNullPointerException
- if p is nullpublic Image createImage(int width, int height)
width
- the width of the imageheight
- the height of the imagepublic Image createImage(java.awt.image.ImageProducer producer)
producer
- the image procedure to create the image frompublic VolatileImage createVolatileImage(int width, int height)
width
- the width of the imageheight
- the height of the imagepublic VolatileImage createVolatileImage(int width, int height, java.awt.ImageCapabilities caps)
width
- the width of the imageheight
- the height of the imagecaps
- the requested capabilitiesAWTException
- if a buffer with the capabilities cannot be createdpublic void deliverEvent(java.awt.Event e)
e
- the event to dispatchpublic void disable()
protected final void disableEvents(long eventsToDisable)
AWTEvent
.
eventsToDisable
- the desired events to disablepublic final void dispatchEvent(java.awt.AWTEvent e)
enableEvents()
e
- the event to dispatchpublic void doLayout()
public void enable()
public void enable(boolean b)
b
- true to enable this componentprotected final void enableEvents(long eventsToEnable)
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.
eventsToEnable
- the desired events to enablepublic void enableInputMethods(boolean enable)
enable
- true to enable input method processingprotected void firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)
propertyName
- the property that changedoldValue
- the old property valuenewValue
- the new property valueprotected void firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)
propertyName
- the property that changedoldValue
- the old property valuenewValue
- the new property valueprotected void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
propertyName
- the property that changedoldValue
- the old property valuenewValue
- the new property valuepublic AccessibleContext getAccessibleContext()
public float getAlignmentX()
public float getAlignmentY()
public Color getBackground()
public Rectangle getBounds()
public Rectangle getBounds(java.awt.Rectangle r)
r
- the rectangle to use, or nullpublic ColorModel getColorModel()
public Component getComponentAt(int x, int y)
null
if neither of the first two occupies the specified location.
x
- the X coordinate to search for components aty
- the Y coordinate to search for components atpublic Component getComponentAt(java.awt.Point p)
null
if neither of the first two occupies the specified location.
p
- the point to search for components atNullPointerException
- if p is nullpublic synchronized ComponentListener[] getComponentListeners()
public ComponentOrientation getComponentOrientation()
public Cursor getCursor()
public DropTarget getDropTarget()
public Container getFocusCycleRootAncestor()
public synchronized FocusListener[] getFocusListeners()
public Set getFocusTraversalKeys(int id)
setFocusTraversalKeys
. If not set, this is inherited from
the parent component, which may have gotten it from the
KeyboardFocusManager.
id
- one of FORWARD_TRAVERSAL_KEYS, BACKWARD_TRAVERSAL_KEYS, or
UP_CYCLE_TRAVERSAL_KEYSIllegalArgumentException
- if id is invalidsetFocusTraversalKeys(int, Set)
KeyboardFocusManager#FORWARD_TRAVERSAL_KEYS
KeyboardFocusManager#BACKWARD_TRAVERSAL_KEYS
KeyboardFocusManager#UP_CYCLE_TRAVERSAL_KEYS
public boolean getFocusTraversalKeysEnabled()
public Font getFont()
public FontMetrics getFontMetrics(java.awt.Font font)
font
- the font to retrieve metrics forNullPointerException
- if font is nullpublic Color getForeground()
public Graphics getGraphics()
null
if this component is not currently displayed on the screen.
public GraphicsConfiguration getGraphicsConfiguration()
public int getHeight()
public synchronized HierarchyBoundsListener[] getHierarchyBoundsListeners()
addHierarchyBoundsListener(HierarchyBoundsListener)
removeHierarchyBoundsListener(HierarchyBoundsListener)
public synchronized HierarchyListener[] getHierarchyListeners()
public boolean getIgnoreRepaint()
public InputContext getInputContext()
public synchronized InputMethodListener[] getInputMethodListeners()
public InputMethodRequests getInputMethodRequests()
public synchronized KeyListener[] getKeyListeners()
public EventListener[] getListeners(java.lang.Class listenerType)
listenerType
- the class of listeners to filtergetComponentListeners()
getFocusListeners()
getHierarchyListeners()
getHierarchyBoundsListeners()
getKeyListeners()
getMouseListeners()
getMouseMotionListeners()
getMouseWheelListeners()
getInputMethodListeners()
getPropertyChangeListeners()
public Locale getLocale()
IllegalComponentStateException
- if it has no locale or parentsetLocale(Locale)
public Point getLocation()
public Point getLocation(java.awt.Point p)
p
- the point to use, or nullpublic Point getLocationOnScreen()
IllegalComponentStateException
- if the component is not showingpublic Dimension getMaximumSize()
public Dimension getMinimumSize()
public synchronized MouseListener[] getMouseListeners()
public synchronized MouseMotionListener[] getMouseMotionListeners()
public synchronized MouseWheelListener[] getMouseWheelListeners()
public String getName()
public Container getParent()
public ComponentPeer getPeer()
public Dimension getPreferredSize()
public PropertyChangeListener[] getPropertyChangeListeners()
addPropertyChangeListener(PropertyChangeListener)
removePropertyChangeListener(PropertyChangeListener)
getPropertyChangeListeners(String)
public PropertyChangeListener[] getPropertyChangeListeners(java.lang.String property)
property
- addPropertyChangeListener(String, PropertyChangeListener)
removePropertyChangeListener(String, PropertyChangeListener)
getPropertyChangeListeners()
public Dimension getSize()
public Dimension getSize(java.awt.Dimension d)
d
- the dimension to use, or nullpublic Toolkit getToolkit()
public final Object getTreeLock()
public int getWidth()
public int getX()
public int getY()
public boolean gotFocus(java.awt.Event evt, java.lang.Object what)
evt
- the event to handlewhat
- the Object focused, ignoredpublic boolean handleEvent(java.awt.Event evt)
evt
- the event to handlepublic boolean hasFocus()
public void hide()
public boolean imageUpdate(java.awt.Image img, int flags, int x, int y, int w, int h)
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.
img
- the image that has been updatedflags
- tlags as specified in ImageObserver
x
- the X coordinatey
- the Y coordinatew
- the widthh
- the heightImageObserver
Graphics#drawImage(Image, int, int, Color, ImageObserver)
Graphics#drawImage(Image, int, int, ImageObserver)
Graphics#drawImage(Image, int, int, int, int, Color, ImageObserver)
Graphics#drawImage(Image, int, int, int, int, ImageObserver)
ImageObserver#update(Image, int, int, int, int, int)
public boolean inside(int x, int y)
x
- the X coordinate of the point to testy
- the Y coordinate of the point to testpublic void invalidate()
public boolean isBackgroundSet()
public boolean isCursorSet()
public boolean isDisplayable()
public boolean isDoubleBuffered()
public boolean isEnabled()
public boolean isFocusCycleRoot(java.awt.Container c)
c
- the container to testpublic boolean isFocusOwner()
public boolean isFocusTraversable()
public boolean isFocusable()
public boolean isFontSet()
public boolean isForegroundSet()
public boolean isLightweight()
public boolean isOpaque()
public boolean isShowing()
public boolean isValid()
public boolean isVisible()
public boolean keyDown(java.awt.Event evt, int key)
evt
- the event to handlekey
- the key pressed, ignoredpublic boolean keyUp(java.awt.Event evt, int key)
evt
- the event to handlekey
- the key pressed, ignoredpublic void layout()
public void list()
System.out
.
public void list(java.io.PrintStream out)
out
- the PrintStream
to print topublic void list(java.io.PrintStream out, int indent)
out
- the PrintStream
to print toindent
- the indentation pointpublic void list(java.io.PrintWriter out)
out
- the PrintWrinter
to print topublic void list(java.io.PrintWriter out, int indent)
out
- the PrintWriter
to print toindent
- the indentation pointpublic Component locate(int x, int y)
null
if neither of the first two occupies the specified location.
x
- the X coordinate to search for components aty
- the Y coordinate to search for components atpublic Point location()
public boolean lostFocus(java.awt.Event evt, java.lang.Object what)
evt
- the event to handlewhat
- the Object focused, ignoredpublic Dimension minimumSize()
public boolean mouseDown(java.awt.Event evt, int x, int y)
evt
- the event to handlex
- the x coordinate, ignoredy
- the y coordinate, ignoredpublic boolean mouseDrag(java.awt.Event evt, int x, int y)
evt
- the event to handlex
- the x coordinate, ignoredy
- the y coordinate, ignoredpublic boolean mouseEnter(java.awt.Event evt, int x, int y)
evt
- the event to handlex
- the x coordinate, ignoredy
- the y coordinate, ignoredpublic boolean mouseExit(java.awt.Event evt, int x, int y)
evt
- the event to handlex
- the x coordinate, ignoredy
- the y coordinate, ignoredpublic boolean mouseMove(java.awt.Event evt, int x, int y)
evt
- the event to handlex
- the x coordinate, ignoredy
- the y coordinate, ignoredpublic boolean mouseUp(java.awt.Event evt, int x, int y)
evt
- the event to handlex
- the x coordinate, ignoredy
- the y coordinate, ignoredpublic void move(int x, int y)
x
- the new X coordinate of this componenty
- the new Y coordinate of this componentpublic void nextFocus()
public void paint(java.awt.Graphics g)
super.paint(g)
. Components with no area
are not painted.
g
- the graphics context for this paint jobpublic void paintAll(java.awt.Graphics g)
g
- the graphics context for this paint jobprotected String paramString()
public boolean postEvent(java.awt.Event e)
e
- the event to dispatchpublic Dimension preferredSize()
public boolean prepareImage(java.awt.Image image, int width, int height, java.awt.image.ImageObserver observer)
image
- the image to prepare for renderingwidth
- the scaled width of the imageheight
- the scaled height of the imageobserver
- the observer to notify of image preparation statuspublic boolean prepareImage(java.awt.Image image, java.awt.image.ImageObserver observer)
image
- the image to prepare for renderingobserver
- the observer to notify of image preparation statusNullPointerException
- if image is nullpublic void print(java.awt.Graphics g)
paint()
method.
g
- the graphics context of the print devicepublic void printAll(java.awt.Graphics g)
paintAll()
method.
g
- the graphics context of the print deviceprotected void processComponentEvent(java.awt.event.ComponentEvent e)
e
- the ComponentEvent
to processNullPointerException
- if e is nullprotected void processEvent(java.awt.AWTEvent e)
e
- the event to processNullPointerException
- if e is nullprocessComponentEvent(ComponentEvent)
processFocusEvent(FocusEvent)
processKeyEvent(KeyEvent)
processMouseEvent(MouseEvent)
processMouseMotionEvent(MouseEvent)
processInputMethodEvent(InputMethodEvent)
processHierarchyEvent(HierarchyEvent)
processMouseWheelEvent(MouseWheelEvent)
protected void processFocusEvent(java.awt.event.FocusEvent e)
e
- the FocusEvent
to processNullPointerException
- if e is nullprotected void processHierarchyBoundsEvent(java.awt.event.HierarchyEvent e)
e
- the HierarchyEvent
to processNullPointerException
- if e is nullprotected void processHierarchyEvent(java.awt.event.HierarchyEvent e)
e
- the HierarchyEvent
to processNullPointerException
- if e is nullprotected void processInputMethodEvent(java.awt.event.InputMethodEvent e)
e
- the InputMethodEvent
to processNullPointerException
- if e is nullprotected void processKeyEvent(java.awt.event.KeyEvent e)
e
- the KeyEvent
to processNullPointerException
- if e is nullprotected void processMouseEvent(java.awt.event.MouseEvent e)
e
- the MouseEvent
to processNullPointerException
- if e is nullprotected void processMouseMotionEvent(java.awt.event.MouseEvent e)
e
- the MouseMotionEvent
to processNullPointerException
- if e is nullprotected void processMouseWheelEvent(java.awt.event.MouseWheelEvent e)
e
- the MouseWheelEvent
to processNullPointerException
- if e is nullpublic synchronized void remove(java.awt.MenuComponent popup)
popup
- the popup menu to removepublic synchronized void removeComponentListener(java.awt.event.ComponentListener l)
l
- the listener to removepublic synchronized void removeFocusListener(java.awt.event.FocusListener l)
l
- the listener to removepublic synchronized void removeHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener l)
l
- the listener to removepublic synchronized void removeHierarchyListener(java.awt.event.HierarchyListener l)
l
- the listener to removepublic synchronized void removeInputMethodListener(java.awt.event.InputMethodListener l)
l
- the listener to removepublic synchronized void removeKeyListener(java.awt.event.KeyListener l)
l
- the listener to removepublic synchronized void removeMouseListener(java.awt.event.MouseListener l)
l
- the listener to removepublic synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener l)
l
- the listener to removepublic synchronized void removeMouseWheelListener(java.awt.event.MouseWheelListener l)
l
- the listener to removepublic void removeNotify()
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- the listener to removeaddPropertyChangeListener(PropertyChangeListener)
getPropertyChangeListeners()
removePropertyChangeListener(String, PropertyChangeListener)
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
propertyName
- the property name to filter onlistener
- the listener to removeaddPropertyChangeListener(String, PropertyChangeListener)
getPropertyChangeListeners(String)
removePropertyChangeListener(PropertyChangeListener)
public void repaint()
update()
method
on this component will be called as soon as possible.
public void repaint(int x, int y, int w, int h)
update
method on this component will be called as soon as
possible. The coordinates are relative to this component.
x
- the X coordinate of the upper left of the region to repainty
- the Y coordinate of the upper left of the region to repaintw
- the width of the region to repainth
- the height of the region to repaintpublic void repaint(long tm)
update()
method on this
component will be called in approximate the specified number of
milliseconds.
tm
- milliseconds before this component should be repaintedpublic void repaint(long tm, int x, int y, int width, int height)
update
method on this component will be called in
approximately the specified number of milliseconds. The coordinates
are relative to this component.
tm
- milliseconds before this component should be repaintedx
- the X coordinate of the upper left of the region to repainty
- the Y coordinate of the upper left of the region to repaintwidth
- the width of the region to repaintheight
- the height of the region to repaintpublic void requestFocus()
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.
requestFocusInWindow()
FocusEvent
addFocusListener(FocusListener)
isFocusable()
isDisplayable()
KeyboardFocusManager#clearGlobalFocusOwner()
protected boolean requestFocus(boolean temporary)
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.
temporary
- true if the focus request is temporaryrequestFocusInWindow()
FocusEvent
addFocusListener(FocusListener)
isFocusable()
isDisplayable()
KeyboardFocusManager#clearGlobalFocusOwner()
public boolean requestFocusInWindow()
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.
requestFocus()
FocusEvent
addFocusListener(FocusListener)
isFocusable()
isDisplayable()
KeyboardFocusManager#clearGlobalFocusOwner()
protected boolean requestFocusInWindow(boolean temporary)
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.
temporary
- true if the focus request is temporaryrequestFocus()
FocusEvent
addFocusListener(FocusListener)
isFocusable()
isDisplayable()
KeyboardFocusManager#clearGlobalFocusOwner()
public void reshape(int x, int y, int width, int height)
x
- the X coordinate of the upper left corner of the rectangley
- the Y coordinate of the upper left corner of the rectanglewidth
- the width of the rectangleheight
- the height of the rectanglepublic void resize(int width, int height)
width
- the new width of the componentheight
- the new height of the componentpublic void resize(java.awt.Dimension d)
d
- the new size of this componentNullPointerException
- if d is nullpublic void setBackground(java.awt.Color c)
c
- the new background colorpublic void setBounds(int x, int y, int w, int h)
x
- the X coordinate of the upper left corner of the rectangley
- the Y coordinate of the upper left corner of the rectanglew
- the width of the rectangleh
- the height of the rectanglepublic void setBounds(java.awt.Rectangle r)
r
- the new bounding rectangleNullPointerException
- if r is nullpublic void setComponentOrientation(java.awt.ComponentOrientation o)
o
- the new orientationNullPointerException
- if o is nullpublic void setCursor(java.awt.Cursor cursor)
cursor
- the new cursor for this componentpublic void setDropTarget(java.awt.dnd.DropTarget dt)
dt
- the new drop targetpublic void setEnabled(boolean b)
b
- true to enable this componentpublic void setFocusTraversalKeys(int id, java.util.Set keystrokes)
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:
Identifier | Meaning | Default |
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 cycle | None |
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.
id
- one of FORWARD_TRAVERSAL_KEYS, BACKWARD_TRAVERSAL_KEYS, or
UP_CYCLE_TRAVERSAL_KEYSkeystrokes
- a set of keys, or nullIllegalArgumentException
- if id or keystrokes is invalidgetFocusTraversalKeys(int)
KeyboardFocusManager#FORWARD_TRAVERSAL_KEYS
KeyboardFocusManager#BACKWARD_TRAVERSAL_KEYS
KeyboardFocusManager#UP_CYCLE_TRAVERSAL_KEYS
public void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled)
focusTraversalKeysEnabled
- the new value of the flagpublic void setFocusable(boolean focusable)
focusable
- the new focusable statuspublic void setFont(java.awt.Font f)
f
- the new font for this componentpublic void setForeground(java.awt.Color c)
c
- the new foreground colorpublic void setIgnoreRepaint(boolean ignoreRepaint)
ignoreRepaint
- the new setting for ignoring repaint eventsgetIgnoreRepaint()
BufferStrategy
GraphicsDevice.setFullScreenWindow(Window)
public void setLocale(java.util.Locale l)
l
- the new locale for this componentpublic void setLocation(int x, int y)
x
- the new X coordinate of this componenty
- the new Y coordinate of this componentpublic void setLocation(java.awt.Point p)
p
- new coordinates for this componentNullPointerException
- if p is nullpublic void setName(java.lang.String name)
name
- the new name of this componentpublic void setSize(int width, int height)
width
- the new width of this componentheight
- the new height of this componentpublic void setSize(java.awt.Dimension d)
d
- the new size of this componentNullPointerException
- if d is nullpublic void setVisible(boolean b)
b
- true to make this component visiblepublic void show()
public void show(boolean b)
b
- true to make this component visiblepublic Dimension size()
public String toString()
getClass().getName() + '[' + paramString() + ']'
.
public void transferFocus()
public void transferFocusBackward()
public void transferFocusUpCycle()
public void update(java.awt.Graphics g)
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)
.
g
- the graphics context for this updatepublic void validate()
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.