I'm having troubles with the call to setResizable(false) adding an extra 10 pixels or so to the height and width of my JFrame. This frame needs to have its internal area precisely sized because it is going to display a JPanel which draws an image of a precise size.
Below is the code I'm using. If I leave out the call to setResizeable(), my panel is drawn at the correct size. If I use the call, immediately afterward the frame will have gained extra pixels. I've tried putting the call to setResizable() in several places, but nothing works. How can I stop this call from adding a gap to my window?
This is happening on Windows Vista.
public class SwingFrame extends JFrame
{
JPanel panel = new MyPanel();
public SwingFrame(Config config)
{
setResizable(false);
panel.setPreferredSize(new Dimension(320, 240));
add(panel);
pack();
}
}
Edited by: Mark_McKay on Oct 11, 2009 4:58 AM