TOC

Overview

Audience

This document is intended to be used by application builders who would like to build Java applications which provide date increment/decrement functionality. The application developer is expected to be familiar with the Java language and the JavaBeans architecture. The developer should be familiar with building applications by linking beans in an application builder tool. Familiarity with the functionality of DateSpinner would be advantageous, though not mandatory. No knowledge about the implementation of DateSpinner is required in order to use these beans.


previous How to Use This Guide

Guide Conventions

Typographical Conventions

Conventions Description Example
Text in italics figures, reference to chapters and other sections, task name etc. Figure 1, Overview, etc.
  • Round bullets
list of points
  • NumericSpinner Bean
  • DateSpinner Bean
  • TimeSpinner Bean
Text in Courier font

names of classes,methods, events, part of code included in the document, etc.

ActionPerformed

Images

Image Used to
previous navigate to the previous sub-heading
previous navigate to the previous main heading
toc return to the Table of Contents
note represent a Note information

Guide Organization

Overview - introduces the user to the DateSpinner bean. Provides information like intended audience, guide conventions, guide organization and copyrights

Bean at a Glance - gives a brief overview of the bean. It also provides information on the commonly used methods, events and properties.

Bean Description - explains the bean in detail. It provides information on dependencies, security, customization, etc.

Summaries - summarizes the properties, methods and events of the bean.

Reference to Properties - links to the respective properties.

Reference to Methods - links to the respective methods.

Reference to Events - links to the respective events.

Support Classes - provides information on the public classes.

See Also- links to related topics


previous Copyrights And Trademarks

Copyright © 1998 IBM Corp.

All rights reserved.

IBM and VisualAge are trademarks of International Business Machines in the United States and/or other countries.

* Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc, in the U.S. and other countries.


TOC

Bean at a Glance

Bean Overview

public class DateSpinner extends Spinner
This bean is a component with two small direction buttons that lets the user modify the value in an input field or possibly enter a new legal date value directly in the input field. By setting the value of the specified property, the user can separately increase the year, month and day. It allows different date formats(i.e. mm/dd/yyyy or dd/mm/yyyy). 


previousCommonly used Methods, Events and Properties

Creation Methods

DateSpinner()
DateSpinner(int mask_index)

Key Properties

currentValue
minValue
maxValue
stepValue
stepUnit
elapsedDays
dateMaskIndex

Commonly used Methods

getCurrent()
     Gets the current date value of the DateSpinner.
setCurrent(Date cur_val)
     Sets the current date value of the DateSpinner.


Key Events

Increment - The event is fired to all registered ActionListeners when the currrent value of DateSpinner increases.
Decrement - The event is fired to all registered ActionListeners when the currrent value of DateSpinner decreases.
 


up

Bean Description

Functional Overview

The DateSpinner allows


previousDependencies

The DateSpinner requires the services of


previousSecurity

Only Java security restrictions apply.


previousUser Interface

The bean has a user-friendly GUI. Refer to the section User Interface in the Spinner Overall bean documentation for detailed information.


previousIntrospection

public class DateSpinnerBeanInfo



 

up

Summaries

Property Summary

<Name> [Constrained | Bound | Indexed ] <Datatype> <Description> <default value> <access type> 
dateMaskIndex Bound int Date format option 0 Read / Write
stepUnit Bound int Step unit (year,month or day) 0 Read / Write
stepValue Bound int Increment value 1 Read / Write
minValue Bound Date Minimum value 1998-01-01 Read / Write
maxValue Bound Date Maximum value 1998-12-31 Read / Write
currentValue Bound Date Current value 1998-01-01 Read / Write
elapsedDays Bound int Days between Minimum and Maximum value 364 Read / Write
dayDisplayEnabled Bound boolean Day displaying option true Read / Write


previousMethod Summary


previousEvent Summary

As Listener :


up

Reference to Properties

 


up

Reference to Methods

public void addActionListener(ActionListener l)
Adds the specified action listener to receive action events.

         Parameters:
                 l - the ActionListener to be added.
 

public DateSpinner()

Constructor for DateSpinner. Constructs a DateSpinner with default settings. The GUI is constructed and initialized with pre-set values.
 

public DateSpinner(int mask_index)

Constructor for DateSpinner. Constructs a DateSpinner with specified date format.

         Parameters:
               mask_index - the date format index.
 

public Date getCurrent()

Gets the current date value.

         Returns:
                the current date value.
 

public int getDateFormat()

Gets the date format.

         Returns:
                 the date format.
 

 public int getElapsedDays()

Gets the elapsed days between the minimum and the maximum value.

        Returns:
                the elapsed days between the minimum and the maximum value.
 

public Date getMax()

Gets the maximum value.

         Returns:
                 the maximum value.
 

public Date getMin()

Gets the minimum value.

         Returns:
                 the minimum value.
 

public int getStep()

Gets the increment value.

         Returns:
                 the increment value.
 

 public int getStepUnit()

Gets the increment unit(i.e. year,month and day).

         Returns:
                 the increment unit.
 

public boolean isDayDisplayEnabled()

Returns a boolean to indicate wether the day display option is selected.

     Returns:
          the day display option.
 

public void removeActionListener(ActionListener l)

Removes the specified action listener so that it will no longer receive action events.

         Parameters:
                 l - the ActionListener to be removed.
 

 public void setCurrent(Date cur_val)

Sets the current date value.

         Parameters:
                 cur_val - the desired date value.

public void setDateFormat(int mask_index)

Sets the date format.

         Parameters:
                 mask_index - the desired date format.
 

public void setDayDisplayEnabled(boolean disp_flag)

Sets the day display option.

     Parameters:
          disp_flag - boolean to indicate the day display option.
 

public void setElapsedDays(int val)

Sets the elapsed days between the minimum and the maximum value (Note that when the elapsed days changes to a different value, the maximum value will be changed accordingly).

         Parameters:
                 val - the desired elapsed days between the minimum and the maximum value.
 

public void setMax(Date max_val)

Sets the maximum value.

         Parameters:
                 max_val - the desired maximum value.
 

public void setMin(Date min_val)

Sets the minimum value.

         Parameters:
                 min_val - the desired minimum value.
 

public void setStep(int step_val)

Sets the increment value.

         Parameters:
                 step_val - the desired increment value.
 

 public void setStepUnit(int unit)

Sets the increment unit(i.e. year, month and day).

         Parameters:
                 unit -the desired increment unit.
 


up

Reference to Events

The DateSpinner fires the following events:

  1.  increment/decrement event to

As Listener

    public class java.awt.event ActionEvent
    Specifies the DateSpinner current increment/decrement value.

    public interface java.awt.event.ActionListener
    Event listener interface for ActionEvent. The methods contained in the interface are:


 

up

Support Classes

 
None.


up

See Also

Java Programming Language

Java Beans Specifications


This document is last updated in V1.0 on 04/02/1998