Lockable JFrames?


Z

Zerex71

Greetings,

I was wondering if there was a way to "lock" a JFrame to a certain
size to prevent user resize attempts. It won't kill me not to have it
but I would like to keep a JFrame (containing a drawing canvas) to
stay a fixed size. I have looked through all the documentation and
the set*Size() methods don't seem to do it for me.

Thanks,
Mike
 
Ad

Advertisements

C

Chase Preuninger

myFrame.setResizable(false);

What I want to know, is there a way to set a max/min size for a frame?
 
R

RedGrittyBrick

Chase said:
myFrame.setResizable(false);

What I want to know, is there a way to set a max/min size for a frame?

AFAIK the best you can do is catch resizing events and if the new size
is outside your bounds, resize the frame to bring it back within bounds.
This looks a bit odd to the user.
 
Ad

Advertisements

Z

Zerex71

myFrame.setResizable(false);

What I want to know, is there a way to set a max/min size for a frame?

You could try setMinimumSize(Dimension) and setMaximumSize(Dimension).
 

Top