Table of Contents |
![]() |
Introduction |
The LEDClock component is a Java bean that can be used to display a digital clock in various applications and applets. The developer can completely customize the look and feel of the clock.The developer can set an alarm and time zone adjustment. The clock digit's are resizable .
This document describes the LEDClock bean. It is intended for "application assembler" who will be able to use the component in a visual builder as well as for manual programming. It is assumed that the users are already familiar with JavaBeans. If terms like property, event, method, introspection, or serialization is unfamiliar, they may want to refer to the JavaBeans documentation or take the JavaBeans tutorial.
© International Business Machines Corporation 1998. All rights reserved.
![]() |
Class Description |
Class Name: LEDClock
Implements: Serializable
Overview:
This is a visual bean.
The LEDClock component is a Java bean that can be used to display a digital clock in
various applications and applets. The developer can completely customize the look and feel
of the clock. The developer can set an alarm and time zone adjustment. The clock digits
are resizable.
LEDClock d = new LEDClock(); add(d);
Introspection:
A SimpleBeanInfo class, LEDClockBeanInfo, explicitly provides information for properties, events, and methods.
Wiring:
- Install LEDClock in the IDE palette.
- Choose the component from the palette and drop it onto the visual portion of your
free-form surface.
- Customize the timeadjustment , mode24hours , showSeconds properties with the help
of the Property sheet.
- If you want to use alarm you should set the alarmSet property to true and customize
alarmtime. The setting of these properties will start alarm.
- Wire the AlarmEvent event to the method/methods of other beans which should be invoked
when the time comes.
boolean | showSeconds | [bound] |
show / hide seconds flag | (r/w) |
boolean | mode24hours | [bound] |
show hour value more than 12 or not | (r/w) |
boolean | alarmSet | [bound] |
alarm on /off flag | (r/w) |
int | seconds | [bound , hidden] |
displayed seconds | (r/w) |
int | minutes | [bound, hidden] |
displayed minutes | (r/w) |
int | hours | [bound, hidden] |
displayed hours | (r/w) |
int | timeadjustment | [bound] |
system time adjustment in seconds | (r/w) |
int | alarmtime | [bound] |
alarm signal time | (r/w) |
Properties
showSeconds [bound] - show / hide seconds flag
Type: boolean
mode24hours [bound] - show hour value more than 12 or not
Type: boolean
alarmSet [bound] - alarm on/off flag
Type: boolean
seconds [bound , hidden] - displayed seconds
Type: int
Get: getSeconds()
Set: setSeconds( int )
minutes [bound , hidden] - displayed minutes
Get: getMinutes()
Set: setMinutes( int )
hours [bound , hidden] - displayed hours
Type: int
Get: getHours()
Set: setHours( int )
timeadjustment [bound] - system time adjustment in seconds
Type: int
Get: getTimeadjustment()
Set: setTimeadjustment( int )
alarmtime [bound] - alarm signal time
Type: int
Method Summary
instantiation | LEDClock() |
accessing properties | isShowSeconds() setShowSeconds( boolean ) isMode24hours() setMode24hours( boolean ) isAlarmSet() setAlarmSet( boolean ) getSeconds() setSeconds( int ) getMinutes() setMinutes( int ) getHours() setHours( int ) getTimeadjustment() setTimeadjustment( int ) getAlarmtime() setAlarmtime( int ) |
paint/update/getPreferredSize methods | paint(
Graphics ) update( Graphics ) getPreferredSize( ) |
adding/removing listeners | addAlarmEventListener(
AlarmEventListener ) removeAlarmEventListener( AlarmEventListener ) addPropertyChangeListener(PropertyChangeListener) removePropertyChangeListener(PropertyChangeListener) |
Methods
public LEDClock()
Constructor by default. Creates a LEDClock synchronized with system clock for GMT 0 time zone.
public void paint(Graphics gr)
Paints the component.
Parameters:
gr - java.awt.Graphics
Overrides:
paint in class Component
public void update(Graphics gr)
Updates the component.
Parameters:
gr - java.awt.Graphics
Overrides:
update in class Component
public Dimension getPreferredSize()
Returns component preferred size.
Parameters:
Overrides:
getPreferredSize in class Component
public void addAlarmEventListener(AlarmEventListener l)
Adds a specified alarm listener to receive alarm events from this LEDClock.
Parameters:
l - an alarm listener
public void removeAlarmEventListener(AlarmEventListener l)
Removes a specified alarm listener, so it no longer receives alarm events from this LEDClock.
Parameters:
l - an alarm listener
public void addPropertyChangeListener(PropertyChangeListener l)
Registers a new listener of the PropertyChange event.
Parameters:
l - reference to an object to be registered as a listener of the PropertyChange event
public void removePropertyChangeListener(PropertyChangeListener l)
Removes a listener of the PropertyChange event.
Parameters:
l - reference to an object to be removed as a listener of the PropertyChange event
public boolean isShowSeconds()
Returns a show seconds flag
Returns :
Show seconds flag
public void setShowSeconds( boolean b )
Sets new value of a show seconds flag
Parameters :
b - new value of a show seconds flag
public boolean isMode24hours()
Returns a mode 24 hours flag
Returns :
mode 24 hours flag
public void setMode24hours( boolean b )
Sets new value of a mode 24 hours flag
Parameters :
b - new value of a mode 24 hours flag
public boolean isAlarmSet()
Returns a alarm set flag
Returns :
alarm set flag
public void setAlarmSet( boolean b )
Sets new value of a alarm set flag
Parameters :
b - new value of a alarm set flag
public int getSeconds()
Returns displayed seconds
Returns :
displayed seconds
public void setSeconds( int i )
Sets new value of displayed seconds
Parameters :
i - new value of displayed seconds
public int getMinutes()
Returns displayed minutes
Returns :
displayed minutes
public void setMinutes( int i )
Sets new value of displayed minutes
Parameters :
i - new value of displayed minutes
public int getHours()
Returns displayed hours
Returns :
displayed hours
public void setHours( int i )
Sets new value of displayed hours
Parameters :
i - new value of displayed hours
public int getTimeadjustment()
Returns time adjustment by system clock ( in seconds )
Returns :
time adjustment by system clock ( in seconds )
public void setTimeadjustment( int i )
Sets new value of time adjustment by system clock ( in seconds )
Parameters :
i - new value of time adjustment by system clock ( in seconds )
public int getAlarmtime()
Returns alarm signal time ( in seconds )
Returns :
alarm signal time ( in seconds )
public void setAlarmtime( int i )
Sets new value of alarm signal time ( in seconds )
Parameters :
i - new value of alarm signal time ( in seconds )
As Source | ||
EventListener Interfaces: | PropertyChangeListener AlarmEventListener |
|
Event Objects: | PropertyChangeEvent AlarmEvent |
|
As Listener | ||
does not act as a listener | ||
The LEDClock bean fires an event that is a post-notification of a property change (bound). Listeners register for the post-notification of bound properties with addPropertyChangeListener().
The LEDClock bean fires an AlarmEvent if the displayed time is equal to alarm time and alarm is on. Listeners register for the post-notification of alarm with addAlarmEventListener().
![]() |
Component Reference Pages |
Click here to see the related documentation.