A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
REST with Spring (video course)
this week in the
Swing / AWT / SWT
restrictions on resizing JFrame
Joined: Oct 28, 2009
Apr 28, 2010 07:41:45
i just want to ask,
well, i have here a
size set as 1024 x 768.
it is resizable.
what i want to know is, how can i restrict the frame from resizing when it reaches 800 x 600?
i mean, when resized, the smallest possible size of the frame must be 800 x 600 and will not go smaller than that.
any suggestions are very much appreciated. thank you.
Joined: Jul 26, 2007
Apr 28, 2010 09:59:34
Try out setPreferredSize()
How to ask questions
Donate a pint, save a life!
Onff-turn it on!
Joined: Jun 09, 2003
Apr 28, 2010 13:51:56
> what i want to know is, how can i restrict the frame from resizing when it reaches 800 x 600?
presume you mean resize smaller
the only way I've seen possible do do what you want is to add this line
(prior to creating the frame)
's default L&F is not the best looking.
a hack is to add a windowListener which snaps it back to 800,600 if smaller,
then, when snapped-back, you could add code to make it not resizable
Joined: Oct 27, 2005
Apr 28, 2010 14:21:16
Actually, since Java 5.0 the call to JFrame.setDefaultLookAndFeelDecorated(true); is no longer needed. The minimum size is now adhered to with at least the default look&feel (Metal), the Motif look and feel and the Windows look and feel.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
I agree. Here's the link:
subject: restrictions on resizing JFrame
Size of undecorated area of JFrame
Regarding status bar resizing
Good Screen Size
Fix the UI to 600 x 800 size
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015