File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes resize ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "resize ?" Watch "resize ?" New topic

resize ?

Anh Nguyen

Joined: Jan 24, 2001
Posts: 18
I have a app size (600,600) . How can I limit the user that they can't resize it smaller than (400,400) which mean the minimum size for my app is (400,400) . I tried the setMinimumSize() method but it doesn't work
EX code :
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class TestDraw extends JFrame {
public TestDraw() {
super("Resize test");
Container c = getContentPane();
JPanel mainFrame = new JPanel(new BorderLayout());
mainFrame.setMinimumSize(new Dimension(400,400));

}//end no-argument constructor
public static void main(String[] args) {
TestDraw app = new TestDraw();
new WindowAdapter(){
public void windowClosing(WindowEvent e){
}//end main
}//end program

... No one can escape .......<BR><B>Heavenly Evil Knight</B>
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Set up a ComponentListener and listen for the componentResized() method.

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
I agree. Here's the link:
subject: resize ?
It's not a secret anymore!