JFrame f = new JFrame();
JLabel l = new JLabel("A");
l.setBorder(BorderFactory.createMatteBorder(5,5,5,5,Color.red));
f.getContentPane().add(l);
f.pack();
f.show();
System.out.println(f.getSize());
-> java.awt.Dimension[width=9,height=38]
...except that the window is NOT 9x38, but instead is 128x38 (see p. 60
of
http://developer.apple.com/documentation/Java/Conceptual/
Java141Development/Java141Development.pdf). Notice what happens after
you move the resize box. Java 1.3.1 instead allows arbitrarily small
windows and is consistent, unlike 1.4.x
I guess it's okay to specify a minimum possible window size, though
128x32 is quite inexplicable. But to mis-state your window size is
definitely a bug. Question is: how can I determine the _true_ size of
the window, and ideally the size of the content pane that would fill
that window? This would allow me to do this:
JFrame f = new JFrame();
...
f.pack();
l.setSize(f.trueSize()); // force proper resizing of components
f.show();
Sean
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden