Possible Duplicate:
JDialog allow user to only change width of the dialog
I have a JDialog that I would like the width to be resizable, but the height not.
This is my current code:
addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
setLocation(getLocation().x, getLocation().y + (getHeight() - staticHeight));
setSize(new Dimension(getWidth(), staticHeight));
super.componentResized(e);
}
});
Problem is, that code gets called after the window is resized. Making the window resize and then flicker back.
I would like to make it so when the user trys to drag the height of the window it does nothing.
you can't directly stop resizing,
you can't block basic property of containers,
container because from Native OS and are built on its properties,
and limitations for resizing is screen size
rest are (with code) Resizing Components by @camickr
there are dirty hack based on AbsoluteLayout, and I don't suggest using that
block resize if there is any flickering or freeze during resize
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With