Okay so here is my problem. I have created a JFrame class and I want to make the content pane inside be a certain size. Since the JFrames size is not the size of the content pane I have to resize the contentpane and pack the JFrame to the correct size. The problem is that I think that setting the JFrame resizable to false causes an increase in the panels size even if I set to maximum size. This happens verry randomly (1 in 50 or so) so I decided to put the code in the AWT thread because I thought it would fix it. Here is the said code:
> The problem is that I think that setting the JFrame resizable to false causes an increase in the panels size...
in a test program, I also see this, but a lot more often than 1 in 50 (java 1.6, win 7),
and if a timer delay is used to print the specs, it is always increased, so possibly the
times when the specs are the same, it is some calculation error (?)
at all times, the frame specs are the same 656x518. (see additional note ***, below)
at all times, when resizable(true) the panel/contentPane specs are 640x480.
most times, when resizable(false) the panel/contentPane specs are 650x490,
but occasionally (1 in 4 or 5) the specs are 640x480.
the 1 sec delay timer code always produces specs of 650x490.
my guess is because the default L&F uses the OS for the titlebar and it's border, and
java has no access to these, the 'resizable' arrows are triggered from a border added
to one of the frame's internal panes (rootPane?).
if you use
where java does control the titleBar and borders (hence no need to add additional border
for resizable arrows), all the numbers come out correct i.e. all at 640x480
also, the frame specs change from 656x518 to 650x513 ***<-----------------
don't know what the fix is, but here's my test program if you want to play around with it
So I made some my own JFrame class and it seems to work properly now. If there is any problem doing it this way I would like to know, but for now this is what I will use.
The component listener will get the the resize event that has been resizing the pane incorrectly and adjust it so it still maintains the correct size.