|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Canvas
com.ibm.clock.DigitalDisplay
public class DigitalDisplay
The clock has two modes of display -- Analog and Digital. The display can be set to either analog or display. Both the display modes support a variety of customizations. The Digital Display is responsible for the Digital Rendering of the clock.
The following properties can be set on the DigitalDisplay itself.
FULL : Eg : 9:18:17 PM GMT LONG : Eg : 9:18:17 PM SHORT : Eg : 9:08 PM
true
if the clock shows time
in a 12-hour format in the digital display mode and false
if the time is shown in a 24-hour format.
Note that in 24 hour mode, AMPM strings are not displayed
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.BaselineResizeBehavior |
Field Summary | |
---|---|
static int |
FULL
Constant representing the "full" display style |
static int |
LONG
Constant representing the "long" display style. |
static int |
SHORT
Constant representing the "short" display style. |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
DigitalDisplay()
The default constructor for the class Default values are displayStyle default value FULL
foreGroundColor default value color.black
backGroundColor default value color.lightGray
numeralFont default value Dialog
displayAMPM default value true
twelveHourMode default value true
|
|
DigitalDisplay(int displayStyle,
java.awt.Color foreGroundColor,
java.awt.Color backGroundColor,
java.awt.Font numeralFont,
boolean displayAMPM,
boolean twelveHourMode)
The constructor with arguments |
Method Summary | |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Add a property change listener. |
java.awt.Color |
getBackGroundColor()
Get the current Background color. |
java.awt.Image |
getDigitalImage()
|
boolean |
getDisplayAMPM()
Get the displayAMPM mode |
int |
getDisplayStyle()
Get the current Display Style |
java.awt.Color |
getForeGroundColor()
Get the current Foreground color. |
java.awt.Font |
getNumeralFont()
Get the font for the numerals. |
java.awt.Dimension |
getPreferredSize()
Get the Preferred Size |
boolean |
getTwelveHourMode()
Get the Twelve Hour Mode |
void |
invalidate()
Overridden Invalidate for double buffering purposes. |
void |
paint(java.awt.Graphics og)
Repaints the bean |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
Remove a property change listener. |
void |
setBackGroundColor(java.awt.Color newBackGroundColor)
Set the Background color. |
void |
setDisplayAMPM(boolean newDisplayAMPM)
Set the displayAMPM mode |
void |
setDisplayStyle(int newDisplayStyle)
Set the current display style. |
void |
setForeGroundColor(java.awt.Color newForeGroundColor)
Set the Foreground color. |
void |
setNumeralFont(java.awt.Font newNumeralFont)
Set the Numeral font. |
void |
setTime(int hours,
int minutes,
int seconds)
Set the Time |
void |
setTimeZone(java.util.TimeZone tz)
Sets the current timezone |
void |
setTwelveHourMode(boolean newTwelveHourMode)
Set the Twelve Hour Mode |
void |
update(java.awt.Graphics g)
Overridden update for double buffering purposes. |
Methods inherited from class java.awt.Canvas |
---|
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int FULL
public static final int LONG
public static final int SHORT
Constructor Detail |
---|
public DigitalDisplay()
displayStyle
default value FULL
foreGroundColor
default value color.black
backGroundColor
default value color.lightGray
numeralFont
default value Dialog
displayAMPM
default value true
twelveHourMode
default value true
public DigitalDisplay(int displayStyle, java.awt.Color foreGroundColor, java.awt.Color backGroundColor, java.awt.Font numeralFont, boolean displayAMPM, boolean twelveHourMode)
displayStyle
- the displayStyle for the beanforeGroundColor
- the fore ground color for the beanbackGroundColor
- the back ground color for the beannumeralFont
- the font for displaying the clock numeralsdisplayAMPM
- to specify whether AMPM display is requiredtwelHourMode
- to specify whether the twelveHourMode display is requiredMethod Detail |
---|
public java.awt.Font getNumeralFont()
public void setNumeralFont(java.awt.Font newNumeralFont) throws java.lang.NullPointerException
tfont
- The font to be used.
java.lang.NullPointerException
- If a null argument is passed.public void setTime(int hours, int minutes, int seconds)
hours
- the current hourminutes
- the current minuteseconds
- the current secondspublic java.awt.Dimension getPreferredSize()
getPreferredSize
in class java.awt.Component
public void invalidate()
invalidate
in class java.awt.Component
public void update(java.awt.Graphics g)
update
in class java.awt.Canvas
public void paint(java.awt.Graphics og)
paint
in class java.awt.Canvas
g
- The graphics contextpublic java.awt.Image getDigitalImage()
public void setForeGroundColor(java.awt.Color newForeGroundColor)
color
- The new Foreground color.
java.lang.IllegalArgumentException
- If the argument passed is null.public void setBackGroundColor(java.awt.Color newBackGroundColor)
color
- The new Background color.
java.lang.IllegalArgumentException
- If the argument passed is null.public java.awt.Color getForeGroundColor()
public java.awt.Color getBackGroundColor()
public void setTwelveHourMode(boolean newTwelveHourMode)
newMode
- The new Mode to be setpublic boolean getTwelveHourMode()
public void setDisplayAMPM(boolean newDisplayAMPM)
newValue
- The AMPM value to be setpublic boolean getDisplayAMPM()
public void setDisplayStyle(int newDisplayStyle)
newStyle
- The new display style to be used.public int getDisplayStyle()
public void setTimeZone(java.util.TimeZone tz) throws java.lang.IllegalArgumentException
tz
- The new timezone to be set
java.lang.IllegalArgumentException
public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
addPropertyChangeListener
in class java.awt.Component
public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
removePropertyChangeListener
in class java.awt.Component
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |