TAILIEUCHUNG - Ivor Horton’s Beginning Java 2, JDK 5 Edition phần 8

Một khía cạnh quan trọng của việc xác định giá trị thuộc tính có thể xảy ra bởi một điều tra như thế này là một biên tập XML có thể giúp các tác giả của một tài liệu bằng cách thúc đẩy với danh sách các giá trị thuộc tính có thể từ DTD khi nguyên tố này được tạo ra. Một thuộc tính mà bạn khai báo như # CỐ ĐỊNH phải luôn luôn có giá trị mặc định. | Chapter 20 and draw it The change to the mouseReleased method is exactly the same as for mousePressed so go ahead and modify the if condition in that method too. The only other change you need is to make the status bar respond to the TEXT element type being set. To do this you can make a small addition to the definition of the setTypePane method in the StatusBar class public void setTypePane int elementType String text Text for the type pane switch elementType case labels as before. case TEXT text TEXT break default assert false text Set the pane text How It Works The mouseClicked handler responds to mouse button 1 being clicked when the element type is TEXT. This method will be called after the mouseReleased method has been called. Within the if statement that determines that the current element is of type TEXT you create a dialog to receive the text input by calling the static showInputDialog in the JOptionPane class. If the Cancel button is clicked in the dialog text will be null so in this case you do nothing. If text is not null you create an object at the current cursor position containing the text string that was entered in the dialog. You then add this to the model as long as it s not null. It s important to reset the start and tempElement members back to null otherwise subsequent event-handling operations will be confused. Incidentally although there isn t a method to detect double-clicks on the mouse button it s easy to implement. The getClickCount method for the MouseEvent object that is passed to mouseClicked returns the click count. To respond to a double-click you could write the following statements if 2 Response to double-click. The other event-handling methods behave as before so far as the geometric elements are concerned and do nothing if the element type is TEXT. You can try it out. 1022 Extending the GUI .getElementColor The text color new .

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.