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 209061

Summary: Need way to narrow declared type of components
Product: guibuilder Reporter: Jesse Glick <jglick>
Component: CodeAssignee: issues@guibuilder <issues>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.2   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description Jesse Glick 2012-03-01 16:21:21 UTC
Consider writing a form in the bug #207436 branch that uses org.netbeans.api.search.ui.ComponentFactory methods, such as org.netbeans.api.search.ui.ScopeComboBox createScopeComboBox(), where the declared type of the component is a known abstract subtype of some standard Swing type (here JComboBox) but the concrete type is not accessible from the form. The best you can do is set custom creation code:

private javax.swing.JComboBox scopeCombo;
...
scopeCombo = org.netbeans.api.search.ui.ComponentFactory.createScopeComboBox();

However then you cannot call any useful methods on scopeCombo from non-guarded code without first casting it to ScopeComboBox, which is a hassle.

Frustratingly, under the Code Generation propset there is a property "Bean Class"... but it is read-only.