public class Titled_date_selector extends JPanel implements Date_selector { PRivate Date_selector selector; private final JLabel title = new JLabel("XXXX");
/** Wrap an existing Date_selector to add a title bar showing * the displayed month and year. The title changes as the * user navigates. */
public Titled_date_selector( Date_selector selector ) { this.selector = selector;
/** This constrUCtor lets you specify the background color of the * title strip that holds the month name and year (the default * is light yellow). * * @param label_background_color the color of the title bar, or * null to make it transparent. */ public Titled_date_selector( Date_selector selector, Color label_background_color ) { this(selector); if( label_background_color == null ) title.setOpaque( false ); else title.setBackground( label_background_color ); }
public Date get_selected_date() { return selector.get_selected_date(); } public Date get_current_date() { return selector.get_current_date(); } public void roll(int f, boolean up) { selector.roll(f,up); } public int get(int f) { return selector.get(f); } }
public class Navigable_date_selector extends JPanel implements Date_selector { private Date_selector selector;
// Names of image files used for the navigator bar private static final String NEXT_YEAR = "images/10px.red.arrow.right.double.gif", NEXT_MONTH = "images/10px.red.arrow.right.gif", PREVIOUS_YEAR = "images/10px.red.arrow.left.double.gif", PREVIOUS_MONTH = "images/10px.red.arrow.left.gif";
// These constants are used to identify the button and // as the button caption in the event that the appropriate // image file can't be located