aspose file tools*
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
Author

resize ?

Anh Nguyen
Greenhorn

Joined: Jan 24, 2001
Posts: 18
Hi,
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));

c.add(mainFrame);
setSize(600,500);
show();
}//end no-argument constructor
public static void main(String[] args) {
TestDraw app = new TestDraw();
app.addWindowListener(
new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
}
);
}//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: http://aspose.com/file-tools
 
subject: resize ?