鍍金池/ 教程/ Java/ Swing Component類
Swing JRadioButton
Swing Layout布局
Swing JTextField
Swing JLabel
Swing開發(fā)環(huán)境安裝
Swing JComponent類
SWING ActionEvent事件類
Swing JScrollBar
Swing教程首頁
Swing JFileChooser
SWING ContainerEvent事件處理類
Swing AdjustmentListener接口
Swing WindowAdapter類
SWING ComponentListener接口
Swing JMenuBar類
Swing JPanel類及實例
Swing
SWING AdjustmentEvent事件處理
Swing JWindow類及實例
Swing介紹
Swing MouseMotionAdapter類
SWING WindowEvent事件類
Swing ItemListener接口
SWING MouseEvent事件類
Swing JMenu類
SWING KeyEvent事件類
Swing MouseMotionListener接口
Swing JProgressBar
SWING AWTEvent事件類
Swing JRadioButtonMenuItem類及例子
Swing KeyAdapter類
SWING ActionListener接口
Swing LayoutManager接口
SWING MouseMotionEvent事件處理
Swing Component類
Swing Container類
Swing CardLayout布局
Swing MouseAdapter類
Swing JSlider
Swing KeyListener接口
Swing FocusAdapter類
Swing JColorChooser
Swing ImageIcon
Swing JComboBox
Swing GroupLayout布局類
Swing JOptionPane
Swing GridBagLayout布局類
Swing JMenuItem類
Swing MouseListener Interface
Swing事件適配器
SWING ComponentEvent處理類
SWING PaintEvent事件類
Swing FlowLayout布局類
SWING Event事件類
Swing FocusListener接口
Swing控件
Swing JButton
Swing JCheckBox
Swing SpringLayout布局類
Swing容器
Swing事件處理
Swing事件監(jiān)聽器
Swing Menu菜單類
Swing JList
Swing ContainerListener接口
Swing LayoutManager2接口
Swing JFrame類和實例
Swing JTextArea
SWING InputEvent事件類
Swing BorderLayout布局
Swing WindowListener接口
Swing JCheckboxMenuItem類及例子
Swing JSpinner
Swing GridLayout布局類
Swing JPopupMenu類及實例

Swing 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()。

類構(gòu)造函數(shù)

S.N. 構(gòu)造函數(shù) & 描述
1 protected Component() 
This creates a new Component.

類方法

S.N. 方法 & 描述
1 boolean action(Event evt, Object what) 
Deprecated. As of JDK version 1.1, should register this component as ActionListener on component which fires action events.
2 void add(PopupMenu popup)
Adds the specified popup menu to the component.
3 void addComponentListener(ComponentListener l) 
Adds the specified component listener to receive component events from this component.
4 void addFocusListener(FocusListener l) 
Adds the specified focus listener to receive focus events from this component when this component gains input focus.
5 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.
6 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.
7 void addInputMethodListener(InputMethodListener l)
Adds the specified input method listener to receive input method events from this component.
8 void addKeyListener(KeyListener l)
Adds the specified key listener to receive key events from this component.
9 void addMouseListener(MouseListener l)
Adds the specified mouse listener to receive mouse events from this component.
10 void addMouseMotionListener(MouseMotionListener l)
Adds the specified mouse motion listener to receive mouse motion events from this component.
11 void addMouseWheelListener(MouseWheelListener l)
Adds the specified mouse wheel listener to receive mouse wheel events from this component.
12 void addNotify()
Makes this Component displayable by connecting it to a native screen resource.
13 void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list.
14 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property.
15 void applyComponentOrientation(ComponentOrientation orientation)
Sets the ComponentOrientation property of this component and all components contained within it.
16 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.
17 int checkImage(Image image, ImageObserver observer)
Returns the status of the construction of a screen representation of the specified image.
18 int checkImage(Image image,int width,int height, ImageObserver observer)
Returns the status of the construction of a screen representation of the specified image.
19 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.
20 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.
21 Image createImage(ImageProducer producer)
Creates an image from the specified image producer.
22 Image createImage(int width,int height)
Creates an off-screen drawable image to be used for double buffering.
23 VolatileImage createVolatileImage(int width,int height)
Creates a volatile off-screen drawable image to be used for double buffering.
24 VolatileImage createVolatileImage(int width,int height, ImageCapabilities caps)
Creates a volatile off-screen drawable image, with the given capabilities.
25 void deliverEvent(Event e)
Deprecated. As of JDK version 1.1, replaced by dispatchEvent(AWTEvent e).
26 void disable()
Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).
27 protected void disableEvents(long eventsToDisable)
Disables the events defined by the specified event mask parameter from being delivered to this component.
28 void dispatchEvent(AWTEvent e)
Dispatches an event to this component or one of its sub components.
29 void doLayout()
Prompts the layout manager to lay out this component.
30 void enable()
Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).
31 void enable(boolean b)
Deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).
32 protected void enableEvents(long eventsToEnable)
Enables the events defined by the specified event mask parameter to be delivered to this component.
33 void enableInputMethods(boolean enable)
Enables or disables input method support for this component.
34 protected void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
Support for reporting bound property changes for boolean properties.
35 void firePropertyChange(String propertyName, byte oldValue, byte newValue)
Reports a bound property change.
36 void firePropertyChange(String propertyName, char oldValue, char newValue)
Reports a bound property change.
37 void firePropertyChange(String propertyName, double oldValue, double newValue)
Reports a bound property change.
38 void firePropertyChange(String propertyName, float oldValue, float newValue)
Reports a bound property change.
39 void firePropertyChange(String propertyName, long oldValue, long newValue)
Reports a bound property change.
40 protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
Support for reporting bound property changes for Object properties.
41 void firePropertyChange(String propertyName, short oldValue, short newValue)
Reports a bound property change.
42 AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this Component.
43 float getAlignmentX()
Returns the alignment along the x axis.
44 float getAlignmentY()
Returns the alignment along the y axis.
45 Color getBackground()
Gets the background color of this component.
46 int getBaseline(int width,int height)
Returns the baseline.
47 Component.BaselineResizeBehavior getBaselineResizeBehavior()
Returns an enum indicating how the baseline of the component changes as the size changes.
48 Rectangle getBounds()
Gets the bounds of this component in the form of a Rectangle object.
49 Rectangle getBounds(Rectangle rv)
Stores the bounds of this component into return value rv and return rv.
50 ColorModel getColorModel()
Gets the instance of ColorModel used to display the component on the output device.
51 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.
52 Component getComponentAt(Point p)
Returns the component or subcomponent that contains the specified point.
53 ComponentListener[] getComponentListeners()
Returns an array of all the componen