Re: JFrame resizing
- From: Andrew Thompson <andrewthommo@xxxxxxxxx>
- Date: Wed, 28 May 2008 06:03:02 -0700 (PDT)
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>
import javax.swing.*;
import java.awt.*;
class MinimumSizeFrame extends JFrame {
public void paint(Graphics g) {
super.paint(g);
g.setColor( Color.BLACK );
g.drawString(
"WxH: " + getWidth() + "x" + getHeight(),
20,
40 );
}
public static void main(String[] args) {
Runnable r = new Runnable() {
public void run() {
JFrame f = new MinimumSizeFrame();
f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
f.setMinimumSize( new Dimension(400,300) );
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
}
};
EventQueue.invokeLater(r);
}
}
</sscce>
--
Andrew T.
PhySci.org
.
- Follow-Ups:
- Re: JFrame resizing
- From: Stephan Lukits
- Re: JFrame resizing
- From: Kenneth P. Turvey
- Re: JFrame resizing
- References:
- JFrame resizing
- From: Stephan Lukits
- JFrame resizing
- Prev by Date: Re: JFrame resizing
- Next by Date: Re: JFrame resizing
- Previous by thread: Re: JFrame resizing
- Next by thread: Re: JFrame resizing
- Index(es):
Relevant Pages
|