Java Reference
In-Depth Information
frame.add("Center", chart);
frame.add("South", inputPane);
frame.pack();
frame.addWindowListener(new WindowAdapter() {
public void windowClosing (WindowEvent ev) {
frame.dispose();
notifyDestroyed();
}
});
}
public void startApp() {
frame.show();
}
public void pauseApp() {
}
public void destroyApp (boolean conditional) {
frame.dispose();
}
public void actionPerformed (ActionEvent action) {
try {
if (action.getSource() == setButton) {
dayLog.set (DayLog.parseTime (timeField.getText()),
Integer.parseInt (valueField.getText()));
log.storeDayLog (dayLog);
}
else if (action.getSource() == removeButton) {
dayLog.remove (DayLog.parseTime
(timeField.getText()));
log.storeDayLog (dayLog);
}
else if (action.getSource() == dateButton) {
dayLog = log.getDayLog
(LogStorage.dateToInt
(new DateDialog (frame).getDate (new Date())));
frame.setTitle (dayLog.getTitle());
}
}
catch (Exception e) {
new ErrorDialog (e.toString()).show();
}
chart.repaint();
}
}
The source codes of the classes CalendarComponent and CalendarCanvas shown in Listings
9.3 , 9.4 and 9.5 contain helper components providing a date dialog and the correspondig helper classes.
Listing 9.3 DateDialog.java —The DateDialog Class Source Code
import java.util.*;
import java.awt.*;
 
 
Search WWH ::




Custom Search