author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Tue, 14 Sep 2010 08:30:37 +0200 | |
branch | desktop |
changeset 263 | ac802aa234fc |
child 268 | 13fe01081e23 |
permissions | -rw-r--r-- |
jaroslav@263 | 1 |
/* |
jaroslav@263 | 2 |
* To change this template, choose Tools | Templates |
jaroslav@263 | 3 |
* and open the template in the editor. |
jaroslav@263 | 4 |
*/ |
jaroslav@263 | 5 |
package cz.xelfi.quoridor.desktop.sample; |
jaroslav@263 | 6 |
|
jaroslav@263 | 7 |
import java.awt.event.ActionEvent; |
jaroslav@263 | 8 |
import java.awt.event.ActionListener; |
jaroslav@263 | 9 |
import org.openide.DialogDisplayer; |
jaroslav@263 | 10 |
import org.openide.NotifyDescriptor; |
jaroslav@263 | 11 |
import org.openide.util.NbBundle; |
jaroslav@263 | 12 |
|
jaroslav@263 | 13 |
public final class LoginAction implements ActionListener { |
jaroslav@263 | 14 |
|
jaroslav@263 | 15 |
@Override |
jaroslav@263 | 16 |
public void actionPerformed(ActionEvent e) { |
jaroslav@263 | 17 |
LoginPanel lp = new LoginPanel(); |
jaroslav@263 | 18 |
NotifyDescriptor nd = new NotifyDescriptor( |
jaroslav@263 | 19 |
lp, |
jaroslav@263 | 20 |
NbBundle.getMessage(LoginAction.class, "LoginAction.title"), |
jaroslav@263 | 21 |
NotifyDescriptor.OK_CANCEL_OPTION, |
jaroslav@263 | 22 |
NotifyDescriptor.QUESTION_MESSAGE, null, null |
jaroslav@263 | 23 |
); |
jaroslav@263 | 24 |
Object res = DialogDisplayer.getDefault().notify(nd); |
jaroslav@263 | 25 |
if (res == NotifyDescriptor.OK_OPTION) { |
jaroslav@263 | 26 |
if (!Quoridor.getDefault().login(lp.getLogin(), lp.getPassword())) { |
jaroslav@263 | 27 |
nd = new NotifyDescriptor.Message( |
jaroslav@263 | 28 |
NbBundle.getMessage(LoginAction.class, "LoginAction.fail") |
jaroslav@263 | 29 |
); |
jaroslav@263 | 30 |
DialogDisplayer.getDefault().notify(nd); |
jaroslav@263 | 31 |
} |
jaroslav@263 | 32 |
} |
jaroslav@263 | 33 |
} |
jaroslav@263 | 34 |
} |