This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 162455

Summary: Form/Swing editor not calling .pack() on "Other Components"
Product: guibuilder Reporter: fommil <fommil>
Component: CodeAssignee: issues@guibuilder <issues>
Status: NEW ---    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description fommil 2009-04-11 19:38:09 UTC
I used the graphical Java Form/Swing editor to create a form with a button that opens up a JDialog  as modal popup when clicked. The JDialog is 
categorised under the "Other Components" Navigator menu. However, observing the generated code... pack() is never called on the JDialog and there does 
not appear to be any way to tell the popup to be centered under the mouse, or indeed to call .setLocationRelativeTo(this).

Workaround is to manually call jDialog1.pack() and jDialog1.setLocationRelativeTo(this) in the form's constructor. The preferred solution would be for:-

- pack() to be called appropriately
- an option to call setLocationRelativeTo()

so that all of this is done in the initComponents() method.

If you want to see an example, apply patch "java.editor-excluder-update-2.diff" from bug 125060 to main-golden and have a look in the file CodeCompletionPanel in java.editor's org.netbeans.modules.java.editor.options package. Hopefully this will be a part of main-golden within a week.