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 255402 - Wrong code generated for JComboBox
Summary: Wrong code generated for JComboBox
Status: RESOLVED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-18 13:13 UTC by Jiri Prox
Modified: 2015-09-23 01:25 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Prox 2015-09-18 13:13:38 UTC
When adding JComboBox into frame, the model by default contains Strings but the variable is generated as 

private javax.swing.JComboBox<String> jComboBox1;

so the line

jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

is not correct (on jdk < 1.8)


Product Version: NetBeans IDE Dev (Build 201509170002)
Updates: Updates available
Java: 1.8.0_60; Java HotSpot(TM) 64-Bit Server VM 25.60-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_60-b27
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
User directory: C:\Users\jprox\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\jprox\AppData\Local\NetBeans\Cache\dev
Comment 1 Tomas Pavek 2015-09-22 08:45:34 UTC
Thanks for catching this. So we need to initialize comboboxes with String type.
http://hg.netbeans.org/jet-main/rev/984dfff7be37
Comment 2 Quality Engineering 2015-09-23 01:25:00 UTC
Integrated into 'main-silver', will be available in build *201509230002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/984dfff7be37
User: Tomas Pavek <tpavek@netbeans.org>
Log: #255402: in Java 7 combobox can't use Object type parameter with model using array of Strings