Chapter 2. How to Use the Components

Table of Contents

1. Before We Begin
2. Using a JDateComponent
2.1. Selecting a Date
2.2. Allowing Empty Selection or Null Dates
2.3. Concepts: About Date Selection Models
2.4. Listening for Changes on Date Selection Model
2.5. Implementing a Date Selection Model
2.6. Listening for Action Events
2.7. Associating Date Actions with Key Strokes
2.8. Disabling the Component
3. Using a JDateEditComponent
3.1. Setting an Appropriate Date Format
3.2. Concepts: About Date Models
3.3. Listening for Changes on Date Model
3.4. Concepts: About Date Parsers
3.5. Implementing a Date Parser
3.6. Configuring Validation Behavior
3.7. Configuring Editing Behavior
4. Using the JDatePicker Component
4.1. Working with an Editable Date Picker
4.2. Changing the Background Color
4.3. Configuring the Popup Calendar
4.4. Localizing the Component
4.5. Using a Custom Look and Feel
4.6. Installing a Date Cell Editor for JTable
5. Using the JDateField Component
6. Using a JMonth Component
6.1. Selecting Dates
6.2. Changing the Selection Type
6.3. Localizing the Component
6.4. Changing Colors and Font
6.5. Concepts: About Date Renderers
6.6. Implementing a Date Renderer
6.7. Configuring the Grid
6.8. Showing Trailing Dates
6.9. Showing Week Numbers and Day Names
6.10. Selecting Dates with Simple Mouse-Clicks
6.11. Using the Keyboard
7. Using a JMonth Component - Expert Features
7.1. Concepts: About Month Models
7.2. Listening for Changes on Month Model
7.3. Implementing a Month Model
7.4. Change the Displayed Month
7.5. Enabling Week Selections
7.6. Concepts: About Week Models
7.7. Listening for Changes on Week Model
7.8. Implementing a Week Model
7.9. Specify when the Week Starts
7.10. Using ISO week numbers
8. Using the JMonthView Component
8.1. Using Multiple Months
8.2. Localizing the Component
8.3. Allowing Empty Selection
8.4. Changing Scrolling Behavior
8.5. Showing the Today Button
8.6. Showing the Status Bar

1. Before We Begin

This tutorial is intended for developers who want to use the JDatePicker suite components in their applications. It shows how the API can be used effectively to get the most out of the components. The following image shows how the JDatePicker suite API is structured:

Figure 2.1. JDatePicker Suite API Structure

JDatePicker Suite API Structure

The blue components are concrete while the orange ones are abstract. The following sections give a detailed description of each one of them.