setting the minimum size for the frame

Hi,

How do I set a minimum size for a frame?

I have frame.setResizable(true);

but I want to set a minimum size for the frame

I donot want the user to resize the frame

so much that certain components are not visible/hidden

How do I do this

frame doenot seem to have any frame.setMinimumsize()

sort of api

any suggestion?

[389 byte] By [mjha1] at [2007-9-26 1:55:26]
# 1

Hi mjha1,

I don't have any solid answer for this but I think what i have will work.

Add ComponentListener to the frame and in the componentResized method check for the height and width of the frame and if it is less set back to the minimum size.

Rectangle frameDim=null;

addComponentListener(new ComponentAdapter()

{

public void componentResized(ComponentEvent ee)

{

frameDim = getBounds();

if(frameDim.width<200)

{

setSize(200,frameDim.height);

}

if(frameDim.height<300)

{

setSize(frameDim.width,300);

}

if(frameDim.width>220)

{

setSize(220,frameDim.height);

}

if(frameDim.height>300)

{

setSize(frameDim.width,300);

}

}

I hope you got what i said..

Deepak

Deepak_sh at 2007-6-29 3:09:20 > top of Java-index,Archived Forums,Swing...
# 2
try setting a minimum size for one of the components on the frame.
darrelln at 2007-6-29 3:09:20 > top of Java-index,Archived Forums,Swing...