Java java.awt Component fields, constructors, methods, implement or subclass

Example usage for Java java.awt Component fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for java.awt Component.

The text is from its open source code.

Subclass

java.awt.Component has subclasses.
Click this link to see all its subclasses.

Field

floatTOP_ALIGNMENT
Ease-of-use constant for getAlignmentY() .
floatCENTER_ALIGNMENT
Ease-of-use constant for getAlignmentY and getAlignmentX .
floatBOTTOM_ALIGNMENT
Ease-of-use constant for getAlignmentY .
floatLEFT_ALIGNMENT
Ease-of-use constant for getAlignmentX .
floatRIGHT_ALIGNMENT
Ease-of-use constant for getAlignmentX .

Constructor

Component()
Constructs a new component.

Method

voidadd(PopupMenu popup)
Adds the specified popup menu to the component.
voidaddComponentListener(ComponentListener l)
Adds the specified component listener to receive component events from this component.
voidaddFocusListener(FocusListener l)
Adds the specified focus listener to receive focus events from this component when this component gains input focus.
voidaddHierarchyBoundsListener(HierarchyBoundsListener l)
Adds the specified hierarchy bounds listener to receive hierarchy bounds events from this component when the hierarchy to which this container belongs changes.
voidaddHierarchyListener(HierarchyListener l)
Adds the specified hierarchy listener to receive hierarchy changed events from this component when the hierarchy to which this container belongs changes.
voidaddInputMethodListener(InputMethodListener l)
Adds the specified input method listener to receive input method events from this component.
voidaddKeyListener(KeyListener l)
Adds the specified key listener to receive key events from this component.
voidaddMouseListener(MouseListener l)
Adds the specified mouse listener to receive mouse events from this component.
voidaddMouseMotionListener(MouseMotionListener l)
Adds the specified mouse motion listener to receive mouse motion events from this component.
voidaddMouseWheelListener(MouseWheelListener l)
Adds the specified mouse wheel listener to receive mouse wheel events from this component.
voidaddNotify()
Makes this Component displayable by connecting it to a native screen resource.
voidaddPropertyChangeListener(String propertyName, PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property.
voidaddPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list.
voidapplyComponentOrientation(ComponentOrientation orientation)
Sets the ComponentOrientation property of this component and all components contained within it.
booleancontains(int x, int y)
Checks whether this component "contains" the specified point, where x and y are defined to be relative to the coordinate system of this component.
booleancontains(Point p)
Checks whether this component "contains" the specified point, where the point's x and y coordinates are defined to be relative to the coordinate system of this component.
ImagecreateImage(int width, int height)
Creates an off-screen drawable image to be used for double buffering.
ImagecreateImage(ImageProducer producer)
Creates an image from the specified image producer.
voiddispatchEvent(AWTEvent e)
Dispatches an event to this component or one of its sub components.
voiddoLayout()
Prompts the layout manager to lay out this component.
booleanequals(Object obj)
Indicates whether some other object is "equal to" this one.
AccessibleContextgetAccessibleContext()
Gets the AccessibleContext associated with this Component .
floatgetAlignmentX()
Returns the alignment along the x axis.
floatgetAlignmentY()
Returns the alignment along the y axis.
ColorgetBackground()
Gets the background color of this component.
RectanglegetBounds()
Gets the bounds of this component in the form of a Rectangle object.
ClassgetClass()
Returns the runtime class of this Object .
ComponentgetComponentAt(int x, int y)
Determines if this component or one of its immediate subcomponents contains the (xy) location, and if so, returns the containing component.
ComponentOrientationgetComponentOrientation()
Retrieves the language-sensitive orientation that is to be used to order the elements or text within this component.
CursorgetCursor()
Gets the cursor set in the component.
ContainergetFocusCycleRootAncestor()
Returns the Container which is the focus cycle root of this Component's focus traversal cycle.
FocusListener[]getFocusListeners()
Returns an array of all the focus listeners registered on this component.
FontgetFont()
Gets the font of this component.
FontMetricsgetFontMetrics(Font font)
Gets the font metrics for the specified font.
ColorgetForeground()
Gets the foreground color of this component.
GraphicsgetGraphics()
Creates a graphics context for this component.
GraphicsConfigurationgetGraphicsConfiguration()
Gets the GraphicsConfiguration associated with this Component .
intgetHeight()
Returns the current height of this component.
KeyListener[]getKeyListeners()
Returns an array of all the key listeners registered on this component.
T[]getListeners(Class listenerType)
Returns an array of all the objects currently registered as FooListeners upon this Component .
LocalegetLocale()
Gets the locale of this component.
PointgetLocation()
Gets the location of this component in the form of a point specifying the component's top-left corner.
PointgetLocationOnScreen()
Gets the location of this component in the form of a point specifying the component's top-left corner in the screen's coordinate space.
DimensiongetMaximumSize()
Gets the maximum size of this component.
DimensiongetMinimumSize()
Gets the minimum size of this component.
MouseListener[]getMouseListeners()
Returns an array of all the mouse listeners registered on this component.
MouseMotionListener[]getMouseMotionListeners()
Returns an array of all the mouse motion listeners registered on this component.
StringgetName()
Gets the name of the component.
ContainergetParent()
Gets the parent of this component.
DimensiongetPreferredSize()
Gets the preferred size of this component.
DimensiongetSize()
Returns the size of this component in the form of a Dimension object.
ToolkitgetToolkit()
Gets the toolkit of this component.
ObjectgetTreeLock()
Gets this component's locking object (the object that owns the thread synchronization monitor) for AWT component-tree and layout operations.
intgetWidth()
Returns the current width of this component.
intgetX()
Returns the current x coordinate of the components origin.
intgetY()
Returns the current y coordinate of the components origin.
booleanhasFocus()
Returns true if this Component is the focus owner.
voidinvalidate()
Invalidates this component and its ancestors.
booleanisDisplayable()
Determines whether this component is displayable.
booleanisDoubleBuffered()
Returns true if this component is painted to an offscreen image ("buffer") that's copied to the screen later.
booleanisEnabled()
Determines whether this component is enabled.
booleanisFocusable()
Returns whether this Component can be focused.
booleanisMaximumSizeSet()
Returns true if the maximum size has been set to a non- null value otherwise returns false.
booleanisOpaque()
Returns true if this component is completely opaque, returns false by default.
booleanisShowing()
Determines whether this component is showing on screen.
booleanisValid()
Determines whether this component is valid.
booleanisVisible()
Determines whether this component should be visible when its parent is visible.
DimensionminimumSize()
Returns the minimum size of this component.
voidpaint(Graphics g)
Paints this component.
voidpaintAll(Graphics g)
Paints this component and all of its subcomponents.
DimensionpreferredSize()
Returns the component's preferred size.
voidprint(Graphics g)
Prints this component.
voidprintAll(Graphics g)
Prints this component and all of its subcomponents.
voidremoveFocusListener(FocusListener l)
Removes the specified focus listener so that it no longer receives focus events from this component.
voidremoveKeyListener(KeyListener l)
Removes the specified key listener so that it no longer receives key events from this component.
voidremoveMouseListener(MouseListener l)
Removes the specified mouse listener so that it no longer receives mouse events from this component.
voidremoveMouseMotionListener(MouseMotionListener l)
Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component.
voidremoveNotify()
Makes this Component undisplayable by destroying it native screen resource.
voidrepaint()
Repaints this component.
voidrequestFocus()
Requests that this Component get the input focus, and that this Component's top-level ancestor become the focused Window.
booleanrequestFocusInWindow()
Requests that this Component get the input focus, if this Component's top-level ancestor is already the focused Window.
voidrevalidate()
Revalidates the component hierarchy up to the nearest validate root.
voidsetBackground(Color c)
Sets the background color of this component.
voidsetBounds(int x, int y, int width, int height)
Moves and resizes this component.
voidsetBounds(Rectangle r)
Moves and resizes this component to conform to the new bounding rectangle r .
voidsetComponentOrientation(ComponentOrientation o)
Sets the language-sensitive orientation that is to be used to order the elements or text within this component.
voidsetCursor(Cursor cursor)
Sets the cursor image to the specified cursor.
voidsetEnabled(boolean b)
Enables or disables this component, depending on the value of the parameter b .
voidsetFocusable(boolean focusable)
Sets the focusable state of this Component to the specified value.
voidsetFocusTraversalKeys(int id, Set keystrokes)
Sets the focus traversal keys for a given traversal operation for this Component.
voidsetFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled)
Sets whether focus traversal keys are enabled for this Component.
voidsetFont(Font f)
Sets the font of this component.
voidsetForeground(Color c)
Sets the foreground color of this component.
voidsetIgnoreRepaint(boolean ignoreRepaint)
Sets whether or not paint messages received from the operating system should be ignored.
voidsetLocale(Locale l)
Sets the locale of this component.
voidsetLocation(Point p)
Moves this component to a new location.
voidsetLocation(int x, int y)
Moves this component to a new location.
voidsetMaximumSize(Dimension maximumSize)
Sets the maximum size of this component to a constant value.
voidsetMinimumSize(Dimension minimumSize)
Sets the minimum size of this component to a constant value.
voidsetName(String name)
Sets the name of the component to the specified string.
voidsetPreferredSize(Dimension preferredSize)
Sets the preferred size of this component to a constant value.
voidsetSize(Dimension d)
Resizes this component so that it has width d.width and height d.height .
voidsetSize(int width, int height)
Resizes this component so that it has width width and height height .
voidsetVisible(boolean b)
Shows or hides this component depending on the value of parameter b .
StringtoString()
Returns a string representation of this component and its values.
voidupdate(Graphics g)
Updates this component.
voidvalidate()
Validates this component.