Article View: borland.public.jbuilder.java.swing
Article #997How can I know which button is clicked in JDialog ShowModal
From: Angry Orca
Date: Tue, 17 Aug 2004 23:16
Date: Tue, 17 Aug 2004 23:16
26 lines
1434 bytes
1434 bytes
Hi, all,
In a programme using swing (homework), I use a JDialog window. There are
two buttons on this dialog window. I want to write the program in this way:
// some thing
JDialog d = new ...
...
d.setModal(true);
d.show();
if (d.close = btnOk){
...
} else if (d.close == btnCancel){
...
}
In fact I want to use this way like in the windows programming:
int i = d.showModal();
if (i == ok){
...
} else if ( i == cancel){
...
}
Please help me. I am a newbie in swing programming.
Thanks a lot.
Technical Details
Message-ID:
<412291da$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 111d45,f4e663468e7be18,start X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Wed, 18 Aug 2004 00:16:22 +0100 From: Angry Orca <luke@prismtechnologies.com> User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040115 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: How can I know which button is clicked in JDialog ShowModal Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 217.43.110.227 Message-ID: <412291da$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1092784602 217.43.110.227 (17 Aug 2004 16:16:42 -0700) Lines: 26 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail