package caltool.view_ui; import java.awt.*; import java.awt.event.*; import javax.swing.*; /**** * * Class DateNumberLabel extends JLabel. It is used in monthly agendas and * weekly list-style views. The typeface is bold black, with one space of * padding on each side of the text. * */ public class DateNumberLabel extends JLabel { /** * Construct this with the given numeric date. */ public DateNumberLabel(int dateNumber) { super(" " + Integer.toString(dateNumber) + " "); this.dateNumber = dateNumber; setFont(getFont().deriveFont(Font.BOLD)); setForeground(Color.black); setBackground(Color.white); setOpaque(true); } /** * Return this' date number. This method is needed because the text of the * label has a space padded at the beginning and end, which renders the * label text not readily parseable to an int. I.e., alas, * Integer.parseInt(label.getText())) fails if the label text contains a * leading space character. */ public int getNumber() { return dateNumber; } /** The numeric date number. */ protected int dateNumber; }