Java AWT learning

xiaoxiao2021-03-05  22

The class and interfaces used in the Java.awt package are provided, as shown below:

The most basic component of Java's graphical user interface is Component. Components cannot be independently displayed, and the components must be placed in a container. (Such as Panel, Frame)

Container is also a subclass of Component, so the container is also a component, which has all the nature of the component, but its main function is to accommodate other components and containers.

LayoutManager: There is a LayoutManager for each container. If a certain management method is set, the user uses other layout methods such as: setsize (), etc. will be masked. SetLayout (NULL) can turn off the container manager. Common containers have Frame, Panel, Applet. Add other components to the container use the add () method.

Layout manager mainly includes: FlowLayout, BorderLayout, GridLayout, Cardlayout, Gridbaglayout

***: 1.Frame is a top form, its default manager is BorderLayout.

2.Panel cannot be displayed separately. You must add it to a container, its default manager, it also has its own manager when Panel adds to a container! !

Event category

Description

Interface name

method

Activation component ActionEvent ActionListener actionPerformed (ActionEvent) ItemEvent chose certain items ItemListener itemStateChanged (ItemEvent) MouseEvent mouse movement MouseMotionListener mouseDragged (MouseEvent) mouseMoved (MouseEvent) mouse click MouseListener mousePressed (MouseEvent) mouseReleased (MouseEvent) mouseEntered (MouseEvent) mouseExited (MouseEvent ) mouseClicked (MouseEvent) KeyEvent keyboard KeyListener keyPressed (KeyEvent) keyReleased (KeyEvent) keyTyped (KeyEvent) FocusEvent component receives or loses focus FocusListener focusGained (FocusEvent) focusLost (FocusEvent) AdjustmentEvent moving the scroll bar components such AdjustmentListener adjustmentValueChanged (AdjustmentEvent) ComponentEvent zoom display object is moved or hidden ComponentListener componentMoved (ComponentEvent) componentHidden (ComponentEvent) componentResized (ComponentEvent) componentShown (ComponentEvent) WindowEvent window receives a window-level event WindowListener windowClosing (WindowEvent) windowOpened (WindowEvent) windowIconified (WindowEvent) windowDeiconified (WindowEvent) windowClosed (WindowEvent WINDOWACTIVATED (WINDOWEVENT) WINDOWDEACTIVATED (W indowEvent) ContainerEvent vessel increases removed components ContainerListener componentAdded (ContainerEvent) componentRemoved (ContainerEvent) TextEvent text area or text field changes the correspondence relationship TextListener textValueChanged (TextEvent) assembly listener table lists the individual components of all listeners The correspondence of the device, "" "indicates that the component can be registered with this listener. Table 5.2

Search interface

ACT

Adj

CMP

CNT

FOC

ITM

Key

Mou

Mm

TEXT

Win

Button

Canvas

Checkbox

CheckBoxMenuItem

Choice

Component

Container

Dialog

Frame

Label

List

Menuitem

Panel

Scrollbar

Scrollpane

Textarea

Textfield

Window

Act = ActionListener Adj = AdjustmentListener Cmp = ComponentListener Cnt = ConatainerListener Foc = FocusListener Itm = ItemListener Key = KeyListener Mou = MouseListener MM = MouseMotionListener Text = TextListener Win = WindowListenerjava.awt package provides classes and interfaces used by GUI design, as shown below :

The most basic component of Java's graphical user interface is Component. Components cannot be independently displayed, and the components must be placed in a container. (Such as Panel, Frame)

Container is also a subclass of Component, so the container is also a component, which has all the nature of the component, but its main function is to accommodate other components and containers.

LayoutManager: There is a LayoutManager for each container. If a certain management method is set, the user uses other layout methods such as: setsize (), etc. will be masked. SetLayout (NULL) can turn off the container manager. Common containers have Frame, Panel, Applet. Add other components to the container use the add () method.

Layout manager mainly includes: FlowLayout, BorderLayout, GridLayout, Cardlayout, Gridbaglayout

***: 1.Frame is a top form, its default manager is BorderLayout.

2.Panel cannot be displayed separately. You must add it to a container, its default manager, it also has its own manager when Panel adds to a container! !

Event category

Description

Interface name

method

Activation component ActionEvent ActionListener actionPerformed (ActionEvent) ItemEvent chose certain items ItemListener itemStateChanged (ItemEvent) MouseEvent mouse movement MouseMotionListener mouseDragged (MouseEvent) mouseMoved (MouseEvent) mouse click MouseListener mousePressed (MouseEvent) mouseReleased (MouseEvent) mouseEntered (MouseEvent) mouseExited (MouseEvent ) mouseClicked (MouseEvent) KeyEvent keyboard KeyListener keyPressed (KeyEvent) keyReleased (KeyEvent) keyTyped (KeyEvent) FocusEvent component receives or loses focus FocusListener focusGained (FocusEvent) focusLost (FocusEvent) AdjustmentEvent moving the scroll bar components such AdjustmentListener adjustmentValueChanged (AdjustmentEvent) ComponentEvent zoom display object is moved or hidden ComponentListener componentMoved (ComponentEvent) componentHidden (ComponentEvent) componentResized (ComponentEvent) componentShown (ComponentEvent) WindowEvent window receives a window-level event WindowListener windowClosing (WindowEvent) windowOpened (WindowEvent) windowIconified (WindowEvent) windowDeiconified (WindowEvent) windowClosed (WindowEvent WINDOWACTIVATED (WINDOWEVENT) WINDOWDEACTIVATED (W indowEvent) ContainerEvent vessel increases removed components ContainerListener componentAdded (ContainerEvent) componentRemoved (ContainerEvent) TextEvent text area or text field changes the correspondence relationship TextListener textValueChanged (TextEvent) assembly listener table lists the individual components of all listeners The correspondence of the device, "" "indicates that the component can be registered with this listener. Table 5.2

Search interface

ACT

Adj

CMP

CNT

FOC

ITM

Key

Mou

Mm

TEXT

Win

Button

Canvas

Checkbox

CheckBoxMenuItem

Choice

Component

Container

Dialog

Frame

Label

List

Menuitem

Panel

Scrollbar

Scrollpane

Textarea

Textfield

Window

Act = ActionListener Adj = AdjustmentListener Cmp = ComponentListener Cnt = ConatainerListener Foc = FocusListener Itm = ItemListener Key = KeyListener Mou = MouseListener MM = MouseMotionListener Text = TextListener Win = WindowListenerjava.awt package provides classes and interfaces used by GUI design, as shown below :

The most basic component of Java's graphical user interface is Component. Components cannot be independently displayed, and the components must be placed in a container. (Such as Panel, Frame)

Container is also a subclass of Component, so the container is also a component, which has all the nature of the component, but its main function is to accommodate other components and containers.

LayoutManager: There is a LayoutManager for each container. If a certain management method is set, the user uses other layout methods such as: setsize (), etc. will be masked. SetLayout (NULL) can turn off the container manager. Common containers have Frame, Panel, Applet. Add other components to the container use the add () method.

Layout manager mainly includes: FlowLayout, BorderLayout, GridLayout, Cardlayout, Gridbaglayout

***: 1.Frame is a top form, its default manager is BorderLayout.

2.Panel cannot be displayed separately. You must add it to a container, its default manager, it also has its own manager when Panel adds to a container! !

Event category

Description

Interface name

method

Activation component ActionEvent ActionListener actionPerformed (ActionEvent) ItemEvent chose certain items ItemListener itemStateChanged (ItemEvent) MouseEvent mouse movement MouseMotionListener mouseDragged (MouseEvent) mouseMoved (MouseEvent) mouse click MouseListener mousePressed (MouseEvent) mouseReleased (MouseEvent) mouseEntered (MouseEvent) mouseExited (MouseEvent ) mouseClicked (MouseEvent) KeyEvent keyboard KeyListener keyPressed (KeyEvent) keyReleased (KeyEvent) keyTyped (KeyEvent) FocusEvent component receives or loses focus FocusListener focusGained (FocusEvent) focusLost (FocusEvent) AdjustmentEvent moving the scroll bar components such AdjustmentListener adjustmentValueChanged (AdjustmentEvent) ComponentEvent zoom display object is moved or hidden ComponentListener componentMoved (ComponentEvent) componentHidden (ComponentEvent) componentResized (ComponentEvent) componentShown (ComponentEvent) WindowEvent window receives a window-level event WindowListener windowClosing (WindowEvent) windowOpened (WindowEvent) windowIconified (WindowEvent) windowDeiconified (WindowEvent) windowClosed (WindowEvent WINDOWACTIVATED (WINDOWEVENT) WINDOWDEACTIVATED (W indowEvent) ContainerEvent vessel increases removed components ContainerListener componentAdded (ContainerEvent) componentRemoved (ContainerEvent) TextEvent text area or text field changes the correspondence relationship TextListener textValueChanged (TextEvent) assembly listener table lists the individual components of all listeners The correspondence of the device, "" "indicates that the component can be registered with this listener. Table 5.2

Search interface

ACT

Adj

CMP

CNT

FOC

ITM

Key

Mou

Mm

TEXT

Win

Button

Canvas

Checkbox

CheckBoxMenuItem

Choice

Component

Container

Dialog

Frame

Label

List

Menuitem

Panel

Scrollbar

Scrollpane

Textarea

Textfield

Window

转载请注明原文地址:https://www.9cbs.com/read-32342.html

New Post(0)