Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.dinopolis.util.gui
Class LoginDialog  view LoginDialog download LoginDialog.java

java.lang.Object
  extended byorg.dinopolis.util.gui.LoginDialog

public class LoginDialog
extends java.lang.Object

A dialog box that asks for a username and a password. Example:

 LoginDialog dialog = new LoginDialog(null,"Login","Enter your name/password");
 System.out.println("after dialog");
 int result = dialog.getValue();
 System.out.println("result: "+result);
 if(result == LoginDialog.CLOSED_OPTION)
   System.out.println("closed");
 else
   if(result == LoginDialog.CANCEL_OPTION)
     System.out.println("canceled");
   else
   {
     System.out.println("username: "+dialog.getUsername());
     System.out.println("password: "+dialog.getPassword());
   }
 dialog = null;
 * 

Version:
$Revision: 1.1.1.1 $

Field Summary
static int CANCEL_OPTION
           
static int CLOSED_OPTION
           
static int OK_OPTION
           
protected  javax.swing.JOptionPane option_pane_
           
protected  javax.swing.JPasswordField password_textfield_
           
protected  java.lang.String password_title_
           
protected  javax.swing.JTextField username_textfield_
           
protected  java.lang.String username_title_
           
 
Constructor Summary
LoginDialog()
          Constructor using a default title and default position.
LoginDialog(java.awt.Frame parent_frame, java.lang.String title)
          Constructor using the title for the dialog box.
LoginDialog(java.awt.Frame parent_frame, java.lang.String title, java.lang.Object message)
          Constructor using the title for the dialog box and additional message object(s).
LoginDialog(java.lang.String title)
          Constructor using the title for the dialog box.
 
Method Summary
 java.lang.String getPassword()
          Get the password.
 java.lang.String getUsername()
          Get the username.
 int getValue()
          Returns the result of the dialog (OK, CANCEL or CLOSED).
static void main(java.lang.String[] args)
           
 void setPassword(java.lang.String password)
          Set the password.
 void setUsername(java.lang.String username)
          Set the username.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

option_pane_

protected javax.swing.JOptionPane option_pane_

username_title_

protected java.lang.String username_title_

password_title_

protected java.lang.String password_title_

username_textfield_

protected javax.swing.JTextField username_textfield_

password_textfield_

protected javax.swing.JPasswordField password_textfield_

CLOSED_OPTION

public static final int CLOSED_OPTION
See Also:
Constant Field Values

OK_OPTION

public static final int OK_OPTION
See Also:
Constant Field Values

CANCEL_OPTION

public static final int CANCEL_OPTION
See Also:
Constant Field Values
Constructor Detail

LoginDialog

public LoginDialog()
Constructor using a default title and default position.


LoginDialog

public LoginDialog(java.lang.String title)
Constructor using the title for the dialog box. The dialog will be centered on screen.


LoginDialog

public LoginDialog(java.awt.Frame parent_frame,
                   java.lang.String title)
Constructor using the title for the dialog box. The dialog will be centered on the parent frame.


LoginDialog

public LoginDialog(java.awt.Frame parent_frame,
                   java.lang.String title,
                   java.lang.Object message)
Constructor using the title for the dialog box and additional message object(s). The dialog will be centered on the parent frame.

Method Detail

getValue

public int getValue()
Returns the result of the dialog (OK, CANCEL or CLOSED).


getUsername

public java.lang.String getUsername()
Get the username.


setUsername

public void setUsername(java.lang.String username)
Set the username.


getPassword

public java.lang.String getPassword()
Get the password.


setPassword

public void setPassword(java.lang.String password)
Set the password.


main

public static void main(java.lang.String[] args)