Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

GridBagLayout && Radio Button

843806Mar 28 2008 — edited Mar 28 2008
Hey Guys......I have made a very lengthy GUI and I have used GridBagLayout....I cant paste the whole code over here but if anyone can help me I have two radio buttons one for Male and one for Female wat I am doing is...
maleRadioButton = new JRadioButton("M");
femaleRadioButton = new JRadioButton("F");

GridBagConstraints c = new GridBagConstraints();

c.fill = GridBagConstraints.HORIZONTAL;

c.gridx = 1;
c.gridy = 2;
dataPanel.add(maleRadioButton,c);

c.gridx = 2;
c.gridy = 2;
dataPanel.add(femaleRadioButton,c);
I am doing this...so whats happening is that it is coming in the next column but I want it the female button to start just directly after the male button because the width of the 1 column is of the size of a text field length (20).....how can I just make the female button come after the male button.??

Regards

ISI
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 25 2008
Added on Mar 28 2008
13 comments
805 views