Class Clock

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--Clock
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

class Clock
extends Canvas

See Also:
Serialized Form

Inner classes inherited from class java.awt.Canvas
Canvas.AccessibleAWTCanvas
 
Inner classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.AWTTreeLock
 
Field Summary
static int ALASKA
           
static int ATLANTIC
           
static int BIG_EASTERN
           
static int CENTRAL
           
static int EASTERN
           
static int HAWAII
           
static int MOUNTAIN
           
static int NEWFOUNDLAND
           
static int NON_3D
           
static int PACIFIC
           
 
Fields inherited from class java.awt.Component
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Clock(int diameter)
          Constructor for objects of class Clock
Clock(int viewPosition, int x, int y, Project2 project2)
          Alternate Constructor for objects of Class Clock
 
Method Summary
 int getViewPosition()
          the accessor for the viewPosition variable of the clock
 void paint(Graphics g)
          paint - draws the clock based on the hour, minute, and the position variables
 void setTime(int hours, int minutes)
          setTime - sets the variables of the clock and repaints to display the new time
 void setViewPosition(int viewPosition)
          the mutator method for the viewPosition variable sets each of the other 3D position variables accordingly
 
Methods inherited from class java.awt.Canvas
, addNotify, constructComponentName, getAccessibleContext, postsOldMouseEvents
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkGD, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createChildHierarchyEvents, createHierarchyEvents, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventEnabled, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, layout, lightweightPaint, lightweightPrint, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, numListening, paintAll, paintHeavyweightComponents, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, printHeavyweightComponents, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ALASKA

public static final int ALASKA

ATLANTIC

public static final int ATLANTIC

BIG_EASTERN

public static final int BIG_EASTERN

CENTRAL

public static final int CENTRAL

EASTERN

public static final int EASTERN

HAWAII

public static final int HAWAII

MOUNTAIN

public static final int MOUNTAIN

NEWFOUNDLAND

public static final int NEWFOUNDLAND

NON_3D

public static final int NON_3D

PACIFIC

public static final int PACIFIC
Constructor Detail

Clock

public Clock(int diameter)
Constructor for objects of class Clock
Parameters:
diameter - - the diameter of the clock gives a simple one view clock that fits in a square of side length given by diameter

Clock

public Clock(int viewPosition,
             int x,
             int y,
             Project2 project2)
Alternate Constructor for objects of Class Clock
Parameters:
viewPosition - -one of eight preset three dimensional view Positions
x - - the x coordinate and
y - - the y coordinate point relative to the clock's bounds to be treated as the upper left corner when calling the Project2 paintBackground method
project2 - - the containing Project2 object whose method paintBackground should be called
Method Detail

getViewPosition

public int getViewPosition()
the accessor for the viewPosition variable of the clock

paint

public void paint(Graphics g)
paint - draws the clock based on the hour, minute, and the position variables
Overrides:
paint in class Canvas
Parameters:
g - - the Graphics object to draw with

setTime

public void setTime(int hours,
                    int minutes)
setTime - sets the variables of the clock and repaints to display the new time
Parameters:
hours - - the hours to set the time to
minutes - - the minutes to set the time to

setViewPosition

public void setViewPosition(int viewPosition)
the mutator method for the viewPosition variable sets each of the other 3D position variables accordingly
Parameters:
viewPosition - - on of the preset viewPosition constants of the class Clock repaints when finished


Generated by BlueJ