Class View.ClockPanel

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
eu.bandm.music.applications.indisp.View.ClockPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
Enclosing class:
View

class View.ClockPanel extends JComponent
GUI class which shows the selected meter as a circle of events and can mark the currently active event graphically.
  • Field Details

    • shapes

      final List<Shape> shapes
      Cache for the circles which correspond to the events.
    • nsm

      The currently selected meter.
    • radius

      int radius
      Radius of the large circle.
    • x

      int x
      Center coordinate of the large circle.
    • y

      int y
      Center coordinate of the large circle.
    • points

      int points
      Convenience cache: Number of events = number of small circles.
    • active

      int active
      Index of the currently active event. Zero-based. Can initially be -1 for "none selected".
    • clockImage

      Image clockImage
      Buffer for the clock image.
    • oldWidth

      int oldWidth
      Memorize to detect size changes of the panel.
    • oldHeight

      int oldHeight
      Memorize to detect size changes of the panel.
  • Constructor Details

    • ClockPanel

      ClockPanel()
      Only constructor.
  • Method Details

    • showPhase

      void showPhase(int i)
      Show the change of the current phase in the graphics.
      Parameters:
      i - phase to show. Must be valid 0 <= i < points.
    • calculateSizeDependent

      void calculateSizeDependent()
      Recalculate the center poistion and the size of the outer circle.
    • calculateMeterPoints

      void calculateMeterPoints()
      Recalculate the shapes for all the event-representing circles and store them to shapes.
    • drawAll

      void drawAll(Graphics2D gr)
      Draw completely: background fill, large circle, all event-representing circles, active event marked.
    • drawActive

      void drawActive(Graphics2D gr)
      Draw only the filling of the active event and delete the filling of its (static) predecessor.
    • paint

      public void paint(Graphics g)
      Paint method called by Swing runtime: Create new image if the size of the widget has changed and paint it completely. Otherwise paint and clear only the active-event indication. Anyhow transfer the image buffer to the screen.
      Overrides:
      paint in class JComponent
    • setNsm

      void setNsm(@Opt @Opt NSM nsm)
      Set a new NSM and update the graphics and caches accordingly. An NSM object always represents a valid meter specification.