• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

resize ?

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Set up a ComponentListener and listen for the componentResized() method.
reply
    Bookmark Topic Watch Topic
  • New Topic