TAILIEUCHUNG - Lecture An introduction to Object-Oriented Programming with Java - Chapter 14:

After you have read and studied this chapter, you should be able to: Arrange GUI objects on a container, using layout managers and nested panels; write GUI application programs that process mouse events; understand how the SketchPad class introduced in Chapter 2 is implemented; | Chapter 14 Advanced GUI Chapter 14 Objectives After you have read and studied this chapter, you should be able to Arrange GUI objects on a container, using layout managers and nested panels. Write GUI application programs that process mouse events. Understand how the SketchPad class introduced in Chapter 2 is implemented. ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 14 Objectives After you have read and studied this chapter, you should be able to Write GUI application programs with JCheckBox, JRadioButton, JComboBox, JList, and JSlider objects. Develop programs using a variation of the model-view-controller (MVC) design pattern. ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Handling Mouse Events Mouse events include such user interactions as moving the mouse, dragging the mouse, and clicking the mouse buttons. To study these events, we will define a subclass of JFrame that handles the left mouse button click events. The subclass of JFrame we will define is named Ch14TrackMouseFrame. ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Handling Mouse Events A Ch14TrackMouseFrame object is an event source of mouse events. We will allow this object to be an event listener as well. Its class must therefore implement the MouseListener interface. Class Ch14TrackMouseFrame extends Frame implements MouseListener { } ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Handling Mouse Events The MouseListener interface has five abstract methods: mouseClicked mouseEntered mouseExited mousePressed mouseReleased The argument to all five methods is an instance of MouseEvent. ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Handling Mouse Events The mouseClicked method is called every time the left mouse button is clicked, or pressed down and released. The getX and getY methods of MouseEvent .

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.