TAILIEUCHUNG - Java™ How to Program ( Deitel - Deitel) - Phần 17

Tham khảo sách 'java™ how to program ( deitel - deitel) - phần 17', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | more about object s methods in object s online API documentation and in The Java Tutorial at the following sites j2se docs api java lang docs books tutorial iava iavaOQ objectclass Recall from Chapter 7 that arrays are objects. As a result like all other objects an array inherits the members of class object. Note that arrays have an overridden clone method that copies the array. However if the array stores references to objects the objects are not copied. For more information about the relationship between arrays and class object please see Java Language Specification Chapter 10 at docs books jls second edition html PREV NEXT PREY NEXT Page 453 . Optional GUI and Graphics Case Study Displaying Text and Images Using Labels Programs often use labels when they need to display information or instructions to the user in a graphical user interface. Labels are a convenient way of keeping the user informed about the current state of a program. In Java an object of class jLabei from package can display a single line of text an image or both. The example in Fig. demonstrates several JLabei features. Lines 36 import the classes we need to display jLabeis. BorderLayout from package contains constants that specify where we can place GUI components in the jFrame. Class imageicon represents an image that can be displayed on a JLabei and class JFrame represents the window that will contain all the labels. Line 13 creates a JLabei that displays its constructor argumentthe string North . Line 16 declares local variable iabeiicon and assigns it a new imageicon. The constructor for imageicon receives a string that specifies the path to the image. Since we only specify a file name Java assumes that it is in the same directory as class LabeiDemo. imageicon can load images in GIF JPEG and PNG image formats. Line 19 declares and initializes local variable centerLabei with a JLabei that .

TỪ KHÓA LIÊN QUAN
Đã 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.