Home | Products | Support | Contacts | Links |
Date Time Picker - Frequently Asked Questions1. How do I change the hour time format to 24 Hour format? 2. How do I change the clock to display in 24 Hour format? 3. How do I have an empty Date Time Picker that doesn't have any date time selection by default? 4. How do I restrict date selection? 5. How do I restrict time selection? 6. How do I change the clock face? 7. How do I change the clock needles? 8. How do I set tooltip for unavailable days in the Date Time Picker? 9. How do I get rid of the "Java Applet Window" message on the popup? 10. How do I change the labels like OK, Cancel...? 1. How do I change the hour time format to 24 Hour format? The DateTimePicker uses the hourFormat property of LocaleSpecificResources class to select the hour format. The DateTimePicker constructor picks the property from the LocaleSpecificResources and formats the display. The DateTimePicker hour format doesn't change after the constructor. Use the LocaleSpecificResources.setHourFormat method to set the hour format. 2. How do I change the clock to display in 24 Hour format? Even if the LocalSpecificResources.hourFormat property is set to 24 Hour format, The clock panel will displays in 12 hour format. If you still want to force the clock panel to 24 hour format, you can do so by setting the hourFormat property of the clock panel to LocaleSpecificResources.HOUR_FORMAT_24.
3. How do I have an empty Date Time Picker that doesn't have any date time selection by default? In 2.8.0 version, you can directly construct a DateTimePicker with null to have blank date. Use the "setDisplayClearButton" method to allow user to clear date time selection. For older version, Here is an class that extends the DateTimePicker to implement a empty DateTimePicker which will not have a default selection. When there is no selection, null be returned as the selected date time. If null is set as the date time, the DateTimePicker selection becomes empty. import java.util.*; 4. How do I restrict date selection? Use the DateUnavailablityModel to set dates that can't be selected. See the example demo source code. You can also use the setMinSelectableTime() and setMaxSelectableTime() to set a selectable time period. 5. How do I restrict time selection? There is no TimeUnavailablityModel similar to DateUnavailablityModel to restrict time selection, but you can use setMinSelectableTime() and setMaxSelectableTime() to set a time period. 6. How do I change the clock face? The clock face can be set to a custom image by calling the setFaceImage() method on the clock panel. The demo source code TestClockPanel.java uses this method to change the clock face image. 7. How do I change the clock needle? The clock needles can be customized for shape, height and width. Since the clock needles are dynamically resized relative to the clock radius, the height is specified as a ratio of the needle height to the clock radius. The is same is for width. See demo source code TestTimePanel.java for more details. 8. How do I set tooltip for unavailable days in Date Time Picker? Currently the DateUnavailabilityModel doesn't support tooltip for unavailable dates. But there is a way you could still set the tool tip for unavailable dates. The CalendarPanel has two panels inside it. One is the day header panel on the north and the other one is the center panel that holds the date buttons. All you have to do is get this center panel and get all the date buttons and set the tooltip for them. The date buttons are changed whenever the month selection is changed, you can use the container listener to update the date buttons. Look at the sample code for more details. ToolTipDateTimePicker.java for more details. 9. How do I get rid of the "Java Applet Window" message on the popup? Sign the applet that you are deploying. Check the link on how to sign an applet. http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/rsa_signing.html 10. How do I change the labels like OK, Cancel...? Use the LocaleSpecificResources.setLabelString(key, value) method to set the label. Check the API document for more information. |