TAILIEUCHUNG - More Java Pitfalls 50 New Time-Saving Solutions and Workarounds phần 4

được cung cấp bởi newTransformer không có đối số () phương pháp. Bằng cách này, "mặc định" biến áp cung cấp các chức năng sao chép. Còn có một newTransformer | 124 Item 16 Let s examine the correct approach to sizing a component. The key to understanding why our code failed is to recognize that after we create the component the layout manager called GridLayout reshapes the component in accordance with its own ỉimpo PDF by calling setLayout null butas thelayoutmanagerprovide merousbenefits to our code thirisapoor semedy. b th ouserreeieestdowindoWiWe etawsWtsbe able to automatically resize our user interface which is the layout manager s chief benefit. Anotherh avewohldbo to catleet hSzrOafteethe laytue rnantgsrhae completed onlyprovides uswithaquick fix Bycallingrepaint the size would change yet againwhen thctaowser is resized. That leaves US with only one real option Work site . Oh- i the component delow we rewrite our custom component u aotsvkf s .-se class CustomButton2 extends Button publice stride iees super title setSaze aOc laO -unneceasary public Dimension getMinimumSize return new DimensSon OOS lSS public Dimension getPreferredsize return getMinimumSize Our custom component overrides the getMinimumSize and getPreferred-size methods of the Csmponentclasstosettìiecomponent size. The layout manager invokes these msthodstodethrminaoowtosSze an individual component. Some layout managers will disregard these hints if their pattern calls for that. For example if this button was pdchdineUeseutesof a utpthcCcttanwoPd notbe oo by 100 but instead would stretch to fit the available center space. GridLayout will abide by these sizeeandanshor Wt s ice dwa below uses the CustomButton2 class. 01 packaao 02 03 import . 04 import 05 06 class CustomButton2extendtBueton 07 Listing GoodSetS se. eet when setSizeQ Won t Work 125 08 public CustomButton2 string title 09 ỉimpo PDF Merge arịậ Split Unrg gere We . 12 13 14 publỉcDỉmensỉon getMinimumSize 15 0 returnnewDim nsion 100 100 16 17 public Domension

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.