com.limegroup.gnutella.gui
Class InputFieldDialog

java.lang.Object
  extended bycom.limegroup.gnutella.gui.InputFieldDialog

public final class InputFieldDialog
extends java.lang.Object

This class creates a generic input field that gets a line of text input from the user in a JDialog. It gives the user "OK" and "Cancel" button options, and the constructor takes keys for locale- specific strings that allow customization of the dialog caption as well as the label on the input field.


Field Summary
static int CANCELLED
          The return code for when the user cancelled the action.
static int NO_TEXT_ENTERED
          The return code for when the user has pressed ok but not entered any text.
static int TEXT_ENTERED
          The return code for when the user has entered some text.
 
Constructor Summary
InputFieldDialog(java.lang.String LABEL_KEY)
          Constructs an input field with a generic caption and a specialized label for the field.
InputFieldDialog(java.lang.String CAPTION_KEY, java.lang.String LABEL_KEY)
          Constructs an input field using the specified locale-specific keys for both the caption and the field label.
 
Method Summary
 java.lang.String getText()
          Returns the text contained in the wrapped text field.
 int showDialog()
          Displays the modal dialog, returning the appropriate return code to the caller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_TEXT_ENTERED

public static final int NO_TEXT_ENTERED
The return code for when the user has pressed ok but not entered any text.

See Also:
Constant Field Values

CANCELLED

public static final int CANCELLED
The return code for when the user cancelled the action.

See Also:
Constant Field Values

TEXT_ENTERED

public static final int TEXT_ENTERED
The return code for when the user has entered some text.

See Also:
Constant Field Values
Constructor Detail

InputFieldDialog

public InputFieldDialog(java.lang.String LABEL_KEY)
Constructs an input field with a generic caption and a specialized label for the field.

Parameters:
LABEL_KEY - the key for the locale-specific label of the field

InputFieldDialog

public InputFieldDialog(java.lang.String CAPTION_KEY,
                        java.lang.String LABEL_KEY)
Constructs an input field using the specified locale-specific keys for both the caption and the field label.

Parameters:
CAPTION_KEY - the key for the locale-specific dialog caption
LABEL_KEY - the key for the locale-specific label of the field
Method Detail

showDialog

public int showDialog()
Displays the modal dialog, returning the appropriate return code to the caller. The return code can be one of the following: NO_TEXT_ENTERED CANCELLED TEXT_ENTERED

Returns:
the return code for the window

getText

public java.lang.String getText()
Returns the text contained in the wrapped text field.

Returns:
the text contained in the text field