Home » GWT DateBox

GWT DateBox

GWT DateBox is a text field which pops-up date picker when we click inside. The getValue and setValue methods return/accept Date objects, not raw Strings.

GWT DateBox Syntax

GWT DateBox Nested Classes

Class Description
DateBox.DefaultFormat It is the default DateBox.Format class.
DateBox.Format It is implemented by a delegate to handle the parsing and formatting of date values.

GWT DateBox Constructors

Constructor Description
DateBox() It creates a date box with a new DatePicker.
DateBox(DatePicker picker, java.util.Date date, DateBox.Format format) It creates a new date box.

GWT DateBox Common Methods

Modifier and types Methods Description
HandlerRegistration addValueChangeHandler(ValueChangeHandler<java.util.Date> handler) It adds a ValueChangeEvent handler.
LeafValueEditor<java.util.Date> asEditor() It returns a TakesValueEditor backed by the DateBox.
int getCursorPos() It gets the current cursor position in the date box.
DatePicker getDatePicker() It gets the date picker.
boolean getFireNullValues() It returns true iff the date box will fire ValueChangeEvents with a date value of null for invalid or empty string values.
DateBox.Format getFormat() It gets the format instance used to control formatting and parsing of this DateBox.
int getTabIndex() It gets the date box’s position in the tab index.
TextBox getTextBox() It get text box.
java.util.Date getValue() It get the date displayed, or null if the text box is empty, or cannot be interpreted.
void hideDatePicker() It hide the date picker.
boolean isDatePickerShowing() It returns true if date picker is currently showing, false if not.
void setAccessKey(char key) It sets the date box’s ‘access key’.
void setFormat(DateBox.Format format) It sets the format used to control formatting and parsing of dates in this DateBox.
void setTabIndex(int index) It sets the date box’s position in the tab index.
void showDatePicker() It parses the current date box’s value and shows that date.

GWT DateBox Example

Output:

GWT Datebox 1

Next TopicGWT SuggestBox

You may also like