Article View: borland.public.jbuilder.java.swing
Article #1410Re: How do you have the user input an integer using JOptionPane.showInputDialog
From: Craig Simmons
Date: Sat, 20 Dec 2003 14:49
Date: Sat, 20 Dec 2003 14:49
40 lines
2343 bytes
2343 bytes
Hi
What you want to do is...
int invQty;
String retValue = JOptionPane.showInputDialog (null, "What is the quantity
of
\"" + invName + "\"?","Enter Quantity", JOptionPane.QUESTION_MESSAGE);
try{
invQty = Interger.parseInt(retValue);
catch(NumberFormatException x){
//handle error
}
Craig
"DementiaT" <dementiat@high.net> wrote in message
news:o548uvshiobdff6str8j1rgvc5o25oqd3f@4ax.com...
: Beginner here :)
:
: Im trying to do just that...have the user enter an integer into the
: dialog box...
:
: my code is:
: ...
:
: int invQty;
:
: invQty = JOptionPane.showInputDialog (null, "What is the quantity of
: \"" + invName + "\"?","Enter Quantity", JOptionPane.QUESTION_MESSAGE);
:
: ...
:
: I get an incompatible type error... it seems
: JOptionPane.showInputDialog only accepts strings?
:
: Thanks :)
:
:
Technical Details
Message-ID:
<bs1nh1$p3k$1@hercules.btinternet.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!priapus.visi.com!orange.octanews.net!news.octanews.net!news-out.visi.com!petbe.visi.com!in.100proofnews.com!in.100proofnews.com!cycny01.gnilink.net!cyclone1.gnilink.net!peer01.cox.net!cox.net!news-hub.cableinet.net!blueyonder!mephistopheles.news.clara.net!news.clara.net!news-peer-test!news-peer0-test!btnet-peer1!btnet-feed5!btnet!news.btopenworld.com!not-for-mailReferences:
<o548uvshiobdff6str8j1rgvc5o25oqd3f@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,27de1d2f359fcaca X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2003-12-20 06:50:03 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!priapus.visi.com!orange.octanews.net!news.octanews.net!news-out.visi.com!petbe.visi.com!in.100proofnews.com!in.100proofnews.com!cycny01.gnilink.net!cyclone1.gnilink.net!peer01.cox.net!cox.net!news-hub.cableinet.net!blueyonder!mephistopheles.news.clara.net!news.clara.net!news-peer-test!news-peer0-test!btnet-peer1!btnet-feed5!btnet!news.btopenworld.com!not-for-mail From: "Craig Simmons" <Cjs1@btinternet.com> Newsgroups: borland.public.jbuilder.java.swing Subject: Re: How do you have the user input an integer using JOptionPane.showInputDialog Date: Sat, 20 Dec 2003 14:49:06 +0000 (UTC) Organization: BT Openworld Lines: 42 Message-ID: <bs1nh1$p3k$1@hercules.btinternet.com> References: <o548uvshiobdff6str8j1rgvc5o25oqd3f@4ax.com> Reply-To: "Craig Simmons" <Cjs1@btinternet.com> NNTP-Posting-Host: host213-122-47-105.in-addr.btopenworld.com X-Trace: hercules.btinternet.com 1071931746 25716 213.122.47.105 (20 Dec 2003 14:49:06 GMT) X-Complaints-To: news-complaints@lists.btinternet.com NNTP-Posting-Date: Sat, 20 Dec 2003 14:49:06 +0000 (UTC) X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MSMail-Priority: Normal X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165