Re: JFrame resizing
- From: Stephan Lukits <stephan.lukits@xxxxxxxxxxxxxxxx>
- Date: Thu, 29 May 2008 12:50:41 +0200
Stephan Lukits schrieb:
[...]
This code is a simplified version of what I have in mind:
import java.awt.*;
import javax.swing.*;
class Test extends JFrame {
public void paint( Graphics g ) {
if ( isRecalculationNecessary() ) {
setSize( calculateSize() );
repaint();
return;
}
g.drawString( "A test string", 50, 75);
}
boolean isRecalculationNecessary() {
return (getSize().width != 200) || (getSize().height != 100);
}
Dimension calculateSize() {
return new Dimension( 200, 100 );
}
public static void main( String args[] ) {
JFrame f = new Test();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setLayout( null );
f.setSize( 200, 100 );
f.setVisible( true );
}
}
It works only occasionally at resizing and always at maximizing.
On an other box it works perfectly well! Did I find a Java-GUI Bug?
regards
Stephan
.
- References:
- JFrame resizing
- From: Stephan Lukits
- Re: JFrame resizing
- From: Andrew Thompson
- Re: JFrame resizing
- From: Stephan Lukits
- Re: JFrame resizing
- From: Stephan Lukits
- JFrame resizing
- Prev by Date: Re: JFrame resizing
- Next by Date: Re: Hiding a JTexfield from the GUI
- Previous by thread: Re: JFrame resizing
- Next by thread: Re: JFrame resizing
- Index(es):
Relevant Pages
|