[kaffe] [AWT] Bug Report: Frame "size" problems

Daniel Tschernatsch daniel.tschernatsch@gmx.de
Fri Mar 21 04:24:01 2003


In my Application (a game, which hits gnu.savannah.org very soon) I need a 
little bit more consistency of the java.awt.Frame's size. I added a Panel to 
the Frame, that is in control of it's size using the getPrefferedSize method. 
But running my program I ended up with a Frame showing my Panel in bigger 
Dimension(s) than I expected. Calling Frame.setResizable(false) doesn't 
really freeze the size of a Frame since a use can do a shade/unshade to have 
some strange but harmful effect...

Is this going to be fixed in the next release of Kaffe? Hope that anybody 
takes a look at my problem. I'm sorry, I had no chance to try out the CVS 
version.
Thank you.

Running Kaffe JIT 1.0.7 (Java 1.1) I get strange results from my code snippet:

Just let the window open itsself and hit the close button:
Frame: java.awt.Dimension[width=656,height=426]
Panel: java.awt.Dimension[width=656,height=426]
The Panel is bigger than 640x370 >> unsuspected behavior.
PS: I had to move the getSize() call in the WindowAdapter, because even
after calling setVisible(true) the size is (0,0) when not moving the window
before hittin [X]

Now after a shade unshade I get:
Frame: java.awt.Dimension[width=672,height=454]
Panel: java.awt.Dimension[width=672,height=454]
You can imagine how a splashscreen animation with gaps to the east and south 
looks like now.

In SUN's JRE 1.3 I get the expected:
Frame: java.awt.Dimension[width=648,height=394]
Panel: java.awt.Dimension[width=640,height=370]


import java.awt.*;
import java.awt.event.*;

public class Debug extends Frame {

    public Debug() {
	add(new Panel() {
	    public Dimension getPreferredSize() {
		return new Dimension(640, 370);
	    }
	});
	pack();
	setResizable(false);
	addWindowListener(new WindowAdapter() {
	    public void windowClosing(WindowEvent e) {
		System.out.println("Frame: " + getSize().toString());
		System.out.println("Panel: " + getSize().toString());
		System.exit(0);
	    }
	});
	setVisible(true);
    }

    public static void main(String[] args) {
	new Debug();
    }
}