In such case, you can create your own class that extends the class. Customizing the date formatThe default format of the date shown in the text field may not suite your need. Result: If you want to set initial date for the text field, use the following statement: tSelected(true) Result:Ĥ. tDate(1990, 8, 24) That sets the initial date to Septem(because in Java, the month number is zero-based). ![]() For example: UtilDateModel model = new UtilDateModel() Setting initial dateYou can set the initial date for the calendar component when it is popped up. For example, the following statement gets the selected date in case the model is UtilDateModel: Date selectedDate = (Date) datePicker.getModel().getValue() For the CalendarDateModel model, use the following code: Calendar selectedValue = (Calendar) datePicker.getModel().getValue() ĭate selectedDate = selectedValue.getTime() For the SqlDateModel model, use the following code: selectedDate = () datePicker.getModel().getValue() 3. And notice that, depending on the model used,the JDatePickerImpl returns the selected date object of appropriate type.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |