|
|
I want to use the GridBagLayout to add some compoent in my applicaiton.
My require is:
In a JFrame,spit it to 2 row and 2 colum. In the first row I want to add a JLabel and a JTextFiled,and I want the JLabel take the 20% width ,and the JtextField takes the rest 80%
How to implement it ?
Can I use the absoult size for the JLabel and other compoent only?for example label.setPreSize(100,10)?
It seems that the size of the button or the Jlabel is initized by their text ,for example a button which is setText("button") is widther than a button which is setText("bu"),since the string "button" is longger than string "bu".
This is what confusing me ,is there anyone can give me a answer>?