hello i have created a form layout using grid bag layout..
with four columns and few rows.
but i need to add three combo boxes in second column (for date month and year), but they are overlapping to each other.
here is my code..
i am giving the gridx=1 to all the combo boxes therefore the are overlapping to each other, but i want all in the same column.
how can i do??
i highlight the code for combo boxes..
actually from line 257, i tried to format the code and tried to change the color, but unfortunately html formatting is not working inside code tags, i think.
this is the code for combo boxes.
all are coming in second column but overlapping each other.
yes, and i make all the gridx of combo like:
gridx=1;
gridx=2;
gridx=3;
now my all the component are shift..
i want all three combos in the second column.
like in second column of all rows text fields are in front of label, but int this row i want three combos of date of birth, in place of text field only.
but if i change gridy, they all come in different different rows.
offcourse in same column(because i have not changed the gridx), but i change grid y so rows are changed.
I honestly now have no idea what you're trying to do, or want.
from your 1st post
" but i need to add three combo boxes in second column (for date month and year), but they are overlapping to each other. "
then in your 3rd post
"i want all three combos in the second column. "
then in your 5th post
"but if i change gridy, they all come in different different rows. "
so, you want them in a column, original problem - they're overlapping,
now, if they all come in different rows - that's a problem?
perhaps it's time to fire up MS Paint and draw a picture of exactly whta you want and where it is to go,
because all of the above makes no sense to me i.e. in a column, not in different rows and not overlapping
I just want to help clarify something for you. In GridBagLayout there really isn't any upper limit on the number of columns and rows you have. The layout manager creates them on an as needed basis. What the gridx and gridy mean is not how many there are, but their relative position. So gridx = 0 means that you're putting something all the way to the left, gridy = 0 means you're starting at the top. Now if you increment y, you'll go down another row. If you increment x it'll take you over a column. The more you increment them, the more the layout manager allocates on the panel/frame/whatever. This is where your fill comes in, you can then fill components to take up all available space(GridBagConstraints.BOTH), fill only horizontal(GridBagContraints.HORIZONTAL), or fill only vertical(GridBagContraints.VERTICAL), none which means that it will compact the item as small as it can(GridBagContraints.NONE). You can also specify that an object takes up more than one space with gridheight and gridwidth.
Post by:autobot
I am going down to the lab. Do NOT let anyone in. Not even this tiny ad:
a bit of art, as a gift, the permaculture playing cards