Reputation: 7
I just programmed an interface about user registration. For delete user part, when i click delete button, the program will show a box asking "are you sure about deleting the user?" If i choose yes, then how can i program to show a showDialogMessage to tell the user the user has been deleted?
Upvotes: 0
Views: 344
Reputation: 1685
JOptionPane.showConfirmDialog(Component parentComponent, Object message)
This is for getting confirmation from user.
JOptionPane.showMessageDialog(Component parentComponent, Object message)
this is for showing that the user has been deleted.
Since your question is incomplete, answering in the contrast of Swing
int i=JOptionPane.showConfirmDialog(null,"Are you sure about deleting the user?");
if(i==0) JOptionPane.showMessageDialog(null,"User deleted");
Confirmation box return 0
if chosen is yes
, 1
if chosen is no
and 2
if chosen is cancel
Go through JOptionPane you will get better idea.
Upvotes: 2
Reputation: 7634
Just pitching here, but if you are using swing, look into JOptionPane especially the showMessageDialog
methods.
Upvotes: 2