Hi, I have to make a screen of fixed size. Means if the user drags the frame then also it should come back to its normal size. I am able to make the frame of fixed size by doing
public void componentResized(ComponentEvent e) { if( (this.getHeight() < this.DIALOG_HEIGHT) || (this.getWidth() < this.DIALOG_WIDTH) || (this.getHeight() > this.DIALOG_HEIGHT) || (this.getWidth() > this.DIALOG_WIDTH) ) { this.setSize(DIALOG_WIDTH, DIALOG_HEIGHT); } } } where DIALOG_WIDTH, DIALOG_HEIGHT are desired fixed sizes. I am using gridbag layout to arrange the components in the Frame. Whenever i drag the screen, due to the above code it is coming to the defined DIALOG_WIDTH, DIALOG_HEIGHT size, but the components are loosing their place.
Any solution for this ??
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
> I am able to make the frame of fixed size by doing ...
did you try frame.setResizable(false);
Jared Cope
Ranch Hand
Joined: Aug 18, 2004
Posts: 243
posted
0
Hi,
If you don't want your window to be resized, why not try calling setResizable(false) on your window when you are constructing it. That way you don't have to worry about resizing it to your desired size after a user has played around with it.
Cheers, Jared.
SCJP 1.4 91%, SCJP 1.5 88%, SCJD B&S
MaheshNair Chandrasekaran
Greenhorn
Joined: Jul 05, 2006
Posts: 1
posted
0
I had a bug which needed the same solution and I had coded the same like