Article View: borland.public.jbuilder.java.swing
Article #10256Re: JOptionPane Cancel Option
From: Lois Neo
Date: Wed, 20 Oct 1999 00:00
Date: Wed, 20 Oct 1999 00:00
33 lines
1750 bytes
1750 bytes
Hi,
don't quite get what you mean... do you mean you want to know if Cancel
button is pressed or some other buttons are pressed in the message dialog?
If so, don't think u can do it with showMessageDialog() because it does not
return any status. You can use showConfirmDialog() instead which returns an
int. Check the returned value something like this:
int result = JOptionPane.showConfirmDialog(frame, message);
if (result == JOptionPane.CANCEL_OPTION) {
.....
}
else {
....
}
Hope it helps.
Lois
Microsoft News <jyoung@kplus.com> wrote in message
news:7ufd9j$p5s27@forums.borland.com...
> I'm kind of a newbie to Java. Anyway I was writing a couple of programs
> that display information in the JOptionPane.showMessageDialog. I was
> wondering how I access the Cancel button and tell the Dialog to do
something
> else if the Cancel button is pressed. I notice that when I press the
Cancel
> button in my applications that it terminates but a bunch of exceptions are
> thrown in the execution log.
>
> Any help would be appreciated. This is probably an easy one for you pros.
>
>
>
Technical Details
Message-ID:
<7uk5al$7609@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7ufd9j$p5s27@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,f34e96a043e78532 X-Google-Attributes: gid111d45,public From: "Lois Neo" <slneo@cybergal.com> Subject: Re: JOptionPane Cancel Option Date: 1999/10/20 Message-ID: <7uk5al$7609@forums.borland.com> X-Deja-AN: 538363394 References: <7ufd9j$p5s27@forums.borland.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Reply-To: "Lois Neo" <slneo@cybergal.com> Newsgroups: borland.public.jbuilder.java.swing