desktop/desktop-sample/src/main/java/cz/xelfi/quoridor/desktop/sample/LoginAction.java
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
5 package cz.xelfi.quoridor.desktop.sample;
7 import java.awt.event.ActionEvent;
8 import java.awt.event.ActionListener;
9 import org.openide.DialogDisplayer;
10 import org.openide.NotifyDescriptor;
11 import org.openide.util.NbBundle;
13 public final class LoginAction implements ActionListener {
16 public void actionPerformed(ActionEvent e) {
17 LoginPanel lp = new LoginPanel();
18 NotifyDescriptor nd = new NotifyDescriptor(
20 NbBundle.getMessage(LoginAction.class, "LoginAction.title"),
21 NotifyDescriptor.OK_CANCEL_OPTION,
22 NotifyDescriptor.QUESTION_MESSAGE, null, null
24 Object res = DialogDisplayer.getDefault().notify(nd);
25 if (res == NotifyDescriptor.OK_OPTION) {
26 if (!Quoridor.getDefault().login(lp.getLogin(), lp.getPassword())) {
27 nd = new NotifyDescriptor.Message(
28 NbBundle.getMessage(LoginAction.class, "LoginAction.fail")
30 DialogDisplayer.getDefault().notify(nd);