Resizing question

Hi,

maybe this is a stupid question, but my Swing knowledge is a bit rusty: Some of the dialogs in IDEA (e.g. the Run/Debug dialog) don't allow resizing to a value less than a certain threshold; any attempt to resize them to a tiny window causes them to "jump back" to that minimum size. How do you achieve this with the GUI designer? Is this done via a Swing property or a proprietary one?

Thanks in advance,
Jens

5 comments
Comment actions Permalink

Each component on a form has a minimum size. Sum up them and some edge/fill gaps, you will get a minimum size of dialog. Using UI builder, just assign the minimum height/width of components will get the effect.

0
Comment actions Permalink

Sorry, but I seem to be too dense to accomplish that. I am trying something like

but no way I can get a frame with the above property. Can anyone give me a hint?

Thanks a lot in advance,
Jens

0
Comment actions Permalink

Ain't working either :(
What does work (as I have found out in the meantime) is adding a ComponentListener with a suitable componentResized() method to the JFrame.

Nevertheless, thanks for your answers.

0
Comment actions Permalink

I am desperately searching for the solution which IDEA guys have found for their resizable frames/dialogs... Finally i decided to search here and to post a topic.
What one can find in google/sun forums/java forums/etc is using componentResized() method plus some ideas for overriding paint(Graphics) method. They work in some GUI environments and specific GUI configurations and don't work for others.. The problem is that in KDE, when the environment is set to do "life" resizing (dynamic layout, each mouse movement makes the Swing's frame to resize), when the mouse is released after dragging there is one final COMPONENT_RESIZED event not sent which your componentResized() method to catch and to be the last one which snaps back the frame to required minimum size. So what happens is that while still dragging the mouse the componentResized() method is invoked many many times and at some point it finds out that the dragged size is smaller than required minimum size, sets the frame size to the minimum size; meanwhile user continues dragging.... if user stops moving the mouse, wait a little (few seconds) with pressed button, then release the mouse button, there is no snap back. Here is one of the suggested solutions using ComponentListener. It works on WinXP both when dynamic resizing is on and off. On KDE is work only when dynamic resizing is off (means that while dragging the mouse user can see only frame border and real resizing happens when user releases the mouse)

If someone here has an idea how in IDEA the frames and dialogs always snap back.... It would be just great... (Shall I post this as top-level post...?)

0

Please sign in to leave a comment.