src.com.toedter.calendar.demo.BirthdayEvaluator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jcalendar Show documentation
Show all versions of jcalendar Show documentation
JCalendar is a Java date chooser bean for graphically picking a
date. JCalendar is composed of several other Java beans, a
JDayChooser, a JMonthChooser and a JYearChooser. All these beans
have a locale property, provide several icons (Color 16x16, Color
32x32, Mono 16x16 and Mono 32x32) and their own locale property
editor. So they can easily be used in GUI builders. Also part of the
package is a JDateChooser, a bean composed of an IDateEditor (for
direct date editing) and a button for opening a JCalendar for
selecting the date.
The newest version!
package com.toedter.calendar.demo;
import java.awt.Color;
import java.util.Calendar;
import java.util.Date;
import com.toedter.calendar.IDateEvaluator;
public class BirthdayEvaluator implements IDateEvaluator {
private Calendar calendar = Calendar.getInstance();
private Color darkGreen = new Color(0x007F00);
private Color lightGreen = new Color(0xbbebc8);
public boolean isSpecial(Date date) {
calendar.setTime(date);
return calendar.get(Calendar.MONTH) == Calendar.SEPTEMBER
&& calendar.get(Calendar.DAY_OF_MONTH) == 21;
}
public Color getSpecialForegroundColor() {
return darkGreen;
}
public Color getSpecialBackroundColor() {
return lightGreen;
}
public String getSpecialTooltip() {
return "Kai's Birthday";
}
public boolean isInvalid(Date date) {
return false;
}
public Color getInvalidForegroundColor() {
return null;
}
public Color getInvalidBackroundColor() {
return null;
}
public String getInvalidTooltip() {
return null;
}
}