tailieunhanh - Lecture Introduction to programming with Java - Chapter 16: GUI programming basics

This chapter presents the following content: GUI overview, event-driven programming basics, GUI classes and packages, a simple window program, JFrame Class, Java components, JLabel component, JTextField Component, Component Listeners, interfaces, inner classes, anonymous inner classes, jbutton component, JOptionPane Dialog Box, distinguishing between multiple events, using GetActionCommand to distinguish between multiple events (optional), color. | Chapter 16 GUI Programming Basics GUI Overview Event-Driven Programming Basics GUI Classes and Packages A Simple Window Program JFrame Class Java Components JLabel Component JTextField Component Component Listeners Interfaces Inner Classes Anonymous Inner Classes JButton Component JOptionPane Dialog Box Distinguishing Between Multiple Events Using getActionCommand to Distinguish Between Multiple Events (optional) Color 1 Mouse Listeners MouseListener Interface MouseMotionListener Interface Mouse Adapter Classes DragSmiley Program Displaying an Image Chapter 16 GUI Programming Basics 2 GUI Overview GUI stands for Graphical User Interface. Graphical = picture objects (windows, buttons, menus, etc.) User = the person who uses the program. Interface = the manner in which the user interacts with the program. Although companies still write text-based programs for internal use, most companies write GUI-based programs for programs that are to be used externally. 3 Event-Driven Programming Basics GUI programs usually use event-driven programming techniques. Basic idea behind event-driven programming: The program waits for events to occur and then it responds. An event is a message that tells the program that something has happened. For example, if the user clicks a button, then an event is generated, and it tells the program that a particular button was clicked. More formally, when the user clicks a button, we say that the button object fires an event. 4 Event-Driven Programming Basics Note these additional event examples: User Action What Happens Pressing the enter key while the cursor is inside a text box. The text box object fires an event, and it tells the program that enter was pressed within the text box. Clicking a menu item. The menu item object fires an event, and it tells the program that the menu item was selected. Closing a window (clicking on the window's top-right corner "X" button). The window object fires an event, and it tells the program . | Chapter 16 GUI Programming Basics GUI Overview Event-Driven Programming Basics GUI Classes and Packages A Simple Window Program JFrame Class Java Components JLabel Component JTextField Component Component Listeners Interfaces Inner Classes Anonymous Inner Classes JButton Component JOptionPane Dialog Box Distinguishing Between Multiple Events Using getActionCommand to Distinguish Between Multiple Events (optional) Color 1 Mouse Listeners MouseListener Interface MouseMotionListener Interface Mouse Adapter Classes DragSmiley Program Displaying an Image Chapter 16 GUI Programming Basics 2 GUI Overview GUI stands for Graphical User Interface. Graphical = picture objects (windows, buttons, menus, etc.) User = the person who uses the program. Interface = the manner in which the user interacts with the program. Although companies still write text-based programs for internal use, most companies write GUI-based programs for programs that are to be used externally. 3 Event-Driven .

TÀI LIỆU MỚI ĐĂNG
crossorigin="anonymous">
Đã 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.