Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

setResizable & BorderLayout

 
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've got an awt frame which is set to BorderLayout(0,0) and I've got a panel in the "North" and "Center".
When I call setResizable(false) on this frame, I get a 1 pixel margin on the right side.
Why is this happening?
I'm using JDK 1.3.1 on Win.
Thanks,
Drew
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If your using borderlayout this means you are extending JFrame, try this code:
BorderLayout layout = new BorderLayout(0,0);
Container c = getContentPane();
c.setLayout(layout);
JPanel p1,p2;
p1 = new JPanel();
p2 = new JPanel();
Now whatever you like to add to p1 and p2 add them and after that write:
c.add(p1, BorderLayout.NORTH);
c.add(p2, BorderLayout.CENTER);
But make sure first you add all your components like buttons, comboboxes, whatever on the right Layout, but take care that whatever component you want on the North or Center borderlayout you SHOULD put them on panel1 ( p1 ) and panel2 ( p2).
I don't know what you have done , it may be what i already said you didn't explain exactly what you did hope that would help .. good luck
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No he could still be using AWT... AWT still uses BorderLayout.

Though that still doesn't explain why it happens... I don't see this on JDK 1.4.1_01 on my Win2K box... but I may just not be looking closely enough. How did you detect the 1 pixel difference? Through code (one of the sizing methods), or visual inspection?
 
Onion rings are vegetable donuts. Taste this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic