This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setSize()

 
Simon Whitehouse
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks
Can somebody explain to me why the setSize() at //1 appears to have no effect on the Frame that is produced by this code. I think that it is setting the size because if I add the line
System.out.println(this.getSize());
after //1 then it prints out the dimensions that I am trying to set it to. But the frame produced is miniscule

Thanks
Simon
 
Jim Hall
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because the method pack() was called after you set the size.
From API:
public void pack()
Causes this Window to be sized to fit the preferred size and layouts of its subcomponents. If the window and/or its owner are not yet displayable, both are made displayable before calculating the preferred size. The Window will be validated after the preferredSize is calculated.
Take out pack() and it will be stay the size you set it in the setSize() method.

[This message has been edited by Jim Hall (edited December 18, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic