Programming with Java, Swing and Squint phần 5

chúng tôi nhấn mạnh rằng nếu chúng ta không rõ ràng bao gồm thêm không gian trong các chữ "Tôi đang cảm động" và "thời gian (s)", Java sẽ không bao gồm bất kỳ không gian giữa các từ "xúc động" và "thời gian (s)" và giá trị số của numberOfClicks. | Chapter 6 Class Action In Chapter 1 we explained that Java uses the word class to refer to A set collection group or configuration containing members regarded as having certain attributes or traits in common. We have seen that this description applies quite accurately to the classes provided by Java s Swing library. We have constructed groups of JTextFields and groups of JLabels as parts of the interface provided by a single program. In each case the objects created using a given class were distinct from one another but shared many common attributes. Some of the similarities are discernible by just looking at a program s window as it runs. For example all JTextFields look quite similar. Other shared attributes are only visible to the programmer. Different sets of methods are associated with each class. For example while all JComboBoxes support the getSelectedItem method this method is not provided for members of the JTextField class. When we first discussed the word class however we were not talking about library classes. We were explaining why the word class appears in the header lines of our sample Java programs. At this point it should be clear that there is some connection between the library classes you have been using and the classes you define when you write programs. Primarily both types of classes involve methods. You define methods within the classes you write and you invoke methods associated with library classes. At the same time the classes you write seem very different from library classes. You invoke methods associated with library classes but you don t invoke the buttonClicked or textEntered methods included in your class definitions. The instructions included in these methods get executed automatically in response to user actions. In this chapter we will see that there is actually no fundamental difference between classes you define and the classes provided by the Java libraries. While the programs we have considered thus far have all involved .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
80    388    2    04-07-2024
Đã 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.