How do I set a fixed size for a window (frame) :P

hello!

Was wondering if I can set fix dimensions (size) for a window(frame) in Java.

Background: I have a menu and when I click on one of the options a window opens but I hate the fact that I can enlarge it...wish it would be fixed sized and have scroll instead... :P

any ideas?

many thanks!

Cristina

[337 byte] By [Cris.Mariaa] at [2007-11-27 3:51:51]
# 1
setSize();
filestreama at 2007-7-12 8:55:51 > top of Java-index,Java Essentials,Java Programming...
# 2
Swing related questions should be posted in the Swing forum.frame.setResizable( false );
camickra at 2007-7-12 8:55:51 > top of Java-index,Java Essentials,Java Programming...
# 3

hei!

I agree, sorry for not using the swing forum but i considered java programming forum as more or less enclosing all problems :P...i will try next time to see better where my subject fits.

and thanks also for the solution! it works!!!

thanks to everyone that replied!

have a nice evening, Cris

Cris.Mariaa at 2007-7-12 8:55:51 > top of Java-index,Java Essentials,Java Programming...
# 4
Try the setSize(int x, int y) method with x as the width and y as the height
imgnakikurbta at 2007-7-12 8:55:51 > top of Java-index,Java Essentials,Java Programming...
# 5
orframe.pack(); //give frame its "preferred" sizeframe.setResizable(false);
DrLaszloJamfa at 2007-7-12 8:55:51 > top of Java-index,Java Essentials,Java Programming...
# 6

> sorry for not using the swing forum but i considered java programming forum as more or less enclosing all problems

Do you understand how to use forums? First you should be searching the forums to see if you questions has been asked and answered before. (Very few questions posted in the forums are original). It makes sense to search the forum where the questions should have been posted in the first place.

For example, if you had searched the Swing forum using "fixed size jframe" you would have found this posting at the top of the search results:

http://forum.java.sun.com/thread.jspa?forumID=57&threadID=712407

So you would have had your question answered in less than a minute and we wouldn't have wasted time answering a question that has already been answered.

A win-win situtation for everybody.

camickra at 2007-7-12 8:55:51 > top of Java-index,Java Essentials,Java Programming...