problem of using GridBagConstraints

gbc = new GridBagConstraints();

item = new ArrayList();

item.add("aaaa");

item.add("aaa");

item.add("aa");

for(int i=0;i<item.size();i++){

labeli] = new JLabel();

labe.setText(item.get(i).toString());

gbc.gridx = 0;

panel.add(label,gbc);

}

checkOpt = new JTextField();

checkBoxOpt = new JCheckBox();

checkBoxOpt.setText("a");

panel.add(checkBoxOpt,gbc);

gbc.ipadx = 200;

gbc.gridx = gbc.RELATIVE;

gbc.gridy = gbc.REMAINDER+4;

panel.add(checkOpt,gbc);

output i got:

aaaa

aaa

aa

a|__|><--this is textfield

the answer is what i should do to make this textfiled closer to label "a" so it can look like this;

aaaa

aaa

aa

a|__|<--this is textfield

thanks :)

[859 byte] By [soloxsa] at [2007-11-27 9:56:54]
# 1

If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",

see http://homepage1.nifty.com/algafield/sscce.html,

that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

Don't forget to use the "Code Formatting Tags",

see http://forum.java.sun.com/help.jspa?sec=formatting,

so the posted code retains its original formatting.

camickra at 2007-7-13 0:27:09 > top of Java-index,Desktop,Core GUI APIs...