Re: JFrame resizing
- From: Stephan Lukits <stephan.lukits@xxxxxxxxxxxxxxxx>
- Date: Thu, 29 May 2008 10:42:39 +0200
Stephan Lukits schrieb:
Andrew Thompson schrieb:On May 28, 9:34 pm, Stephan Lukits <stephan.luk...@xxxxxxxxxxxxxxxx>> [...]
wrote:
...
(I actually want to make sure, that the frams' size dosen't
go below a specific size).
<sscce></sscce>
Thanks for your answer to the above question. This question
unfortunately is a simplification of what I actually want.
Resizing was an important part of the question. Now I try
to be precise and short
This would be a simplified code example from 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 true; }
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 );
}
}
But this code works at my side only the first time
and when I maximize the window, then it snaps back.
regards
Stephan
.
- References:
- JFrame resizing
- From: Stephan Lukits
- Re: JFrame resizing
- From: Andrew Thompson
- Re: JFrame resizing
- From: Stephan Lukits
- JFrame resizing
- Prev by Date: Re: Hiding a JTexfield from the GUI
- Next by Date: Re: JFrame resizing
- Previous by thread: Re: JFrame resizing
- Next by thread: Re: JFrame resizing
- Index(es):
Relevant Pages
|