Java Graphical user interface

Source: Internet
Author: User

The JAVAAPI provides two sets of components for writing graphical interfaces, AWT and swing

Swing is a lightweight GUI component that uses an MVC architecture to design component classes, which are divided into models, attempts, and controllers. The controller handles the interaction of the user with the component, and the model is used to store the data that defines the component.

Views are composed of containers and components. To be visible, a component must be placed in a container.

Heavyweight containers include jframe (form), JDialog (dialog box), JWindow (window), JApplet (applet). There must be at least one heavyweight container (top-level container) in each application.

These 4 top-level containers inherit from the container class.

Lightweight containers include JPanel (panel), JSplitPane (delimited form), JScrollPane (scroll pane), they come from the JComponent class, and lightweight containers can be nested with each other.

Component

Jlbale basic methods include setting up text, pictures, alignment, and other components of the label description.

JButton (button), the action we expect will appear after we click.

Jtexxfield (text field), adding text

Layout of components

1,flowlayout (Flow layout)

2,borderlayout (Border layout)

3,gridlayout (Grid layout)

4,boxlayout (Box Layout)

5, free layout

The latest Java event handling method is to generate events based on the authorization event model event source and send it to one or more listener listeners simply by waiting until it receives an event. Once the event is accepted, the listener processes the events and then returns.

Event: In the authorization event model, an event is an object that describes the state of the event source change.
Events can be generated directly or indirectly through the mouse, keyboard, and GUI interfaces. such as: Press a button, enter a character through the keyboard, select an item in the list box, click a mouse, and so on.

Java Graphical user interface

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.