JCalendar Sample

This sample is located in \Samples\ActiveX\JCalendar.

Description
Using the Sample
Key Project Files
Technologies Demonstrated

Description

This sample is a complete JavaBean with properties, events, icons, and property editors. The sample displays a calendar with dates that can be selected using the mouse (clicking dates in the calendar or selecting the buttons that follow the calendar) or the keyboard (arrow keys, PAGE UP, and PAGE DOWN keys).

You must have Microsoft® Internet Explorer 4.0 or later installed to use this sample.

Using the Sample

To use the sample

  1. Activate the calendar by selecting a date. You can click the date in the calendar or click one of the buttons that follow the calendar.

  2. When the calendar has been activated, you can select dates using the mouse as described in step 1 or by using the keyboard:

Selecting a date in a different year displays a dialog box notifying you of the year change.

To edit the Bean in Microsoft Visual Basic

  1. Run Register.bat in the \Samples\ActiveX\JCalendar directory to register the JavaBean.

  2. Start Microsoft® Visual Basic® and place the JCalendar component in a Form.

  3. Add a method for JCalendar events, such as yearChanged or monthChanged.

  4. Run the JavaBean in Visual Basic, using the keyboard or mouse to change the date.

Key Project Files

JCalendar.java

This class creates the JCalendar class and implements the Serializable interface. The code defines methods (writeObject and readObject) for custom serialization of JCalendar so that it can be written to and read from the hard disk. It also registers listeners for mouse-click and arrow key events, contains methods for displaying the calendar, processes user input, and fires events.

JCalendarBeanInfo.java

This class provides additional information about the calendar JavaBean. It provides a list of properties and specifies their editors.

JCalendarListener.java

This class defines the listener interface for the calendar JavaBean. It defines year-, month-, and date-change events.

JCalendarMonthEditor.java

This class defines an editor for the calendar month.

JCalendarYearEditor.java

This class defines an editor for the calendar year.

Technologies Demonstrated

ActiveXBeans

© 1999 Microsoft Corporation. All rights reserved. Terms of use.