TAILIEUCHUNG - Lecture 8: User Interface Components with Swing

To Make an Interactive GUI Program To make an interactive GUI program, you need: Components buttons, windows, menus, etc. Events mouse clicked, window closed, button clicked, etc. Event listeners (interfaces) and event handlers (methods) listen for events to be trigged, and then perform actions to handle them | Lecture 8: User Interface Components with Swing Swing Overview (1) Classes from package defines various GUI components — objects with which the user interacts via the mouse, the keyboard or another form of input. Some basic GUI components JLabel JTextField JCheckBox JComboBox JList JPanel Most of the swing components are written completely in java, so they provide a greater portability and flexibility than the original GUI components from package Awt components are platform dependent Some swing components are still platform dependent. , JFrame Swing Overview (2) Common superclasses of many of the Swing components Component class Operations common to most GUI components are found in Component class. Container class Two important methods originates in this class add — adds components to a container. setLayout — enables a program to specify the layout manager that helps a Container position and size its components. JLabel A JLabel object provides text instructions or information on a GUI — display a single line of read-only text, an image or both text and image Example code One thing to be emphasized: if you do not explicitly add a GUI component to a container, the GUI component will not be displayed when the container appears on the screen To Make an Interactive GUI Program To make an interactive GUI program, you need: Components buttons, windows, menus, etc. Events mouse clicked, window closed, button clicked, etc. Event listeners (interfaces) and event handlers (methods) listen for events to be trigged, and then perform actions to handle them Event-Handling Model (1) Some GUIs are event driven — they generate events when the user interacts with the GUI , moving the mouse, clicking a button, typing in a text field, selecting an item from a menu, etc. When a user interaction occurs, an event is sent to the program. Many event types are defined in .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.