Re: JFrame resizing
- From: "Qu0ll" <Qu0llSixFour@xxxxxxxxx>
- Date: Thu, 29 May 2008 15:47:00 +1000
"Stephan Lukits" <stephan.lukits@xxxxxxxxxxxxxxxx> wrote in message news:g1jfmb$fp4$00$1@xxxxxxxxxxxxxxxxxxxx
Hello Group,
why doesn't the following code work?
import java.awt.*;
import javax.swing.*;
class Test extends JFrame {
public void paint( Graphics g ) {
if ( getSize().width != 200 || getSize().height != 100 ) {
System.out.println("Frame Size is different");
setSize( 200, 100 );
}
g.drawString( "A test string", 50, 75);
}
public static void main( String args[] ) {
JFrame f = new Test();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout( null );
f.setVisible( true );
}
}
I'd expect it to change the frames' size after the user has
resized the frame. But that happen only occasionally.
(I actually want to make sure, that the frams' size dosen't
go below a specific size).
cat /proc/version:
Linux version 2.6.21.4-eeepc (root@LinuxPC) (gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)) #5 Thu Nov 8 17:17:35 UTC 2007
java -version:
java version "1.6.0_05"
Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode)
Also on the subject of JFrame resizing, why is it that I can restrict the minimum size of a JFrame using setMinimumSize() but I cannot restrict the maximum size using setMaximumSize()? The latter appears to have no effect on the sizing constraints of a JFrame.
--
And loving it,
-Qu0ll (Rare, not extinct)
_________________________________________________
Qu0llSixFour@xxxxxxxxx
[Replace the "SixFour" with numbers to email me]
.
- Follow-Ups:
- Re: JFrame resizing
- From: Kenneth P. Turvey
- Re: JFrame resizing
- References:
- JFrame resizing
- From: Stephan Lukits
- JFrame resizing
- Prev by Date: Re: Document Filtering Question
- Next by Date: Resident renderered image after hiding
- Previous by thread: Re: JFrame resizing
- Next by thread: Re: JFrame resizing
- Index(es):
Relevant Pages
|