đượ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