Class TimeSpinnerChanger

All Implemented Interfaces:
TimeChanger, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener

public class TimeSpinnerChanger extends JPanel implements TimeChanger, ChangeListener
A control which allows the user to modify the hour, minute, and second displayed in an analogClock component.
Author:
Nathan Brizzee
See Also:
  • Field Details

  • Constructor Details

    • TimeSpinnerChanger

      public TimeSpinnerChanger()
      Creates a new TimeSpinnerChanger control comprised of 3 directional buttons for cycling through the Hours/Minutes/Seconds values, and a label for displaying the current values.
  • Method Details

    • setControlsEnabled

      public void setControlsEnabled(boolean enabled)
      This will enable/disable the TimeSpinner conrol
      Parameters:
      enabled - true means enable the control, false will disable the control
    • stateChanged

      public void stateChanged(ChangeEvent event)
      Called when the user changes the values in the spinners
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      event - a change event
    • setHoursVal

      public void setHoursVal(int val)
      Specified by:
      setHoursVal in interface TimeChanger
    • setMinutesVal

      public void setMinutesVal(int val)
      sets the minutes value of the analog clock and the minutes keyin
      Specified by:
      setMinutesVal in interface TimeChanger
      Parameters:
      val - - minutes value
    • setSecondsVal

      public void setSecondsVal(int val)
      sets the seconds value of the analog clock and the seconds keyin
      Specified by:
      setSecondsVal in interface TimeChanger
      Parameters:
      val - - seconds value
    • setAnalogClockRef

      public void setAnalogClockRef(JAnalogClock ac)
      Implements the TimeChanger interface. Establishes the analogClock instance which should be updated when the user changes the hour, minute, second
      Specified by:
      setAnalogClockRef in interface TimeChanger
      Parameters:
      ac - the analog clock control
    • updateTypedData

      public boolean updateTypedData()
      Updates the clock display whenever the time fields have focus
      Returns:
      boolean value specifying if the clock display has been updated