SuperJTextField Class Reference

List of all members.

Public Member Functions

 SuperJTextField ()
 SuperJTextField (int numCols)
 SuperJTextField (String string)
 SuperJTextField (String defaultText, int numCols)
void addPossibleCompletion (String completion)
 OLD: Add an autocomplete entry, and keep track of the number of times it has been "added" to the completions list.
int getExitKey ()
 Asks for the last key pressed.
String getInputHint ()
boolean getLastKeyShiftDown ()
String getText ()
void removePossibleCompletion (String completion)
void setFocusGainedOnEdit (boolean foe)
void setInputHint (String hint)
 Set it to null to turn this feature off.
void setPossibleCompletions (final List< String > possible)
Override void setText (String t)

Static Public Member Functions

static void main (String[] args)

Protected Member Functions

Document createDefaultModel ()
boolean noText ()

Protected Attributes

boolean inputHintShowing
int lastKeyCode = -1
Color textColor = Color.BLACK
Font textFont

Classes

class  SuperDocument
 This private class provides autocomplete functionality.

Detailed Description

This JTextField is great for inputting text. It offers amazing features, so much so that you will want to use it everywhere... After reading this, you will never use a JTextField again!

As you type, the 10 nearest above, possible Entries are quickly trimmed down, due to prefix search. A typing listener needs to be installed needs to check for enter or backspace...

Features: Autocomplete, Input Hints

TODO: Implement ComboBoxEditor to allow this to be an awesome combobox editor field.

This software is distributed under the BSD License.

Author:
Ron B Yeh (ronyeh(AT)cs.stanford.edu)

Definition at line 44 of file SuperJTextField.java.


Constructor & Destructor Documentation

SuperJTextField ( int  numCols  ) 

Parameters:
i 

Definition at line 190 of file SuperJTextField.java.

SuperJTextField ( String  string  ) 

Parameters:
string 

Definition at line 198 of file SuperJTextField.java.

References SuperJTextField.setText().

SuperJTextField ( String  defaultText,
int  numCols 
)

Parameters:
defaultText 
numCols 

Definition at line 208 of file SuperJTextField.java.

References SuperJTextField.setText().


Member Function Documentation

void addPossibleCompletion ( String  completion  ) 

OLD: Add an autocomplete entry, and keep track of the number of times it has been "added" to the completions list.

NEW: Just keep track of completions, and match with the most recent (earliest) in the list.

Parameters:
completion 

Definition at line 222 of file SuperJTextField.java.

Referenced by SuperJTextField.main().

int getExitKey (  ) 

Asks for the last key pressed.

It can be used for fun things, like... How did the user set/confirm the value, and exit this box?

Returns:

Definition at line 241 of file SuperJTextField.java.

References SuperJTextField.lastKeyCode.

String getInputHint (  ) 

Returns:

Definition at line 248 of file SuperJTextField.java.

boolean getLastKeyShiftDown (  ) 

Returns:

Definition at line 255 of file SuperJTextField.java.

static void main ( String[]  args  )  [static]

Parameters:
args 

Definition at line 123 of file SuperJTextField.java.

References SuperJTextField.addPossibleCompletion(), SuperJTextField.setInputHint(), SuperJTextField.setInputHintFont(), and SuperJTextField.SuperJTextField().

boolean noText (  )  [protected]

Returns:
if the JTextField has no text showing...

Definition at line 275 of file SuperJTextField.java.

Referenced by SuperJTextField.setInputHint(), and SuperJTextField.setText().

void removePossibleCompletion ( String  completion  ) 

Parameters:
completion 

Definition at line 282 of file SuperJTextField.java.

void setInputHint ( String  hint  ) 

Set it to null to turn this feature off.

Parameters:
hint 

Definition at line 295 of file SuperJTextField.java.

References SuperJTextField.noText().

Referenced by SuperJTextField.main().

void setPossibleCompletions ( final List< String >  possible  ) 

Parameters:
possibleCompletions 

Definition at line 333 of file SuperJTextField.java.


The documentation for this class was generated from the following file:
Generated on Sat Apr 14 18:21:46 2007 for R3 Paper Toolkit by  doxygen 1.4.7