Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #18426 > unrolled thread

How to eliminate warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox

Started byclusardi2k@aol.com
First post2012-08-30 08:03 -0700
Last post2012-09-03 18:14 -0700
Articles 11 — 6 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  How to eliminate warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox clusardi2k@aol.com - 2012-08-30 08:03 -0700
    Re: How to eliminate warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox Jeff Higgins <jeff@invalid.invalid> - 2012-08-30 11:31 -0400
      Re: How to eliminate warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox sameer k <sameer12982@gmail.com> - 2012-09-06 14:21 -0700
    Re: How to eliminate warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox Shyam <shyam.k.kotnana@gmail.com> - 2012-08-30 08:38 -0700
    Re: How to eliminate warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-30 11:40 -0400
    Re: How to eliminate warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox Jeff Higgins <jeff@invalid.invalid> - 2012-08-30 11:52 -0400
    Re: How to eliminate warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox Jeff Higgins <jeff@invalid.invalid> - 2012-08-30 12:08 -0400
      Re: How to eliminate warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox Jeff Higgins <jeff@invalid.invalid> - 2012-08-30 12:09 -0400
    Re: How to eliminate warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-30 13:18 -0400
    Re: How to eliminate warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox Roedy Green <see_website@mindprod.com.invalid> - 2012-09-02 14:06 -0700
    Re: How to eliminate warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox Roedy Green <see_website@mindprod.com.invalid> - 2012-09-03 18:14 -0700

#18426 — How to eliminate warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox

Fromclusardi2k@aol.com
Date2012-08-30 08:03 -0700
SubjectHow to eliminate warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox
Message-ID<e56859b3-9877-441e-9ad4-722ed744c8de@googlegroups.com>
Without removing warnings in general, for the below code, how can I remove the below warning.

jComboBox6.addItem("Big rock");

Warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox

Thank you,

[toc] | [next] | [standalone]


#18427

FromJeff Higgins <jeff@invalid.invalid>
Date2012-08-30 11:31 -0400
Message-ID<k1o0uq$i81$1@dont-email.me>
In reply to#18426
On 08/30/2012 11:03 AM, clusardi2k@aol.com wrote:
> Without removing warnings in general, for the below code, how can I remove the below warning.
>
> jComboBox6.addItem("Big rock");
>
> Warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox
>
generics or annotations

[toc] | [prev] | [next] | [standalone]


#18576

Fromsameer k <sameer12982@gmail.com>
Date2012-09-06 14:21 -0700
Message-ID<6de71743-1f40-468f-bccb-03bcbea32a9c@googlegroups.com>
In reply to#18427
On Thursday, August 30, 2012 9:00:35 PM UTC+5:30, Jeff Higgins wrote:
> On 08/30/2012 11:03 AM, clusardi2k@aol.com wrote:
> 
> > Without removing warnings in general, for the below code, how can I remove the below warning.
> 
> >
> 
> > jComboBox6.addItem("Big rock");
> 
> >
> 
> > Warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox
> 
> >
> 
> generics or annotations

to handle this warning in netbeans right click jcombobox and go to properties and open it,then click code tab and find Type parameters and write String in it. this will fix your problem and want generate this warning. doing this will do same as this code >  JComboBox<String> jComboBox6 = new JComboBox<String>(...); and fix it.

[toc] | [prev] | [next] | [standalone]


#18429

FromShyam <shyam.k.kotnana@gmail.com>
Date2012-08-30 08:38 -0700
Message-ID<9a8b27f1-c9fa-4a68-855f-aeae9c72d64d@googlegroups.com>
In reply to#18426
On Thursday, August 30, 2012 8:33:28 PM UTC+5:30, (unknown) wrote:
> Without removing warnings in general, for the below code, how can I remove the below warning.
> 
> 
> 
> jComboBox6.addItem("Big rock");
> 
> 
> 
> Warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox
> 
> 
> 
> Thank you,

Just inherit it from the actual one!

[toc] | [prev] | [next] | [standalone]


#18430

FromEric Sosman <esosman@ieee-dot-org.invalid>
Date2012-08-30 11:40 -0400
Message-ID<k1o1i8$kja$1@dont-email.me>
In reply to#18426
On 8/30/2012 11:03 AM, clusardi2k@aol.com wrote:
> Without removing warnings in general, for the below code, how can I remove the below warning.
>
> jComboBox6.addItem("Big rock");
>
> Warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox

     // NO:
     JComboBox jComboBox6 = new JComboBox(...);

     // YES:
     JComboBox<String> jComboBox6 = new JComboBox<String>(...);

-- 
Eric Sosman
esosman@ieee-dot-org.invalid

[toc] | [prev] | [next] | [standalone]


#18431

FromJeff Higgins <jeff@invalid.invalid>
Date2012-08-30 11:52 -0400
Message-ID<k1o262$pkr$1@dont-email.me>
In reply to#18426
On 08/30/2012 11:03 AM, clusardi2k@aol.com wrote:
> Without removing warnings in general, for the below code, how can I remove the below warning.
>
> jComboBox6.addItem("Big rock");
>
> Warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox
>
<http://www.greenfoot.org/overview>

[toc] | [prev] | [next] | [standalone]


#18432

FromJeff Higgins <jeff@invalid.invalid>
Date2012-08-30 12:08 -0400
Message-ID<k1o341$vlh$1@dont-email.me>
In reply to#18426
On 08/30/2012 11:57 AM, clusardi2k@aol.com wrote:
> So, is everyone in agreement that the warning can be prevented by modifying the definition of the jcombobox and and not in this "additem".
>
> I created the jcombobox in NetBeans by dragging it from the swing palette. The definition for it is in code produced by NetBeans and I can't modify.
>
> What do I do.

Forget Netbeans and learn Java.

>
> Below is the code that I can't change;
>
>      private void initComponents() {
> ...
>         jComboBox6 = new javax.swing.JComboBox();
> }
>
> Thank you,

[toc] | [prev] | [next] | [standalone]


#18433

FromJeff Higgins <jeff@invalid.invalid>
Date2012-08-30 12:09 -0400
Message-ID<k1o36i$vlh$2@dont-email.me>
In reply to#18432
On 08/30/2012 12:08 PM, Jeff Higgins wrote:
> On 08/30/2012 11:57 AM, clusardi2k@aol.com wrote:
>> So, is everyone in agreement that the warning can be prevented by
>> modifying the definition of the jcombobox and and not in this "additem".
>>
>> I created the jcombobox in NetBeans by dragging it from the swing
>> palette. The definition for it is in code produced by NetBeans and I
>> can't modify.
>>
>> What do I do.
>
> Forget Netbeans and learn Java.

or Mama.
>
>>
>> Below is the code that I can't change;
>>
>> private void initComponents() {
>> ...
>> jComboBox6 = new javax.swing.JComboBox();
>> }
>>
>> Thank you,
>

[toc] | [prev] | [next] | [standalone]


#18436

FromEric Sosman <esosman@ieee-dot-org.invalid>
Date2012-08-30 13:18 -0400
Message-ID<k1o79c$soj$1@dont-email.me>
In reply to#18426
On 8/30/2012 11:57 AM, clusardi2k@aol.com wrote:
> So, is everyone in agreement that the warning can be prevented by modifying the definition of the jcombobox and and not in this "additem".
>
> I created the jcombobox in NetBeans by dragging it from the swing palette. The definition for it is in code produced by NetBeans and I can't modify.
>
> What do I do.
>
> Below is the code that I can't change;
>
>      private void initComponents() {
> ...
>         jComboBox6 = new javax.swing.JComboBox();
> }

     In the NetBeans form editor, select the JComboBox.  In the
Properties panel, click the Code tab.  Open the Type Parameters
editor, enter <String> in the box, and close.

> Thank you,

     It seems to me that you are having more trouble with the
NetBeans form designer and its artifacts than with Java and
Swing.  The designer is an intricate beast, with little controls
and menus and twiddly bits festooned all over the landscape, to
the extent that I imagine it might take most of a year's solid
effort to master the complexity.  Someone with that mastery
could probably churn out forms faster than someone just typing
Java code -- but the typist has several months' head start while
the other guy is learning how to use the designer.

     If you expect to be doing a LOT of form designing, by all
means spend the time to learn the form designer inside and out.
But if you just want a simple form or three, skip the designer:
It will just get in your way (as it seems to be doing now).  If
you're having trouble achieving some particular effect you might
create a mock-up in the designer and study the generated code to
get ideas, but I truly think you'll get to a better outcome sooner
by writing the Java code yourself.

-- 
Eric Sosman
esosman@ieee-dot-org.invalid

[toc] | [prev] | [next] | [standalone]


#18514

FromRoedy Green <see_website@mindprod.com.invalid>
Date2012-09-02 14:06 -0700
Message-ID<fgi74819en069k1csqb6sd7se257sh1v9p@4ax.com>
In reply to#18426
On Thu, 30 Aug 2012 08:03:27 -0700 (PDT), clusardi2k@aol.com wrote,
quoted or indirectly quoted someone who said :

>Warning: unchecked call to additem(E) java as a member of the raw type javax.swing.JComboBox

see http://mindprod.com/jgloss/compileerrormessages.html

see http://mindprod.com/jgloss/generics.html
-- 
Roedy Green Canadian Mind Products http://mindprod.com
A new scientific truth does not triumph by convincing its opponents and making them see the light,
but rather because its opponents eventually die, and a new generation grows up that is familiar with it.
~ Max Planck 1858-04-23 1947-10-04 

[toc] | [prev] | [next] | [standalone]


#18522

FromRoedy Green <see_website@mindprod.com.invalid>
Date2012-09-03 18:14 -0700
Message-ID<eela485ie3ngf115jmr2reujv912l7heru@4ax.com>
In reply to#18426
On Thu, 30 Aug 2012 08:03:27 -0700 (PDT), clusardi2k@aol.com wrote,
quoted or indirectly quoted someone who said :

>ComboBox6.addItem("Big rock");

see sample code at http://mindprod.com/jgloss/jcombobox.html

The trick is JComboBox<String>
-- 
Roedy Green Canadian Mind Products http://mindprod.com
A new scientific truth does not triumph by convincing its opponents and making them see the light,
but rather because its opponents eventually die, and a new generation grows up that is familiar with it.
~ Max Planck 1858-04-23 1947-10-04 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web