Đang chuẩn bị liên kết để tải về tài liệu:
Lecture Software construction - Lab 6: GUI building with the AWT in Java

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

In this chapter, the following content will be discussed: Present in all Java implementations, described in most java textbooks, adequate for many applications, uses the controls defined by your OS, difficult to build an attractive GUI,. | Software Construction Lab 6 GUI Building with the AWT in Java AWT (Abstract Window Toolkit) Present in all Java implementations Described in most Java textbooks Adequate for many applications Uses the controls defined by your OS therefore it's “least common denominator” Difficult to build an attractive GUI import java.awt.*; import java.awt.event.*; Swing Same concepts as AWT Doesn’t work in ancient Java implementations (Java 1.1 and earlier) Many more controls, and they are more flexible Some controls, but not all, are a lot more complicated Gives a choice of “look and feel” packages Much easier to build an attractive GUI import javax.swing.*; Swing vs. AWT Swing is bigger, slower, and more complicated But not as slow as it used to be Swing is more flexible and better looking Swing and AWT are incompatible--you can use either, but you can’t mix them Actually, you can, but it’s tricky and not worth doing Learning the AWT is a good start on learning Swing Many of the most | Software Construction Lab 6 GUI Building with the AWT in Java AWT (Abstract Window Toolkit) Present in all Java implementations Described in most Java textbooks Adequate for many applications Uses the controls defined by your OS therefore it's “least common denominator” Difficult to build an attractive GUI import java.awt.*; import java.awt.event.*; Swing Same concepts as AWT Doesn’t work in ancient Java implementations (Java 1.1 and earlier) Many more controls, and they are more flexible Some controls, but not all, are a lot more complicated Gives a choice of “look and feel” packages Much easier to build an attractive GUI import javax.swing.*; Swing vs. AWT Swing is bigger, slower, and more complicated But not as slow as it used to be Swing is more flexible and better looking Swing and AWT are incompatible--you can use either, but you can’t mix them Actually, you can, but it’s tricky and not worth doing Learning the AWT is a good start on learning Swing Many of the most common controls are just renamed AWT: Button b = new Button ("OK"); Swing: JButton b = new JButton("OK"); To build a GUI. Make somewhere to display things—usually a Frame or Dialog (for an application), or an Applet Create some Components, such as buttons, text areas, panels, etc. Add your Components to your display area Arrange, or lay out, your Components Attach Listeners to your Components Interacting with a Component causes an Event to occur A Listener gets a message when an interesting event occurs, and executes some code to deal with it Containers and Components The job of a Container is to hold and display Components Some common subclasses of Component are Button, Checkbox, Label, Scrollbar, TextField, and TextArea A Container is also a Component This allows Containers to be nested Some Container subclasses are Panel (and Applet), Window, and Frame An Applet is Panel is a Container java.lang.Object | +----java.awt.Component | +----java.awt.Container | .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.