Netbeans tip & tricks: Swing dialogs with the wrong size (same as previous dialog) June 13, 2008Posted by claudio in Uncategorized.
Tags: bug, Java, netbeans
Netbeans has a killer feature: it’s graphical Swing builder (aka Matisse). It’s fast, flexible and it works. GUI application in no time. Great.
However, when not creating the GUI by hand, it can be difficult to track some bugs. I found out that when using different JDialogs in the same application, resulting in the dialogs having the same size as the first dialog opened. Pretty annoying. This is how to solve it.
Maybe the bug is a consequence of my choice to use a similar set of dialogs (based on the auto-generated AboutBox). This way I create a show<DialogName> method (an adapted copy paste of the showAboutBox method) to launch the corresponding dialog. Like this, I don’t have to deal with different ways of showing dialogs from the main view.
I discovered that the bug was found in the properties of the source file. All related properties refer to the same form. To solve it, open in the graphical UI view, choose the dialog window, go to properties and change the “name” value into whatever you like (I use the Form<DialogName>, e.g. FormOutput.