01: import java.text.DateFormat;
02: import java.util.Date;
03: 
04: /**
05:    This bean formats the time of day from a given date.
06: */
07: public class TimeFormatterBean
08: {
09:    /**
10:       Initializes the formatter.
11:    */
12:    public TimeFormatterBean()
13:    {
14:       timeFormatter = DateFormat.getTimeInstance();
15:    }
16: 
17:    /**
18:       Write-only date property. 
19:       @param aDate the date to be formatted.
20:    */
21:    public void setDate(Date aDate)
22:    {
23:       theDate = aDate;
24:    }
25: 
26:    /**
27:       Read-only time property.
28:       @return the formatted time
29:    */
30:    public String getTime()
31:    {
32:       String timeString = timeFormatter.format(theDate);
33:       return timeString;
34:    }
35: 
36:    private DateFormat timeFormatter;
37:    private Date theDate;
38: }