JDatePicker v4.3

Package com.standbysoft.component.date.swing.plaf.basic

Contains the UI delegates that implement the look and feel for the Swing date components.

See:
          Description

Class Summary
AbstractDateFieldUI Defines the general structure that is used by subclasses to implement the actual UI delegate for JDateField.
AbstractDatePickerUI Defines the general structure that is used by subclasses to implement the actual UI delegate for JDatePicker.
AbstractMonthUI Defines the general structure that is used by subclasses to implement the actual UI delegate for JMonth.
AbstractMonthViewUI Defines the general structure that is used by subclasses to implement the actual UI delegate for JMonthView.
AbstractMonthViewUI.CalendarLayout This layout manager is used to arrange components of a JMonthView.
BasicDateFieldUI Implements only what is strictly necessary for a JDateField UI delegate.
BasicDatePickerUI Implements only what is strictly necessary for a JDatePicker UI delegate.
BasicMonthUI Implements only what is strictly necessary for a JMonth UI delegate.
BasicMonthViewUI Implements only what is strictly necessary for a JMonthView UI delegate.
DateRendererUIResource A subclass of DefaultDateRenderer that implements UIResource.
DefaultMonthUI Default implementation for a JMonth UI delegate.
DefaultMonthViewUI Default implementation for a JMonthView UI delegate.
 

Package com.standbysoft.component.date.swing.plaf.basic Description

Contains the UI delegates that implement the look and feel for the Swing date components. A UI delegate is an object used by a Swing component to implement its look and behavior. In other words, it is what the user actually sees as component. If this is a new concept for you, the article Introducing Swing Architecture has a detailed presentation about it.

To learn more about this package you may want to read about:

The Purpose of This Package

The isolation of the UI implementation makes it possible to use whatever delegate. You are free to choose the face that suits best your component in a given context.

For instance, this package provides a UI delegate for JMonthView (a calendar component) that has two buttons to scroll to the previous and next months in the calendar. For most applications this could be enough but you might need to also have two buttons that scroll the year. This problem can be solved easily by using a different UI delegate that adds the two buttons and the corresponding functionality.

Creating a delegate from scratch is a time consuming task, so this package is meant to help you create them with as little effort as possible.

How to Read This Package

This package contains quite a few classes, so here is how they are organized.

Having this structure in mind, you can now read more about each of the classes from this package.

How to Use This Package

The purpose of this package is to help you create custom UI delegates for the date components. You can create a delegate from scratch by implementing the DateUI interface but that would surely take you a lot of time. An easier way is to just extend the basic classes from this package.

If what you need is just a UI delegate slightly different that the default ones, you should extend the default classes.

How to Configure UI Delegates

When working with Swing components one can either configure the actual component (JTree) or its UI delegate (MetalTreeUI). Configuring the UI delegate is done seldom and only to fine-tune the look and feel. The straight forward way to configure a UI delegate is to obtain a reference to it from the component and then call the methods that do the configuration. But this approach is inconvenient because it requires some casts.

Another way to make the configuration is to enable it using a client property. That is, you register a client property on the component and then the UI delegate does the configuration as it is notified about the change.For instance, one can configure a MetalTreeUI delegate to indicate how the angled lines between the nodes of a JTree are drawn. To do that, the "JTree.lineStyle" client property is registered on the JTree component that uses this delegate.

	//create a JTree instance; we assume the Metal LF is used
	JTree tree = new JTree();
	
	//configure the MetalTreeUI by means of a client property
	//this registration is useless if some other UI delegate is used
	tree.putClientProperty("JTree.lineStyle", "Angled"); 

The UI delegates from this package can also be fine-tuned with such client properties. Using this approach to configure the components keeps the API general and clean. For explanations about what client properties are available for each UI delegate you should read the description for the following abstract classes: AbstractDatePickerUI, AbstractDateFieldUI, AbstractMonthUI, AbstractMonthViewUI .

Related Documentation

The tutorial contains a step by step example that shows how to create and register your own UI delegate.


JDatePicker v4.3

Visit www.jdatepicker.com for further information or send us your suggestions.

Copyright © 2003-2007 Stand By Soft Ltd. All Rights Reserved.