| Author |
simple JOptionPane help
|
charlie mills
Ranch Hand
Joined: Nov 01, 2008
Posts: 49
|
|
I've created a dialog box with the options YES/NO but I now I want to perform another task depending on which button the users clicked.
I think I need an if statement saying:
if yes is clicked
then delete row,
if no is clicked,
do nothing.
I'm unsure what to put in the brackets of my if statement.
I know how to delete the row.
Sorry if i haven't explained this very well.
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
Let's start with the code which creates the dialog box.
|
 |
charlie mills
Ranch Hand
Joined: Nov 01, 2008
Posts: 49
|
|
I'm just not sure what to put in the brackets of my if statement.
|
 |
Roberto Perillo
Bartender
Joined: Dec 28, 2007
Posts: 2212
|
|
Howdy, Charlie!
Champion, I believe you are looking for something like this:
|
Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
|
 |
charlie mills
Ranch Hand
Joined: Nov 01, 2008
Posts: 49
|
|
Thanks Roberto.
That's exactly what I was looking for!
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Roberto Perillo wrote:Howdy, Charlie!
Champion, I believe you are looking for something like this:
Just as a note, the choice is not necessarily No - it can also be no choice, if the user clicked away the dialog with the little X. This will give the return value JOptionPane.CLOSED_OPTION which is different from JOptionPane.NO_OPTION. In most cases you don't care though, and will treat CLOSED_OPTION the same as NO_OPTION or CANCEL_OPTION - just as the Javadoc on CLOSED_OPTION mentions.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: simple JOptionPane help
|
|
|