• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

simple GridBagLayout question

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
change
0.0, 0.0, // weightx, weighty

to
0.5, 0.5, // weightx, weighty

and see what happens
 
Eoin Mac Aoidh
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> 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.
 
Or we might never have existed at all. Freaky. So we should cherish everything. Even this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic