🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #1423

Re: Jcombobox and numbers

#1423
From: tz
Date: Mon, 10 Nov 2003 08:24
45 lines
2152 bytes
Thanks Lori.
"Lori M Olson (TeamB)" <javadragon@techie.com> wrote in message
news:3faec463$2@newsgroups.borland.com...
> tz wrote:
> > Please someone give me some sample code to add numbers in jcombobox.
This is
> > my code:
> >   void cmbCalendar_actionPerformed(ActionEvent e) {
> >    String s =  (String) cmbYear.getSelectedItem();
> >    if (s.equals("Gregorian"))
> >    {
> >      for (int x = 1583; x < 2501; x++)
> >      {
> >        cmbYear.addItem((String) (x));
> >      ...............
> > The above line is erroring out. Can someone tell me how to correct this
with
> > a code sample?
> > thanks.
> >
> >
>
> Why add stuff as strings, when you really want to be dealing with numbers?
>
> cmbYear.addItem( new Integer(x) );
>
> -- 
>
> Regards,
>
> Lori Olson (TeamB)
>
> ------------
>
> Save yourself, and everyone else, some time and search the
> newsgroups and the FAQ-O-Matic before posting your next
> question.
>
> Google Advanced Newsgroup Search
>      http://www.google.ca/advanced_group_search
> Other Newsgroup Searches:
>      http://www.borland.com/newsgroups/ngsearch.html
> Joi Ellis's FAQ-O-Matic:
>      http://www.visi.com/~gyles19/fom-serve/cache/1.html
>
Technical Details
Message-ID: <3faf4b45$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3fae5464$1@newsgroups.borland.com> <3faec463$2@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,a319fdba4750032b
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2003-11-10 00:39:06 PST
From: "tz" <teddybubu@hotmail.com>
Newsgroups: borland.public.jbuilder.java.swing
References: <3fae5464$1@newsgroups.borland.com> <3faec463$2@newsgroups.borland.com>
Subject: Re: Jcombobox and numbers
Date: Mon, 10 Nov 2003 02:24:39 -0600
Lines: 47
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 65.29.24.114
Message-ID: <3faf4b45$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1068452677 65.29.24.114 (10 Nov 2003 00:24:37 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail