NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
Ricardus
Joined: 04 May 2010 Posts: 40 Location: Europe
|
Posted: Wed Dec 14, 2011 11:08 am Post subject: NB 7 designer & JComboBox warnings |
|
|
Hello,
With NB 7.01 and JDK 1.7.0_01 I develop a standard Java Swing application for Java 1.6 and higher, i.e. the project's source format is set to "JDK 6" (but I think I get the same problems with selected "JDK 7"). With the NB GUI designer I drop a JComboBox in a JFrame and enter some lines of text via this JCombobox' model editor, i.e. the lines you can select later in the JComboBox.
This however results in several warnings in the auto generated source code lines for this JComboBox. These warnings are marked as small orange bars on the right, and when you click on them NB jumps to the source code which shows yellow signs left to the lines.
The warnings say: "warning: raw type" or so.
It's about generics, so when for this JComboBox I set in NB designer's properties tab named "Source code" the field "Type parameter" to "<String>", these warnings disapear but another one is reported :
| Quote: | found raw type: javax.swing.DefaultComboBoxModel
missing type arguments for generic class javax.swing.DefaultComboBoxModel<E> |
The auto generatred source code line with the warning, and which sets the JComboBox model, looks like this:
| Quote: | // Code regenerated by the Form Editor.
jCombox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Entry1", "Entry2" })); |
So my question is, why do I obtain warnings when I use JComboBox'es in NB 7 designer? And why do I have to manually set the "Type parameter" for every JComboBox to <String> and still obtain one warning?
Any help much appreciated. |
|
| Back to top |
|
 |
Ricardus
Joined: 04 May 2010 Posts: 40 Location: Europe
|
Posted: Thu Dec 15, 2011 1:08 pm Post subject: |
|
|
So, when you Netbeans users use JComboBox'es with the Netbeans 7 GUI designer (and JDK 1.7), there's no warnings in your auto generated source code?
Why is it with my Netbeans installation, however? Is there some option in Netbeans which I missed? Thanks for any help.
P.S. With Netbeans 6 I didn't have this problem. |
|
| Back to top |
|
 |
Ricardus
Joined: 04 May 2010 Posts: 40 Location: Europe
|
Posted: Sat Dec 17, 2011 2:41 pm Post subject: |
|
|
| Is there any Netbeans 7 (with JDK 7) user at all who actually use a JComboBox in his JDK 6 or JDK 7 project successfully? |
|
| Back to top |
|
 |
Ricardus
Joined: 04 May 2010 Posts: 40 Location: Europe
|
Posted: Wed Dec 21, 2011 8:32 am Post subject: |
|
|
| So nobody uses Netbeans 7 with JComboBox'es. :-( |
|
| Back to top |
|
 |
bolsover
Joined: 24 Jun 2010 Posts: 185
|
Posted: Wed Dec 21, 2011 12:27 pm Post subject: |
|
|
| I use them... no real problems |
|
| Back to top |
|
 |
bjarven
Joined: 17 Mar 2011 Posts: 32 Location: Sweden, Linköping
|
Posted: Wed May 16, 2012 1:10 pm Post subject: |
|
|
I have a related problem I think, or perhaps i should label it an annoyance.
Whenever I compile i get tons of warnings for all my JComboBoxes;
| Code: | MyFile.java:342: warning: [rawtypes] found raw type: JComboBox
private javax.swing.JComboBox jammerComboBox;
missing type arguments for generic class JComboBox<E>
where E is a type-variable:
E extends Object declared in class JComboBox |
Is there a way to disable this warning and only this one? I need the other [rawtypes]-warnings...
I haven't found any way to add generics to the comboboxes generated by matisse either, is that possible? Not that i could do it to all legacy code anyway, but perhaps i should do this when adding new comboboxes. |
|
| Back to top |
|
 |
javaean
Joined: 02 Jul 2009 Posts: 4
|
Posted: Wed Feb 27, 2013 8:24 am Post subject: |
|
|
| It is too late. However, open Properties of jComboBox, the open Code and set Type Parameters as <String> |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|