org.jfree.chart.axis

Class MonthDateFormat


public class MonthDateFormat
extends DateFormat

A formatter that formats dates to show the initial letter(s) of the month name and, as an option, the year for the first or last month of each year.

Constructor Summary

MonthDateFormat()
Creates a new instance for the default time zone.
MonthDateFormat(Locale locale)
Creates a new instance for the specified time zone.
MonthDateFormat(Locale locale, int chars)
Creates a new instance for the specified time zone.
MonthDateFormat(TimeZone zone)
Creates a new instance for the specified time zone.
MonthDateFormat(TimeZone zone, Locale locale, int chars, boolean showYearForJan, boolean showYearForDec)
Creates a new formatter.
MonthDateFormat(TimeZone zone, Locale locale, int chars, boolean[] showYear, DateFormat yearFormatter)
Creates a new formatter.
MonthDateFormat(TimeZone zone, int chars)
Creates a new instance for the specified time zone.

Method Summary

boolean
equals(Object obj)
Tests this formatter for equality with an arbitrary object.
StringBuffer
format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition)
Formats the given date.
static void
main(String[] args)
Some test code.
Date
parse(String source, ParsePosition pos)
Parses the given string (not implemented).

Constructor Details

MonthDateFormat

public MonthDateFormat()
Creates a new instance for the default time zone.

MonthDateFormat

public MonthDateFormat(Locale locale)
Creates a new instance for the specified time zone.
Parameters:
locale - the locale used to obtain the month names (null not permitted).

MonthDateFormat

public MonthDateFormat(Locale locale,
                       int chars)
Creates a new instance for the specified time zone.
Parameters:
locale - the locale (null not permitted).
chars - the maximum number of characters to use from the month names (that are obtained from the date symbols of the default locale). If this value is <= 0, the entire month name is used in each case.

MonthDateFormat

public MonthDateFormat(TimeZone zone)
Creates a new instance for the specified time zone.
Parameters:
zone - the time zone (null not permitted).

MonthDateFormat

public MonthDateFormat(TimeZone zone,
                       Locale locale,
                       int chars,
                       boolean showYearForJan,
                       boolean showYearForDec)
Creates a new formatter.
Parameters:
zone - the time zone used to extract the month and year from dates passed to this formatter (null not permitted).
locale - the locale used to determine the month names (null not permitted).
chars - the maximum number of characters to use from the month names, or zero to indicate that the entire month name should be used.
showYearForJan - a flag that controls whether or not the year is appended to the symbol for the first month of each year.
showYearForDec - a flag that controls whether or not the year is appended to the symbol for the last month of each year.

MonthDateFormat

public MonthDateFormat(TimeZone zone,
                       Locale locale,
                       int chars,
                       boolean[] showYear,
                       DateFormat yearFormatter)
Creates a new formatter.
Parameters:
zone - the time zone used to extract the month and year from dates passed to this formatter (null not permitted).
locale - the locale used to determine the month names (null not permitted).
chars - the maximum number of characters to use from the month names, or zero to indicate that the entire month name should be used.
showYear - an array of flags that control whether or not the year is displayed for a particular month.
yearFormatter - the year formatter.

MonthDateFormat

public MonthDateFormat(TimeZone zone,
                       int chars)
Creates a new instance for the specified time zone.
Parameters:
zone - the time zone (null not permitted).
chars - the maximum number of characters to use from the month names (that are obtained from the date symbols of the default locale). If this value is <= 0, the entire month name is used in each case.

Method Details

equals

public boolean equals(Object obj)
Tests this formatter for equality with an arbitrary object.
Parameters:
obj - the object.
Returns:
A boolean.

format

public StringBuffer format(Date date,
                           StringBuffer toAppendTo,
                           FieldPosition fieldPosition)
Formats the given date.
Parameters:
date - the date.
toAppendTo - the string buffer.
fieldPosition - the field position.
Returns:
The formatted date.

main

public static void main(String[] args)
Some test code.
Parameters:
args - ignored.

parse

public Date parse(String source,
                  ParsePosition pos)
Parses the given string (not implemented).
Parameters:
source - the date string.
pos - the parse position.
Returns:
null, as this method has not been implemented.