Forums Register Login

simple GridBagLayout question

+Pie Number of slices to send: Send
Ok, I thought I understood GBL, but obviously I dont! -below is a simple piece of code which I thought would give me a blue panel, 200*700 anchored to the north of the frame, which is nearly fullscreen size.
Can anyone tell me why all I get is a tiny blue square in the middle of the screen?!!
Thanks,

Eoin.

+Pie Number of slices to send: Send
change
0.0, 0.0, // weightx, weighty

to
0.5, 0.5, // weightx, weighty

and see what happens
+Pie Number of slices to send: Send
Thanks Michael,
That dosnt make any difference. Im really confused! -Ive dropped GBL for now though, I can get sufficiently good results using null layout, so Im going to run with that, seems easier!!
Thanks for your help though.

E
+Pie Number of slices to send: Send
> That dosnt make any difference.

it does with me - winXP, java 1.5.0_05

it goes from a small square 10x10?, to fill the contentPane 1010x700

note:
myPanel.setSize(200,700);
won't work when subject to a layout manager

> I can get sufficiently good results using null layout,
the 'gotchas' will come back and bite you, but, so be it.
No, tomorrow we rule the world! With this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1105 times.
Similar Threads
how to align components in GridBagLayout in JAVA swing
How to stop JTextField collapsing when using GridBagLayout?
GridBagLayout/JScrollPane Bug Explained- Is there a workaround?
Problem displaying JTable inside a JScrollPane
JScrollPane Frustrations
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:38:09.