Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

resize ?

 
Anh Nguyen
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set up a ComponentListener and listen for the componentResized() method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic