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 - Need way to narrow declared type of components
Summary: Need way to narrow declared type of components
Status: NEW
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-01 16:21 UTC by Jesse Glick
Modified: 2012-03-01 16:21 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.