Component
類是AWT的非選單使用者介面控制元件的抽象基礎類別。Component
表示具有圖形表示的物件。
以下是java.awt.Component
類的宣告 -
public abstract class Component
extends Object
implements ImageObserver, MenuContainer, Serializable
以下是java.awt.Component
類的欄位 -
static float BOTTOM_ALIGNMENT
- getAlignmentY()
使用的常數。static float CENTER_ALIGNMENT
- getAlignmentY()
和getAlignmentX()
使用的常數。static float LEFT_ALIGNMENT
- getAlignmentX()
使用的常數。static float RIGHT_ALIGNMENT
- getAlignmentX()
使用的常數。static float TOP_ALIGNMENT
- getAlignmentY()
使用的常數。protected Component()
- 它用於建立一個新的元件。以下是Swing Component
類中的方法列表。
boolean action(Event evt, Object what)
- Deprecated. As of JDK version 1.1, should register this component as ActionListener on the component which fires action events.void add(PopupMenu popup)
- Adds the specified popup menu to the component.void addComponentListener(ComponentListener l)
- Adds the specified component listener to receive the component events from this component.void addFocusListener(FocusListener l)
- Adds the specified focus listener to receive focus events from this component, when this component gains input focus.void addHierarchyBoundsListener(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.void addHierarchyListener(HierarchyListener l)
- Adds the specified hierarchy listener to receive hierarchy changed events from this component, when the hierarchy to which this container belongs changes.void addInputMethodListener(InputMethodListener l)
- Adds the specified input method listener to receive input method events from this component.void addKeyListener(KeyListener l)
- Adds the specified key listener to receive key events from this component.void addMouseListener(MouseListener l)
- Adds the specified mouse listener to receive mouse events from this component.void addMouseMotionListener(MouseMotionListener l)
- Adds the specified mouse motion listener to receive mouse motion events from this component.void addMouseWheelListener(MouseWheelListener l)
- Adds the specified mouse wheel listener to receive mouse wheel events from this component.void addNotify()
- Makes this Component displayable by connecting it to a native screen resource.void addPropertyChangeListener(PropertyChangeListener listener)
- Adds a PropertyChangeListener to the listener list.void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
- Adds a PropertyChangeListener to the listener list for a specific property.void applyComponentOrientation(ComponentOrientation orientation)
- Sets the ComponentOrientation property of this component and all components contained within it.boolean areFocusTraversalKeysSet(int id)
- Returns whether the set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Component.int checkImage(Image image, ImageObserver observer)
- Returns the status of the construction of a screen representation of the specified image.int checkImage(Image image,int width,int height, ImageObserver observer)
- Returns the status of the construction of a screen representation of the specified image.boolean contains(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.boolean contains(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.Image createImage(ImageProducer producer)
- Creates an image from the specified image producer.Image createImage(int width,int height)
- Creates an off-screen drawable image to be used for double buffering.VolatileImage createVolatileImage(int width,int height)
- Creates a volatile off-screen drawable image to be used for double buffering.VolatileImage createVolatileImage(int width,int height, ImageCapabilities caps)
- Creates a volatile off-screen drawable image, with the given capabilities.void deliverEvent(Event e)
- Deprecated. As of JDK version 1.1, replaced by dispatchEvent(AWTEvent e).void disable()
- Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).protected void disableEvents(long eventsToDisable)
- Disables the events defined by the specified event mask parameter from being delivered to this component.void dispatchEvent(AWTEvent e)
- Dispatches an event to this component or one of its sub components.void doLayout()
- Prompts the layout manager to lay out this component.void enable()
- Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).void enable(boolean b)
- Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).protected void enableEvents(long eventsToEnable)
- Enables the events defined by the specified event mask parameter to be delivered to this component.void enableInputMethods(boolean enable)
- Enables or disables input method support for this component.protected void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
- Supports reporting bound property changes for boolean properties.void firePropertyChange(String propertyName, byte oldValue, byte newValue)
- Reports a bound property change.void firePropertyChange(String propertyName, char oldValue, char newValue)
- Reports a bound property change.void firePropertyChange(String propertyName, double oldValue, double newValue)
- Reports a bound property change.void firePropertyChange(String propertyName, float oldValue, float newValue)
- Reports a bound property change.void firePropertyChange(String propertyName, long oldValue, long newValue)
- Reports a bound property change.protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
- Supports reporting bound property changes for Object properties.void firePropertyChange(String propertyName, short oldValue, short newValue)
- Reports a bound property change.AccessibleContext getAccessibleContext()
- Gets the AccessibleContext associated with this Component.float getAlignmentX()
- Returns the alignment along the x axis.該類繼承以下類中的方法 -
java.lang.Object