The extra functionality includes a placeholder string (when the user hasn't yet typed anything), and a button to clear the currently-entered text.
Largely undocumented due to the fact that I (Brian) did not write it.
Public Member Functions | |
SearchField () | |
Constructs a search field with placeholder text of "Search". | |
SearchField (String placeholderText) | |
Constructs a search field with the given placeholder text. | |
void | forceGrabFocus () |
Forces the field to gain focus. | |
void | setSendsNotificationForEachKeystroke (boolean eachKeystroke) |
Sets whether the field posts an action event after each keystroke, as opposed to just when the field loses focus or the user hits the return key. | |
Private Member Functions | |
void | cancel () |
Causes the search field to clear out its text. | |
void | initBorder () |
Initializes the field's border. | |
void | initKeyListener () |
Initializes the key listener for this field. | |
void | maybeNotify () |
Posts an action event if the field is not showing placeholder text. | |
Private Attributes | |
boolean | sendsNotificationForEachKeystroke = false |
Whether the field posts action events every time the text changes (as opposed to just when the user unfocuses the field or hits return). | |
boolean | showingPlaceholderText = false |
Whether the field is showing placeholder text. | |
boolean | armed = false |
Whether the cancel button is armed. | |
PlaceholderText | placeholderTextListener |
The placeholder text listener. | |
Static Private Attributes | |
static final long | serialVersionUID = 8584952661844977286L |
Prevent serialization collisions. | |
static final Border | CANCEL_BORDER = new CancelBorder() |
The border of this field. | |
Classes | |
class | CancelBorder |
Draws the cancel button as a gray circle with a white cross inside. More... | |
class | CancelListener |
Handles a click on the cancel button by clearing the text and notifying any ActionListeners. More... | |
class | PlaceholderText |
Replaces the entered text with a gray placeholder string when the search field doesn't have the focus. More... |
edu.cmu.hcii.calo.view.SearchField.SearchField | ( | ) |
Constructs a search field with placeholder text of "Search".
edu.cmu.hcii.calo.view.SearchField.SearchField | ( | String | placeholderText | ) |
Constructs a search field with the given placeholder text.
placeholderText | the placeholder text to use |
void edu.cmu.hcii.calo.view.SearchField.forceGrabFocus | ( | ) |
Forces the field to gain focus.
void edu.cmu.hcii.calo.view.SearchField.setSendsNotificationForEachKeystroke | ( | boolean | eachKeystroke | ) |
Sets whether the field posts an action event after each keystroke, as opposed to just when the field loses focus or the user hits the return key.
eachKeystroke | true if the field should post an action event after each keystroke, false otherwise |
void edu.cmu.hcii.calo.view.SearchField.cancel | ( | ) | [private] |
Causes the search field to clear out its text.
void edu.cmu.hcii.calo.view.SearchField.initBorder | ( | ) | [private] |
Initializes the field's border.
void edu.cmu.hcii.calo.view.SearchField.initKeyListener | ( | ) | [private] |
Initializes the key listener for this field.
void edu.cmu.hcii.calo.view.SearchField.maybeNotify | ( | ) | [private] |
Posts an action event if the field is not showing placeholder text.
final long edu.cmu.hcii.calo.view.SearchField.serialVersionUID = 8584952661844977286L [static, private] |
Prevent serialization collisions.
final Border edu.cmu.hcii.calo.view.SearchField.CANCEL_BORDER = new CancelBorder() [static, private] |
The border of this field.
boolean edu.cmu.hcii.calo.view.SearchField.sendsNotificationForEachKeystroke = false [private] |
Whether the field posts action events every time the text changes (as opposed to just when the user unfocuses the field or hits return).
boolean edu.cmu.hcii.calo.view.SearchField.showingPlaceholderText = false [private] |
Whether the field is showing placeholder text.
boolean edu.cmu.hcii.calo.view.SearchField.armed = false [private] |
Whether the cancel button is armed.
The placeholder text listener.