JComponentPack 1.5.0

com.zfqjava.swing
Class JClock

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.zfqjava.swing.JClock
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class JClock
extends JComponent
implements Accessible

JClock provides a clock component.

See Also:
Serialized Form

Nested Class Summary
protected  class JClock.AccessibleJClock
          This class implements accessibility support for the JClock class.
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
JClock()
          Constructs a JClock.
 
Method Summary
 void addChangeListener(ChangeListener l)
          Adds a ChangeListener to the JCalendar component.
protected  void fireStateChanged()
          Notifies all listeners that have registered interest for notification on this event type.
 AccessibleContext getAccessibleContext()
          Gets the AccessibleContext associated with this JClock.
 Calendar getCalendar()
          Returns the calendar object used by this JClock.
 ChangeListener[] getChangeListeners()
          Returns an array of all the ChangeListeners added to this JCalendar with addChangeListener().
 int getHours()
          Returns the hour represented by this JClock object.
 int getMinutes()
          Returns the number of minutes past the hour represented by this JClock.
 int getSeconds()
          Returns the number of seconds past the minute represented by this JClock.
 Date getTime()
          Gets this Calendar's current time.
 ClockUI getUI()
          Returns the look and feel (L&F) object that renders this component.
 String getUIClassID()
          Returns a string that specifies the name of the L&F class that renders this component.
protected  String paramString()
          Returns a string representation of this JClock.
 void removeChangeListener(ChangeListener l)
          Removes a ChangeListener from the JCalendar component.
 void setCalendar(Calendar cal)
          Sets the calendar object used by this JClock.
 void setHours(int hours)
          Sets the hour of this Date object to the specified value.
 void setMinutes(int minutes)
          Sets the minutes of this JClock object to the specified value.
 void setSeconds(int seconds)
          Sets the seconds of this JClock to the specified value.
 void setTime(Date time)
          Sets this Calendar's current time with the given Date.
 void setUI(ClockUI ui)
          Sets the look and feel (L&F) object that renders this component.
 void updateUI()
          Resets the UI property with a value from the current look and feel.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JClock

public JClock()
Constructs a JClock.

Method Detail

updateUI

public void updateUI()
Resets the UI property with a value from the current look and feel.

Overrides:
updateUI in class JComponent
See Also:
JComponent.updateUI()

getUI

public ClockUI getUI()
Returns the look and feel (L&F) object that renders this component.

Returns:
the ClockUI object that renders this component

setUI

public void setUI(ClockUI ui)
Sets the look and feel (L&F) object that renders this component.

Parameters:
ui - the ClockUI L&F object
See Also:
UIDefaults.getUI(javax.swing.JComponent)

getUIClassID

public String getUIClassID()
Returns a string that specifies the name of the L&F class that renders this component.

Overrides:
getUIClassID in class JComponent
Returns:
"ClockUI"
See Also:
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)

setCalendar

public void setCalendar(Calendar cal)
Sets the calendar object used by this JClock.

Parameters:
cal - the calendar object used by this JClock
See Also:
getCalendar()

getCalendar

public Calendar getCalendar()
Returns the calendar object used by this JClock.

Returns:
the calendar object used by this JClock
See Also:
setCalendar(java.util.Calendar)

setTime

public void setTime(Date time)
Sets this Calendar's current time with the given Date.

Note: Calling setTime() with Date(Long.MAX_VALUE) or Date(Long.MIN_VALUE) may yield incorrect field values from get().

Parameters:
time - the given Date.
See Also:
getTime()

getTime

public Date getTime()
Gets this Calendar's current time.

Returns:
the current time.
See Also:
setTime(java.util.Date)

getHours

public int getHours()
Returns the hour represented by this JClock object.

Returns:
the hour represented by this JClock.
See Also:
setHours(int)

setHours

public void setHours(int hours)
Sets the hour of this Date object to the specified value.

Parameters:
hours - the hour value.

getMinutes

public int getMinutes()
Returns the number of minutes past the hour represented by this JClock.

Returns:
the number of minutes past the hour represented by this JClock.
See Also:
setMinutes(int)

setMinutes

public void setMinutes(int minutes)
Sets the minutes of this JClock object to the specified value.

Parameters:
minutes - the value of the minutes.
See Also:
getMinutes()

getSeconds

public int getSeconds()
Returns the number of seconds past the minute represented by this JClock.

Returns:
the number of seconds past the minute represented by this JClock.
See Also:
setSeconds(int)

setSeconds

public void setSeconds(int seconds)
Sets the seconds of this JClock to the specified value.

Parameters:
seconds - the seconds value.
See Also:
getSeconds()

addChangeListener

public void addChangeListener(ChangeListener l)
Adds a ChangeListener to the JCalendar component.

Note: Fires ChangeEvent when month or year or date selection has changed. If only interesting date changed event, attach a PropertyChangeListener and listen date property, about month or year you can use the same style.

Parameters:
l - the listener to add

removeChangeListener

public void removeChangeListener(ChangeListener l)
Removes a ChangeListener from the JCalendar component.

Note: Fires ChangeEvent when month or year or date selection has changed. If only interesting date changed event, attach a PropertyChangeListener and listen date property, about month or year you can use the same style.

Parameters:
l - the listener to remove

getChangeListeners

public ChangeListener[] getChangeListeners()
Returns an array of all the ChangeListeners added to this JCalendar with addChangeListener().

Note: Fires ChangeEvent when month or year or date selection has changed. If only interesting date changed event, attach a PropertyChangeListener and listen date property, about month or year you can use the same style.

Returns:
all of the ChangeListeners added or an empty array if no listeners have been added

fireStateChanged

protected void fireStateChanged()
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created.

See Also:
EventListenerList

paramString

protected String paramString()
Returns a string representation of this JClock. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Overrides:
paramString in class JComponent
Returns:
a string representation of this JClock.

getAccessibleContext

public AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this JClock. For JClocks, the AccessibleContext takes the form of an AccessibleJClock. A new AccessibleJClock instance is created if necessary.

Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in class JComponent
Returns:
an AccessibleJClock that serves as the AccessibleContext of this JClock

JComponentPack 1.5.0

Send your Feedback
JComponentPack 1.5.0
Copyright © 2001-2007 Extreme Component, Inc. All rights reserved.