|
||||||||||
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.AnalogDisplay
public class AnalogDisplay
The analog display class. The features that can be customized are :
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.BaselineResizeBehavior |
Field Summary | |
---|---|
static int |
NUMERAL_PLAIN
Plain numeral style. |
static int |
NUMERAL_ROMAN
Roman numeral style. |
static int |
TICK_STYLE_ALL
tick style all. |
static int |
TICK_STYLE_MAJOR
tick style major. |
static int |
TICK_STYLE_MINIMAL
tick style minimal. |
static int |
TICK_STYLE_NONE
tick style none. |
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 | |
---|---|
AnalogDisplay()
Default constructor for analog display. |
|
AnalogDisplay(java.awt.Color borderColor,
int borderWidth,
java.awt.Color dialColor,
java.awt.Color tickColor,
int tickStyle,
int numeralStyle,
java.awt.Color numeralColor,
java.awt.Font numeralFont,
java.awt.Color hourHandColor,
boolean hourHandVisible,
java.awt.Color minuteHandColor,
boolean minuteHandVisible,
java.awt.Color secondHandColor,
boolean secondHandVisible)
Constructor which takes all the customization features as parameter. |
Method Summary | |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Add a property change listener. |
java.awt.Color |
getBorderColor()
Get the current border color. |
int |
getBorderWidth()
Get the border width. |
java.awt.Color |
getDialColor()
Get the color of the dial. |
java.awt.Color |
getHourHandColor()
Get the current hour hand color. |
java.awt.Color |
getMinuteHandColor()
Get the current minute hand color. |
java.awt.Color |
getNumeralColor()
Get the numeral color. |
java.awt.Font |
getNumeralFont()
Get the font for the numerals. |
int |
getNumeralStyle()
Get the current numeral style. |
java.awt.Dimension |
getPreferredSize()
Get the preferred size of this component. |
java.awt.Color |
getSecondHandColor()
Get the current second hand color. |
java.awt.Color |
getTickColor()
Get the tick color. |
int |
getTickStyle()
Get the current tick style. |
void |
invalidate()
Overridden Invalidate for double buffering purposes. |
boolean |
isHourHandVisible()
Is the hour hand visible ? |
boolean |
isMinuteHandVisible()
Is the minute hand visible ? |
boolean |
isSecondHandVisible()
Is the hour hand visible ? |
void |
paint(java.awt.Graphics og)
Paint. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
Remove a property change listener. |
void |
setBorderColor(java.awt.Color newColor)
Set the border color. |
void |
setBorderWidth(int newWidth)
Set the border width. |
void |
setBounds(int x,
int y,
int width,
int height)
setBounds. overridden method. |
void |
setDialColor(java.awt.Color newColor)
Set the dial color. |
void |
setHourHandColor(java.awt.Color newHourHandColor)
Set the hour hand color. |
void |
setHourHandVisible(boolean newVisible)
Make the hour hand visible / invisible. |
void |
setMinuteHandColor(java.awt.Color newMinuteHandColor)
Set the minute hand color. |
void |
setMinuteHandVisible(boolean newVisible)
Make the minute hand visible / invisible. |
void |
setNumeralColor(java.awt.Color newColor)
Set the numeral color. |
void |
setNumeralFont(java.awt.Font newNumeralFont)
Set the numeral font. |
void |
setNumeralStyle(int newStyle)
Set the numeral style. |
void |
setSecondHandColor(java.awt.Color newSecondHandColor)
Set the second hand color. |
void |
setSecondHandVisible(boolean newVisible)
Make the second hand visible / invisible. |
void |
setTickColor(java.awt.Color newColor)
Set the color in which the ticks must be drawn. |
void |
setTickStyle(int newStyle)
Set the current tick style. |
void |
setTime(int hour,
int minute,
int second)
Set the time to be shown. |
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, 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 TICK_STYLE_ALL
setTickStyle(int)
,
getTickStyle()
,
Constant Field Valuespublic static final int TICK_STYLE_MAJOR
setTickStyle(int)
,
getTickStyle()
,
Constant Field Valuespublic static final int TICK_STYLE_MINIMAL
setTickStyle(int)
,
getTickStyle()
,
Constant Field Valuespublic static final int TICK_STYLE_NONE
setTickStyle(int)
,
getTickStyle()
,
Constant Field Valuespublic static final int NUMERAL_ROMAN
setNumeralStyle(int)
,
getNumeralStyle()
,
Constant Field Valuespublic static final int NUMERAL_PLAIN
setNumeralStyle(int)
,
getNumeralStyle()
,
Constant Field ValuesConstructor Detail |
---|
public AnalogDisplay()
Color.black
Color.white
Color.green
AnalogDisplay.TICK_STYLE_MAJOR
AnalogDisplay.NUMERAL_PLAIN
Color.black
Color.black
true
Color.black
true
Color.black
true
public AnalogDisplay(java.awt.Color borderColor, int borderWidth, java.awt.Color dialColor, java.awt.Color tickColor, int tickStyle, int numeralStyle, java.awt.Color numeralColor, java.awt.Font numeralFont, java.awt.Color hourHandColor, boolean hourHandVisible, java.awt.Color minuteHandColor, boolean minuteHandVisible, java.awt.Color secondHandColor, boolean secondHandVisible) throws java.lang.IllegalArgumentException
borderColor
- The border color.borderWidth
- The width of the border.dialColor
- The dial color.tickColor
- The tick color.tickStyle
- The tick style.numeralStyle
- The numeral style.numeralColor
- The numeral color.numeralFont
- The numeral font.hourHandColor
- The hour hand color.hourHandVisibile
- The hour hand visibility.minuteHandColor
- The minute hand color.minuteHandVisibile
- The minute hand visibility.secondHandColor
- The second hand color.secondHandVisible
- The second hand visibility.
java.lang.IllegalArgumentException
- if any of arguments have an illegal value.Method Detail |
---|
public java.awt.Font getNumeralFont()
public void setNumeralFont(java.awt.Font newNumeralFont) throws java.lang.IllegalArgumentException
font
- The font to be used.
java.lang.IllegalArgumentException
- If a null argument is passed.public java.awt.Color getHourHandColor()
public void setHourHandColor(java.awt.Color newHourHandColor) throws java.lang.IllegalArgumentException
color
- The new hour hand color.
java.lang.IllegalArgumentException
- If the argument passed is null.public java.awt.Color getMinuteHandColor()
public void setMinuteHandColor(java.awt.Color newMinuteHandColor) throws java.lang.IllegalArgumentException
color
- The new minute hand color.
java.lang.IllegalArgumentException
- If the argument passed is null.public java.awt.Color getSecondHandColor()
public void setSecondHandColor(java.awt.Color newSecondHandColor) throws java.lang.IllegalArgumentException
color
- The new second hand color.
java.lang.IllegalArgumentException
- If the argument passed is null.public boolean isHourHandVisible()
public void setHourHandVisible(boolean newVisible)
true
- => the hour hand will be rendered,
false => the hour hand will not be rendered.public boolean isMinuteHandVisible()
public void setMinuteHandVisible(boolean newVisible)
true
- => the minute hand will be rendered,
false => the minute hand will not be rendered.public boolean isSecondHandVisible()
public void setSecondHandVisible(boolean newVisible)
true
- => the second hand will be rendered,
false => the second hand will not be rendered.public int getTickStyle()
setTickStyle(int)
public void setTickStyle(int newStyle) throws java.lang.IllegalArgumentException
style
- The tick style to be used.
java.lang.IllegalArgumentException
- If the tick style is not one of the
above mentioned.public int getNumeralStyle()
setNumeralStyle(int)
public void setNumeralStyle(int newStyle)
style
- The style to be set.
java.lang.IllegalArgumentException
- If the specified numeral style is not
one of those mentioned above.public void setBounds(int x, int y, int width, int height)
setBounds
in class java.awt.Component
public java.awt.Color getNumeralColor()
public void setNumeralColor(java.awt.Color newColor) throws java.lang.IllegalArgumentException
color
- The new numeral color.
java.lang.IllegalArgumentException
- If the argument passed is null.public java.awt.Color getTickColor()
public void setTickColor(java.awt.Color newColor) throws java.lang.IllegalArgumentException
color
- The tick color. This cannot be null.
java.lang.IllegalArgumentException
- If the specified color is null.public java.awt.Color getBorderColor()
public void setBorderColor(java.awt.Color newColor)
color
- The new color.
java.lang.IllegalArgumentException
- if the specified argument is null.public java.awt.Color getDialColor()
public void setDialColor(java.awt.Color newColor) throws java.lang.IllegalArgumentException
color
- The new dial color.
java.lang.IllegalArgumentException
- If the argument passed is null.public int getBorderWidth()
public void setBorderWidth(int newWidth)
width
- The new border width.
java.lang.IllegalArgumentException
- If the width specified is not proper.isProperBorderWidth(int)
public void setTime(int hour, int minute, int second)
hour
- The hour of the day.minute
- The minute of the hour.second
- The second of the minute.
throws IllegalArgumentExceptionpublic 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
og
- The graphics context.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 |