TAILIEUCHUNG - Introduction to Java: 7 Layouts

Tham khảo tài liệu 'introduction to java: 7 layouts', 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ả | In this chapter The LayoutManager Interface FlowLayout BorderLayout GridLayout CardLayout GridBagLayout GridBagConstraints Combining Layouts Disabling the LayoutManager Designing Your Own LayoutManager The Layout Collection Other Layouts Available on the Net 7 Layouts This chapter expands upon the idea of a layout manager which was mentioned briefly in the previous chapter. Every container has a LayoutManager that is responsible for positioning the component objects within it regardless of the platform or the screen size. Layout managers eliminate the need to compute component placement on your own which would be a losing proposition since the size required for any component depends on the platform on which it is displayed. Even for a simple layout the code required to discover component sizes and compute absolute positions could be hundreds of lines particularly if you concern yourself with what happens when the user resizes a window. A layout manager takes care of this for you. It asks each component in the layout how much space it requires then arranges the components on the screen as best it can based on the component sizes on the platform in use and the space available resizing the components as needed. To find out how much space a component needs a layout manager calls the component s getMinimumSize and getPreferredSize methods. Java also has a getMaximumSize method the existing layout managers don t take advantage of it. These methods report the minimum space that a component requires to be 247 248 Chapter 7 Layouts displayed correctly and the optimal size at which it looks best. Thus each component must know its space requirements the layout manager uses these to arrange the screen and your Java program never has to worry about platform-dependent positioning. The package provides five layout managers FlowLayout BorderLayout GridLayout CardLayout and GridBagLayout. Four additional layouts are provided in the package .

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