本文整理汇总了Java中org.jfree.date.SerialDate类的典型用法代码示例。如果您正苦于以下问题:Java SerialDate类的具体用法?Java SerialDate怎么用?Java SerialDate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SerialDate类属于org.jfree.date包,在下文中一共展示了SerialDate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: constructSelectionPanel
import org.jfree.date.SerialDate; //导入依赖的package包/类
/**
* Constructs a panel containing two JComboBoxes (for the month and year)
* and a button (to reset the date to TODAY).
*
* @return the panel.
*/
private JPanel constructSelectionPanel() {
final JPanel p = new JPanel();
final int minMonth = this.chosenDate.getMinimum(Calendar.MONTH);
final int maxMonth = this.chosenDate.getMaximum(Calendar.MONTH);
final String[] months = new String[maxMonth - minMonth + 1];
System.arraycopy(SerialDate.getMonths(), minMonth, months, 0,
months.length);
this.monthSelector = new JComboBox(months);
this.monthSelector.addActionListener(this);
this.monthSelector.setActionCommand("monthSelectionChanged");
p.add(this.monthSelector);
this.yearSelector = new JComboBox(getYears(0));
this.yearSelector.addActionListener(this);
this.yearSelector.setActionCommand("yearSelectionChanged");
p.add(this.yearSelector);
return p;
}
示例2: Day
import org.jfree.date.SerialDate; //导入依赖的package包/类
/**
* Constructs a new instance, based on a particular date/time and time zone.
*
* @param time the date/time (<code>null</code> not permitted).
* @param zone the time zone (<code>null</code> not permitted).
* @param locale the locale (<code>null</code> not permitted).
*/
public Day(Date time, TimeZone zone, Locale locale) {
if (time == null) {
throw new IllegalArgumentException("Null 'time' argument.");
}
if (zone == null) {
throw new IllegalArgumentException("Null 'zone' argument.");
}
if (locale == null) {
throw new IllegalArgumentException("Null 'locale' argument.");
}
Calendar calendar = Calendar.getInstance(zone, locale);
calendar.setTime(time);
int d = calendar.get(Calendar.DAY_OF_MONTH);
int m = calendar.get(Calendar.MONTH) + 1;
int y = calendar.get(Calendar.YEAR);
this.serialDate = SerialDate.createInstance(d, m, y);
peg(calendar);
}
示例3: createDailyTimeSeries1
import org.jfree.date.SerialDate; //导入依赖的package包/类
/**
* Creates a sample series.
*
* @return A sample series.
*/
private TimeSeries createDailyTimeSeries1() {
final TimeSeries series = new TimeSeries("Series 1", Day.class);
series.add(new Day(11, SerialDate.AUGUST, 2003), 11.2);
series.add(new Day(13, SerialDate.AUGUST, 2003), 13.8);
series.add(new Day(17, SerialDate.AUGUST, 2003), 14.1);
series.add(new Day(18, SerialDate.AUGUST, 2003), 12.7);
series.add(new Day(19, SerialDate.AUGUST, 2003), 16.5);
series.add(new Day(20, SerialDate.AUGUST, 2003), 15.6);
series.add(new Day(25, SerialDate.AUGUST, 2003), 19.8);
series.add(new Day(27, SerialDate.AUGUST, 2003), 10.7);
series.add(new Day(28, SerialDate.AUGUST, 2003), 14.3);
return series;
}
示例4: previous
import org.jfree.date.SerialDate; //导入依赖的package包/类
/**
* Returns the month preceding this one.
*
* @return the month preceding this one.
*/
public RegularTimePeriod previous() {
final Month result;
if (this.month != SerialDate.JANUARY) {
result = new Month(this.month - 1, this.year);
}
else {
final Year prevYear = (Year) this.year.previous();
if (prevYear != null) {
result = new Month(SerialDate.DECEMBER, prevYear);
}
else {
result = null;
}
}
return result;
}
示例5: next
import org.jfree.date.SerialDate; //导入依赖的package包/类
/**
* Returns the month following this one.
*
* @return the month following this one.
*/
public RegularTimePeriod next() {
final Month result;
if (this.month != SerialDate.DECEMBER) {
result = new Month(this.month + 1, this.year);
}
else {
final Year nextYear = (Year) this.year.next();
if (nextYear != null) {
result = new Month(SerialDate.JANUARY, nextYear);
}
else {
result = null;
}
}
return result;
}
示例6: previous
import org.jfree.date.SerialDate; //导入依赖的package包/类
/**
* Returns the day preceding this one.
*
* @return the day preceding this one.
*/
public RegularTimePeriod previous() {
final Day result;
final int serial = this.serialDate.toSerial();
if (serial > SerialDate.SERIAL_LOWER_BOUND) {
final SerialDate yesterday = SerialDate.createInstance(serial - 1);
return new Day(yesterday);
}
else {
result = null;
}
return result;
}
示例7: Day
import org.jfree.date.SerialDate; //导入依赖的package包/类
/**
* Constructs a new instance, based on a particular date/time and time zone.
*
* @param time the date/time.
* @param zone the time zone.
*/
public Day(Date time, TimeZone zone) {
if (time == null) {
throw new IllegalArgumentException("Null 'time' argument.");
}
if (zone == null) {
throw new IllegalArgumentException("Null 'zone' argument.");
}
Calendar calendar = Calendar.getInstance(zone);
calendar.setTime(time);
int d = calendar.get(Calendar.DAY_OF_MONTH);
int m = calendar.get(Calendar.MONTH) + 1;
int y = calendar.get(Calendar.YEAR);
this.serialDate = SerialDate.createInstance(d, m, y);
peg(calendar);
}
示例8: SerialDateChooserPanel
import org.jfree.date.SerialDate; //导入依赖的package包/类
/**
* Constructs a new date chooser panel.
*
* @param date the date.
* @param controlPanel the control panel.
* @param dateButtonColor the date button color.
* @param monthButtonColor the month button color.
*/
public SerialDateChooserPanel(final SerialDate date, final boolean controlPanel,
final Color dateButtonColor, final Color monthButtonColor) {
super(new BorderLayout());
this.date = date;
this.dateButtonColor = dateButtonColor;
this.monthButtonColor = monthButtonColor;
add(constructSelectionPanel(), BorderLayout.NORTH);
add(getCalendarPanel(), BorderLayout.CENTER);
if (controlPanel) {
add(constructControlPanel(), BorderLayout.SOUTH);
}
}
示例9: Day
import org.jfree.date.SerialDate; //导入依赖的package包/类
/**
* Constructs a new instance, based on a particular date/time and time zone.
*
* @param time the date/time.
* @param zone the time zone.
*/
public Day(Date time, TimeZone zone) {
// FIXME: need a Locale as well as a TimeZone
if (time == null) {
throw new IllegalArgumentException("Null 'time' argument.");
}
if (zone == null) {
throw new IllegalArgumentException("Null 'zone' argument.");
}
Calendar calendar = Calendar.getInstance(zone);
calendar.setTime(time);
int d = calendar.get(Calendar.DAY_OF_MONTH);
int m = calendar.get(Calendar.MONTH) + 1;
int y = calendar.get(Calendar.YEAR);
this.serialDate = SerialDate.createInstance(d, m, y);
peg(calendar);
}
示例10: testAddMonths
import org.jfree.date.SerialDate; //导入依赖的package包/类
/**
* Miscellaneous tests for the addMonths() method.
*/
public void testAddMonths() {
SerialDate d1 = SerialDate.createInstance(31, 5, 2004);
SerialDate d2 = SerialDate.addMonths(1, d1);
assertEquals(30, d2.getDayOfMonth());
assertEquals(6, d2.getMonth());
assertEquals(2004, d2.getYYYY());
SerialDate d3 = SerialDate.addMonths(2, d1);
assertEquals(31, d3.getDayOfMonth());
assertEquals(7, d3.getMonth());
assertEquals(2004, d3.getYYYY());
SerialDate d4 = SerialDate.addMonths(1, SerialDate.addMonths(1, d1));
assertEquals(30, d4.getDayOfMonth());
assertEquals(7, d4.getMonth());
assertEquals(2004, d4.getYYYY());
}
示例11: createDataset1
import org.jfree.date.SerialDate; //导入依赖的package包/类
/**
* Creates a sample dataset.
*
* @return Series 1.
*/
private IntervalXYDataset createDataset1() {
// create dataset 1...
TimeSeries series1 = new TimeSeries("Series 1", Day.class);
series1.add(new Day(1, SerialDate.MARCH, 2002), 12353.3);
series1.add(new Day(2, SerialDate.MARCH, 2002), 13734.4);
series1.add(new Day(3, SerialDate.MARCH, 2002), 14525.3);
series1.add(new Day(4, SerialDate.MARCH, 2002), 13984.3);
series1.add(new Day(5, SerialDate.MARCH, 2002), 12999.4);
series1.add(new Day(6, SerialDate.MARCH, 2002), 14274.3);
series1.add(new Day(7, SerialDate.MARCH, 2002), 15943.5);
series1.add(new Day(8, SerialDate.MARCH, 2002), 14845.3);
series1.add(new Day(9, SerialDate.MARCH, 2002), 14645.4);
series1.add(new Day(10, SerialDate.MARCH, 2002), 16234.6);
series1.add(new Day(11, SerialDate.MARCH, 2002), 17232.3);
series1.add(new Day(12, SerialDate.MARCH, 2002), 14232.2);
series1.add(new Day(13, SerialDate.MARCH, 2002), 13102.2);
series1.add(new Day(14, SerialDate.MARCH, 2002), 14230.2);
series1.add(new Day(15, SerialDate.MARCH, 2002), 11235.2);
TimeSeriesCollection collection = new TimeSeriesCollection(series1);
collection.setDomainIsPointsInTime(false); // this tells the time series collection that
// we intend the data to represent time periods
// NOT points in time. This is required when
// determining the min/max values in the
// dataset's domain.
return collection;
}
示例12: testEquals
import org.jfree.date.SerialDate; //导入依赖的package包/类
/**
* Tests the equals method.
*/
public void testEquals() {
final Day day1 = new Day(29, SerialDate.MARCH, 2002);
final Hour hour1 = new Hour(15, day1);
final Minute minute1 = new Minute(15, hour1);
final Second second1 = new Second(34, minute1);
final Millisecond milli1 = new Millisecond(999, second1);
final Day day2 = new Day(29, SerialDate.MARCH, 2002);
final Hour hour2 = new Hour(15, day2);
final Minute minute2 = new Minute(15, hour2);
final Second second2 = new Second(34, minute2);
final Millisecond milli2 = new Millisecond(999, second2);
assertTrue(milli1.equals(milli2));
}
示例13: testEquals
import org.jfree.date.SerialDate; //导入依赖的package包/类
/**
* Tests the equals method.
*/
public void testEquals() {
final Day day1 = new Day(29, SerialDate.MARCH, 2002);
final Hour hour1 = new Hour(15, day1);
final Minute minute1 = new Minute(15, hour1);
final Day day2 = new Day(29, SerialDate.MARCH, 2002);
final Hour hour2 = new Hour(15, day2);
final Minute minute2 = new Minute(15, hour2);
assertTrue(minute1.equals(minute2));
}
示例14: testEquals
import org.jfree.date.SerialDate; //导入依赖的package包/类
/**
* Tests the equals method.
*/
public void testEquals() {
final Day day1 = new Day(29, SerialDate.MARCH, 2002);
final Hour hour1 = new Hour(15, day1);
final Minute minute1 = new Minute(15, hour1);
final Second second1 = new Second(34, minute1);
final Day day2 = new Day(29, SerialDate.MARCH, 2002);
final Hour hour2 = new Hour(15, day2);
final Minute minute2 = new Minute(15, hour2);
final Second second2 = new Second(34, minute2);
assertTrue(second1.equals(second2));
}
示例15: testDateConstructor1
import org.jfree.date.SerialDate; //导入依赖的package包/类
/**
* In GMT, the end of 29 Feb 2004 is java.util.Date(1,078,099,199,999L). Use this to check the
* day constructor.
*/
public void testDateConstructor1() {
final TimeZone zone = TimeZone.getTimeZone("GMT");
final Day d1 = new Day(new Date(1078099199999L), zone);
final Day d2 = new Day(new Date(1078099200000L), zone);
assertEquals(SerialDate.FEBRUARY, d1.getMonth());
assertEquals(1078099199999L, d1.getLastMillisecond(zone));
assertEquals(SerialDate.MARCH, d2.getMonth());
assertEquals(1078099200000L, d2.getFirstMillisecond(zone));
}