The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
September 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

controlling size of a JFrame

Posted by Mohapatra on September 23, 2001 at 2:52 AM

Hi,
I want a Jframe to be of constant height(let's say 300). User should be able to change the width of the JFrame, but the height of the JFrame cannot be changed. I tried to catch the componentResized event and then change the height to original height. But there are some problems, 1) when user resizes by dragging the broder of the frame, no event comes, After resizing, the resized event comes. So in componentResized event if I do setSize(the current widht, 300)) there is a flickering. 2) In case of maximize, though it is OK, but restoring the size will not happen. Because after maximize, if I do setSize(), while restoring the size by again clicking on maximize button, it will find that the frame is not in maximized state so again maximize it. So the size cannot be restored.

It should work like windows Search File(start->search->folder/file).

Thanks in advance.




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us