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
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).]