|
Container with a text field with a DateDocument and button to popup date chooser.
Example 1

| DateDocument dd = new DateDocument(Locale.ENGLISH, DateSeparator.SLASH); |
| CalendarField cf = new CalendarField(dd); |
| |
| GregorianCalendar gc = new GregorianCalendar(); |
| gc.set(GregorianCalendar.YEAR, 2011); |
| gc.set(GregorianCalendar.MONTH, 0); |
| gc.set(GregorianCalendar.DAY_OF_MONTH, 20); |
| cf.getDateDocument().setDate(gc.getTimeInMillis()); |
Example 2: changing the popup window title

| DateDocument dd = new DateDocument(Locale.ENGLISH, DateSeparator.SLASH); |
| CalendarField cf = new CalendarField(dd); |
| |
| GregorianCalendar gc = new GregorianCalendar(); |
| gc.set(GregorianCalendar.YEAR, 2011); |
| gc.set(GregorianCalendar.MONTH, 0); |
| gc.set(GregorianCalendar.DAY_OF_MONTH, 20); |
| cf.getDateDocument().setDate(gc.getTimeInMillis()); |
| |
| cf.setCalendarWindowTitle("..."); |
Example 3: changing the calendar icon

| URL urlImage = clss.getResource("/resources/images/find.png"); |
| |
| DateDocument dd = new DateDocument(Locale.ENGLISH, DateSeparator.SLASH); |
| CalendarField cf = new CalendarField(dd); |
| cf.setCalendarButtonIcon(urlImage); |
| |
| GregorianCalendar gc = new GregorianCalendar(); |
| gc.set(GregorianCalendar.YEAR, 2011); |
| gc.set(GregorianCalendar.MONTH, 0); |
| gc.set(GregorianCalendar.DAY_OF_MONTH, 20); |
| cf.getDateDocument().setDate(gc.getTimeInMillis()); |
Example 4: changing the calendar color properties

| DateDocument dd = new DateDocument(Locale.ENGLISH, DateSeparator.SLASH); |
| CalendarField cf = new CalendarField(dd); |
| |
| DefaultPropertiesProvider dpp = new DefaultPropertiesProvider(); |
| CalendarProperties cp = dpp.getProperties(); |
| cp.setDayOfMonthForeground(Color.RED); |
| cf.setPropertiesProvider(dpp); |
| |
| GregorianCalendar gc = new GregorianCalendar(); |
| gc.set(GregorianCalendar.YEAR, 2011); |
| gc.set(GregorianCalendar.MONTH, 0); |
| gc.set(GregorianCalendar.DAY_OF_MONTH, 20); |
| cf.getDateDocument().setDate(gc.getTimeInMillis()); |
|
|
|