OVERVIEWJava GUI toolkit has always been a controversial topic. The same argument also occurs in other programming languages such as Smalltalk. In fact, there is a debate about languages unrelated to each platform. Java is currently the most widely
AWT preliminary-Frame and Panel, awtframepanel
GUI and AWT
GUI: graphical User Interface
AWT: Abstract Window Toolkit Abstract Window tool set
Previous program output results are displayed on the console. After learning AWT, you can program to
Java graphical interface Design-container (JFrame)The program is for the convenience of users, so the implementation of graphical interface programming is the inevitable trend of development of all languages, the program run at the command prompt
3. java gui Programming Frame window, 3. javaguiframe
Create a graphical interface:
1. Create a frame form;
2. Perform basic settings on the form;
Such as size, location, Layout
3. Define components;
4. add the component to the form using the add
Java FlowLayout, BorderLayout, GridLayout, GridBagLayout, and CardLayout layout manager
1. FlowLayout layout manager
FlowLayout ()Construct a new FlowLayout, which is centered and aligned. The default horizontal and vertical gaps are 5
Java basics-GUI programming (2), java basics gui Programming
I. event listening Mechanism
-- Event Source: the graphical components in the awt or swing package, that is, the components in which the event occurs.
-- Event: An operation performed by
AWT containers have a layout, and then add components and threads (for example, fireworks)
The container is also a class, which is actually a subclass of component. Therefore, the container itself is also a component and has all the properties of
We often need to create a class that can be called either as a window or as a piece of a program. To do this, simply add a main () to the program to create an instance of the program in a frame (frame). As a simple example, let's look at how to
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.