JFrame resizing
- From: Stephan Lukits <stephan.lukits@xxxxxxxxxxxxxxxx>
- Date: Wed, 28 May 2008 13:34:27 +0200
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)
regards
Stephan
.
- Follow-Ups:
- Re: JFrame resizing
- From: Qu0ll
- Re: JFrame resizing
- From: Roedy Green
- Re: JFrame resizing
- From: Andrew Thompson
- Re: JFrame resizing
- From: Kenneth P. Turvey
- Re: JFrame resizing
- Prev by Date: Re: Swing API for Workflow drawing application
- Next by Date: Re: JFrame resizing
- Previous by thread: Swing API for Workflow drawing application
- Next by thread: Re: JFrame resizing
- Index(es):
Relevant Pages
|