Uses of Class
java.awt.Component
-
Packages that use Component Package Description java.awt Contains all of the classes for creating user interfaces and for painting graphics and images.java.awt.event Provides interfaces and classes for dealing with different types of events fired by AWT components. -
-
Uses of Component in java.awt
Subclasses of Component in java.awt Modifier and Type Class and Description class
Button
This class creates a labeled button.class
Canvas
ACanvas
component represents a blank rectangular area of the screen onto which the application can draw or from which the application can trap input events from the user.class
Checkbox
A check box is a graphical component that can be in either an "on" (true
) or "off" (false
) state.class
Choice
TheChoice
class presents a pop-up menu of choices.class
Container
A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT components.class
Dialog
A Dialog is a top-level window with a title and a border that is typically used to take some form of input from the user.class
FileDialog
TheFileDialog
class displays a dialog window from which the user can select a file.class
Frame
AFrame
is a top-level window with a title and a border.class
Label
ALabel
object is a component for placing text in a container.class
List
TheList
component presents the user with a scrolling list of text items.class
Panel
Panel
is the simplest container class.class
Scrollbar
TheScrollbar
class embodies a scroll bar, a familiar user-interface object.class
ScrollPane
A container class which implements automatic horizontal and/or vertical scrolling for a single child component.class
TextArea
ATextArea
object is a multi-line region that displays text.class
TextComponent
TheTextComponent
class is the superclass of any component that allows the editing of some text.class
TextField
ATextField
object is a text component that allows for the editing of a single line of text.class
Window
AWindow
object is a top-level window with no borders and no menubar.Fields in java.awt with type parameters of type Component Modifier and Type Field and Description protected java.util.Hashtable<Component,GridBagConstraints>
GridBagLayout. comptable
This hashtable maintains the association between a component and its gridbag constraints.Methods in java.awt that return Component Modifier and Type Method and Description Component
Container. add(Component comp)
Appends the specified component to the end of this container.Component
Container. add(Component comp, int index)
Adds the specified component to this container at the given position.Component
Container. add(java.lang.String name, Component comp)
Adds the specified component to this container.Component
Container. findComponentAt(int x, int y)
Locates the visible child component that contains the specified position.Component
Container. findComponentAt(Point p)
Locates the visible child component that contains the specified point.Component
Container. getComponent(int n)
Gets the nth component in this container.abstract Component
FocusTraversalPolicy. getComponentAfter(Container aContainer, Component aComponent)
Returns the Component that should receive the focus after aComponent.Component
ContainerOrderFocusTraversalPolicy. getComponentAfter(Container aContainer, Component aComponent)
Returns the Component that should receive the focus after aComponent.Component
Container. getComponentAt(int x, int y)
Locates the component that contains the x,y position.Component
Component. getComponentAt(int x, int y)
Determines if this component or one of its immediate subcomponents contains the (x, y) location, and if so, returns the containing component.Component
Container. getComponentAt(Point p)
Gets the component that contains the specified point.Component
Component. getComponentAt(Point p)
Returns the component or subcomponent that contains the specified point.abstract Component
FocusTraversalPolicy. getComponentBefore(Container aContainer, Component aComponent)
Returns the Component that should receive the focus before aComponent.Component
ContainerOrderFocusTraversalPolicy. getComponentBefore(Container aContainer, Component aComponent)
Returns the Component that should receive the focus before aComponent.Component[]
Container. getComponents()
Gets all the components in this container.abstract Component
FocusTraversalPolicy. getDefaultComponent(Container aContainer)
Returns the default Component to focus.Component
ContainerOrderFocusTraversalPolicy. getDefaultComponent(Container aContainer)
Returns the default Component to focus.abstract Component
FocusTraversalPolicy. getFirstComponent(Container aContainer)
Returns the first Component in the traversal cycle.Component
ContainerOrderFocusTraversalPolicy. getFirstComponent(Container aContainer)
Returns the first Component in the traversal cycle.Component
Window. getFocusOwner()
Returns the child Component of this Window that has focus if this Window is focused; returns null otherwise.Component
KeyboardFocusManager. getFocusOwner()
Returns the focus owner, if the focus owner is in the same context as the calling thread.protected Component
KeyboardFocusManager. getGlobalFocusOwner()
Returns the focus owner, even if the calling thread is in a different context than the focus owner.protected Component
KeyboardFocusManager. getGlobalPermanentFocusOwner()
Returns the permanent focus owner, even if the calling thread is in a different context than the permanent focus owner.Component
FocusTraversalPolicy. getInitialComponent(Window window)
Returns the Component that should receive the focus when a Window is made visible for the first time.abstract Component
FocusTraversalPolicy. getLastComponent(Container aContainer)
Returns the last Component in the traversal cycle.Component
ContainerOrderFocusTraversalPolicy. getLastComponent(Container aContainer)
Returns the last Component in the traversal cycle.Component
BorderLayout. getLayoutComponent(Container target, java.lang.Object constraints)
Returns the component that corresponds to the given constraint location based on the targetContainer
's component orientation.Component
BorderLayout. getLayoutComponent(java.lang.Object constraints)
Gets the component that was added using the given constraintComponent
Window. getMostRecentFocusOwner()
Returns the child Component of this Window that will receive the focus when this Window is focused.Component
KeyboardFocusManager. getPermanentFocusOwner()
Returns the permanent focus owner, if the permanent focus owner is in the same context as the calling thread.Component
Container. locate(int x, int y)
Deprecated. As of JDK version 1.1, replaced bygetComponentAt(int, int)
.Component
Component. locate(int x, int y)
Deprecated. As of JDK version 1.1, replaced by getComponentAt(int, int).Methods in java.awt with parameters of type Component Modifier and Type Method and Description protected boolean
DefaultFocusTraversalPolicy. accept(Component aComponent)
Determines whether a Component is an acceptable choice as the new focus owner.protected boolean
ContainerOrderFocusTraversalPolicy. accept(Component aComponent)
Determines whether a Component is an acceptable choice as the new focus owner.Component
Container. add(Component comp)
Appends the specified component to the end of this container.Component
Container. add(Component comp, int index)
Adds the specified component to this container at the given position.void
Container. add(Component comp, java.lang.Object constraints)
Adds the specified component to the end of this container.void
Container. add(Component comp, java.lang.Object constraints, int index)
Adds the specified component to this container with the specified constraints at the specified index.Component
Container. add(java.lang.String name, Component comp)
Adds the specified component to this container.protected void
ScrollPane. addImpl(Component comp, java.lang.Object constraints, int index)
Adds the specified component to this scroll pane container.protected void
Container. addImpl(Component comp, java.lang.Object constraints, int index)
Adds the specified component to this container at the specified index.void
LayoutManager2. addLayoutComponent(Component comp, java.lang.Object constraints)
Adds the specified component to the layout, using the specified constraint object.void
GridBagLayout. addLayoutComponent(Component comp, java.lang.Object constraints)
Adds the specified component to the layout, using the specifiedconstraints
object.void
CardLayout. addLayoutComponent(Component comp, java.lang.Object constraints)
Adds the specified component to this card layout's internal table of names.void
BorderLayout. addLayoutComponent(Component comp, java.lang.Object constraints)
Adds the specified component to the layout, using the specified constraint object.void
LayoutManager. addLayoutComponent(java.lang.String name, Component comp)
If the layout manager uses a per-component string, adds the componentcomp
to the layout, associating it with the string specified byname
.void
GridLayout. addLayoutComponent(java.lang.String name, Component comp)
Adds the specified component with the specified name to the layout.void
GridBagLayout. addLayoutComponent(java.lang.String name, Component comp)
Has no effect, since this layout manager does not use a per-component string.void
FlowLayout. addLayoutComponent(java.lang.String name, Component comp)
Adds the specified component to the layout.void
CardLayout. addLayoutComponent(java.lang.String name, Component comp)
Deprecated replaced byaddLayoutComponent(Component, Object)
.void
BorderLayout. addLayoutComponent(java.lang.String name, Component comp)
Deprecated replaced byaddLayoutComponent(Component, Object)
.protected java.awt.peer.LightweightPeer
Toolkit. createComponent(Component target)
Creates a peer for a component or container.<T extends java.awt.dnd.DragGestureRecognizer> T
Toolkit. createDragGestureRecognizer(java.lang.Class<T> abstractRecognizerClass, java.awt.dnd.DragSource ds, Component c, int srcActions, java.awt.dnd.DragGestureListener dgl)
Creates a concrete, platform dependent, subclass of the abstract DragGestureRecognizer class requested, and associates it with the DragSource, Component and DragGestureListener specified.protected abstract void
KeyboardFocusManager. dequeueKeyEvents(long after, Component untilFocused)
Called by the AWT to notify the KeyboardFocusManager that it should cancel delayed dispatching of KeyEvents.protected void
DefaultKeyboardFocusManager. dequeueKeyEvents(long after, Component untilFocused)
Releases for normal dispatching to the current focus owner all KeyEvents which were enqueued because of a call toenqueueKeyEvents
with the same timestamp and Component.protected abstract void
KeyboardFocusManager. discardKeyEvents(Component comp)
Called by the AWT to notify the KeyboardFocusManager that it should cancel delayed dispatching of KeyEvents.protected void
DefaultKeyboardFocusManager. discardKeyEvents(Component comp)
Discards all KeyEvents which were enqueued because of one or more calls toenqueueKeyEvents
with the specified Component, or one of its descendants.protected abstract void
KeyboardFocusManager. enqueueKeyEvents(long after, Component untilFocused)
Called by the AWT to notify the KeyboardFocusManager that it should delay dispatching of KeyEvents until the specified Component becomes the focus owner.protected void
DefaultKeyboardFocusManager. enqueueKeyEvents(long after, Component untilFocused)
Delays dispatching of KeyEvents until the specified Component becomes the focus owner.abstract void
KeyboardFocusManager. focusNextComponent(Component aComponent)
Focuses the Component after aComponent, typically based on a FocusTraversalPolicy.void
DefaultKeyboardFocusManager. focusNextComponent(Component aComponent)
Focuses the Component after aComponent, typically based on a FocusTraversalPolicy.abstract void
KeyboardFocusManager. focusPreviousComponent(Component aComponent)
Focuses the Component before aComponent, typically based on a FocusTraversalPolicy.void
DefaultKeyboardFocusManager. focusPreviousComponent(Component aComponent)
Focuses the Component before aComponent, typically based on a FocusTraversalPolicy.abstract Component
FocusTraversalPolicy. getComponentAfter(Container aContainer, Component aComponent)
Returns the Component that should receive the focus after aComponent.Component
ContainerOrderFocusTraversalPolicy. getComponentAfter(Container aContainer, Component aComponent)
Returns the Component that should receive the focus after aComponent.abstract Component
FocusTraversalPolicy. getComponentBefore(Container aContainer, Component aComponent)
Returns the Component that should receive the focus before aComponent.Component
ContainerOrderFocusTraversalPolicy. getComponentBefore(Container aContainer, Component aComponent)
Returns the Component that should receive the focus before aComponent.int
Container. getComponentZOrder(Component comp)
Returns the z-order index of the component inside the container.GridBagConstraints
GridBagLayout. getConstraints(Component comp)
Gets the constraints for the specified component.java.lang.Object
BorderLayout. getConstraints(Component comp)
Gets the constraints for the specified componentprotected static Container
Toolkit. getNativeContainer(Component c)
Give native peers the ability to query the native container given a native component (eg the direct parent may be lightweight).boolean
Container. isAncestorOf(Component c)
Checks if the component is contained in the component hierarchy of this container.protected GridBagConstraints
GridBagLayout. lookupConstraints(Component comp)
Retrieves the constraints for the specified component.abstract void
KeyboardFocusManager. processKeyEvent(Component focusedComponent, KeyEvent e)
This method initiates a focus traversal operation if and only if the KeyEvent represents a focus traversal key for the specified focusedComponent.void
DefaultKeyboardFocusManager. processKeyEvent(Component focusedComponent, KeyEvent e)
This method initiates a focus traversal operation if and only if the KeyEvent represents a focus traversal key for the specified focusedComponent.void
KeyboardFocusManager. redispatchEvent(Component target, AWTEvent e)
Redispatches an AWTEvent in such a way that the AWT event dispatcher will not recursively request that the KeyboardFocusManager, or any installed KeyEventDispatchers, dispatch the event again.void
Container. remove(Component comp)
Removes the specified component from this container.void
LayoutManager. removeLayoutComponent(Component comp)
Removes the specified component from the layout.void
GridLayout. removeLayoutComponent(Component comp)
Removes the specified component from the layout.void
GridBagLayout. removeLayoutComponent(Component comp)
Removes the specified component from this layout.void
FlowLayout. removeLayoutComponent(Component comp)
Removes the specified component from the layout.void
CardLayout. removeLayoutComponent(Component comp)
Removes the specified component from the layout.void
BorderLayout. removeLayoutComponent(Component comp)
Removes the specified component from this border layout.void
Container. setComponentZOrder(Component comp, int index)
Moves the specified component to the specified z-order index in the container.void
GridBagLayout. setConstraints(Component comp, GridBagConstraints constraints)
Sets the constraints for the specified component in this layout.protected void
KeyboardFocusManager. setGlobalFocusOwner(Component focusOwner)
Sets the focus owner.protected void
KeyboardFocusManager. setGlobalPermanentFocusOwner(Component permanentFocusOwner)
Sets the permanent focus owner.void
Window. setLocationRelativeTo(Component c)
Sets the location of the window relative to the specified component according to the following scenarios.void
PopupMenu. show(Component origin, int x, int y)
Shows the popup menu at the x, y position relative to an origin component.abstract void
KeyboardFocusManager. upFocusCycle(Component aComponent)
Moves the focus up one focus traversal cycle.void
DefaultKeyboardFocusManager. upFocusCycle(Component aComponent)
Moves the focus up one focus traversal cycle.Constructors in java.awt with parameters of type Component Constructor and Description MediaTracker(Component comp)
Creates a media tracker to track images for a given component. -
Uses of Component in java.awt.event
Methods in java.awt.event that return Component Modifier and Type Method and Description Component
HierarchyEvent. getChanged()
Returns the Component at the top of the hierarchy which was changed.Component
ContainerEvent. getChild()
Returns the component that was affected by the event.Component
HierarchyEvent. getComponent()
Returns the originator of the event.Component
ComponentEvent. getComponent()
Returns the originator of the event.Component
FocusEvent. getOppositeComponent()
Returns the other Component involved in this focus change.Constructors in java.awt.event with parameters of type Component Constructor and Description ComponentEvent(Component source, int id)
Constructs aComponentEvent
object.ContainerEvent(Component source, int id, Component child)
Constructs aContainerEvent
object.FocusEvent(Component source, int id)
Constructs aFocusEvent
object and identifies it as a permanent change in focus.FocusEvent(Component source, int id, boolean temporary)
Constructs aFocusEvent
object and identifies whether or not the change is temporary.FocusEvent(Component source, int id, boolean temporary, Component opposite)
Constructs aFocusEvent
object with the specified temporary state and oppositeComponent
.HierarchyEvent(Component source, int id, Component changed, Container changedParent)
Constructs anHierarchyEvent
object to identify a change in theComponent
hierarchy.HierarchyEvent(Component source, int id, Component changed, Container changedParent, long changeFlags)
Constructs anHierarchyEvent
object to identify a change in theComponent
hierarchy.InputMethodEvent(Component source, int id, java.text.AttributedCharacterIterator text, int committedCharacterCount, java.awt.font.TextHitInfo caret, java.awt.font.TextHitInfo visiblePosition)
Constructs anInputMethodEvent
with the specified source component, type, text, caret, and visiblePosition.InputMethodEvent(Component source, int id, long when, java.text.AttributedCharacterIterator text, int committedCharacterCount, java.awt.font.TextHitInfo caret, java.awt.font.TextHitInfo visiblePosition)
Constructs anInputMethodEvent
with the specified source component, type, time, text, caret, and visiblePosition.InputMethodEvent(Component source, int id, java.awt.font.TextHitInfo caret, java.awt.font.TextHitInfo visiblePosition)
Constructs anInputMethodEvent
with the specified source component, type, caret, and visiblePosition.KeyEvent(Component source, int id, long when, int modifiers, int keyCode)
Deprecated as of JDK1.1KeyEvent(Component source, int id, long when, int modifiers, int keyCode, char keyChar)
Constructs aKeyEvent
object.KeyEvent(Component source, int id, long when, int modifiers, int keyCode, char keyChar, int keyLocation)
Constructs aKeyEvent
object.MouseEvent(Component source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger)
Constructs aMouseEvent
object with the specified source component, type, modifiers, coordinates, click count, and popupTrigger flag.MouseEvent(Component source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger, int button)
Constructs aMouseEvent
object with the specified source component, type, time, modifiers, coordinates, click count, popupTrigger flag, and button number.MouseEvent(Component source, int id, long when, int modifiers, int x, int y, int xAbs, int yAbs, int clickCount, boolean popupTrigger, int button)
Constructs aMouseEvent
object with the specified source component, type, time, modifiers, coordinates, absolute coordinates, click count, popupTrigger flag, and button number.MouseWheelEvent(Component source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger, int scrollType, int scrollAmount, int wheelRotation)
Constructs aMouseWheelEvent
object with the specified source component, type, modifiers, coordinates, scroll type, scroll amount, and wheel rotation.MouseWheelEvent(Component source, int id, long when, int modifiers, int x, int y, int xAbs, int yAbs, int clickCount, boolean popupTrigger, int scrollType, int scrollAmount, int wheelRotation)
Constructs aMouseWheelEvent
object with the specified source component, type, modifiers, coordinates, absolute coordinates, scroll type, scroll amount, and wheel rotation.MouseWheelEvent(Component source, int id, long when, int modifiers, int x, int y, int xAbs, int yAbs, int clickCount, boolean popupTrigger, int scrollType, int scrollAmount, int wheelRotation, double preciseWheelRotation)
Constructs aMouseWheelEvent
object with the specified source component, type, modifiers, coordinates, absolute coordinates, scroll type, scroll amount, and wheel rotation.PaintEvent(Component source, int id, Rectangle updateRect)
Constructs aPaintEvent
object with the specified source component and type.
-