posted 18 years ago
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 ??