Class SpinningClock


  • public class SpinningClock
    extends java.lang.Object
    Provides a utility to display an animated clock with spinning hour and minute hands. The size of the clock as well as individual movement speed of the hands can be customized.
    • Constructor Summary

      Constructors 
      Constructor Description
      SpinningClock()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.awt.geom.Point2D[] computeHandSegment​(double angle)  
      int getClockHeight()
      Returns the clock's height
      int getClockWidth()
      Sets the clock's height
      double getHourHandSpeed()
      Returns the clock´s hour hand speed
      double getMinuteHandSpeed()
      Returns the clock´s minute hand speed
      java.awt.geom.Point2D getTopLeftCorner()
      Returns the top left corner position for this spinning clock.
      protected void paintClockFace​(java.awt.Graphics2D g2)  
      protected void paintClockHands​(java.awt.Graphics2D g2)  
      long render​(java.awt.Graphics2D g)  
      void setClockSize​(int width, int height)
      Sets the new width and height for the indicator.
      void setHourHandSpeed​(double seconds)
      Sets the clock´s hour hand speed
      void setMinuteHandSpeed​(double seconds)
      Sets the clock´s minute hand speed
      void setTopLeftCorner​(java.awt.geom.Point2D topLeftCorner)
      Sets the top left corner position for this spinning clock.
      void update​(long elapsedTime)
      Refreshes the clock hands
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SpinningClock

        public SpinningClock()
    • Method Detail

      • update

        public void update​(long elapsedTime)
        Refreshes the clock hands
        Parameters:
        elapsedTime -
      • render

        public long render​(java.awt.Graphics2D g)
      • paintClockFace

        protected void paintClockFace​(java.awt.Graphics2D g2)
      • paintClockHands

        protected void paintClockHands​(java.awt.Graphics2D g2)
      • computeHandSegment

        protected java.awt.geom.Point2D[] computeHandSegment​(double angle)
      • setClockSize

        public void setClockSize​(int width,
                                 int height)
        Sets the new width and height for the indicator. The default is 32 by 32 pixels.
        Parameters:
        width - the new width in pixel
        height - the new height in pixel
      • setMinuteHandSpeed

        public void setMinuteHandSpeed​(double seconds)
        Sets the clock´s minute hand speed
        Parameters:
        seconds -
      • getMinuteHandSpeed

        public double getMinuteHandSpeed()
        Returns the clock´s minute hand speed
        Returns:
      • setHourHandSpeed

        public void setHourHandSpeed​(double seconds)
        Sets the clock´s hour hand speed
        Parameters:
        seconds -
      • getHourHandSpeed

        public double getHourHandSpeed()
        Returns the clock´s hour hand speed
        Returns:
      • getTopLeftCorner

        public java.awt.geom.Point2D getTopLeftCorner()
        Returns the top left corner position for this spinning clock.
        Returns:
      • setTopLeftCorner

        public void setTopLeftCorner​(java.awt.geom.Point2D topLeftCorner)
        Sets the top left corner position for this spinning clock.
        Parameters:
        topLeftCorner -
      • getClockHeight

        public int getClockHeight()
        Returns the clock's height
        Returns:
      • getClockWidth

        public int getClockWidth()
        Sets the clock's height
        Returns: