If you want your JDialog not to be resizable, coders tend to think that setResizable(false) should do the trick. True. But it is common for developers to mistakenly think that this is enough to do the trick.

If you click on a JDialog‘s icon, you will see that the window options are still available. There is no solution to this. You either have to set the icon to null or live with it if you want the icon to appear.

If you call setFocusableWindowState(false), it will work. However, events are blocked so you cannot click on it, type on it or do anything on the dialog window.

If you want to disable only Minimize and Maximize, first call setVisible(true), then invoke setResizable(false). If the sequence is the opposite, both these options are enabled so in order for it to work, these two methods have to be called in order.

As for the Size menu option, there is still no clear cut way to disable this single menu item. But considering that you just called setResizable(false), then the best option for you is to just call setFocusableWindowState(false).

There really is no clear cut solution unless you do not mind hiding the icon, then that should work.

Related Posts Plugin for WordPress, Blogger...