Example #1
0
    private String onMouseClicked(MouseEvent e, Bundle data) {

      // read data from bundle
      // Set<SoundCircle> scset = (Set<SoundCircle>) data.getObject(DataKey.SoundCircleSet.name());
      int timeValue = (int) data.getObject(DataKey.TimeValue.name());
      Component c = (Component) data.getObject(DataKey.ComponentToRepaint.name());

      // if(null == e || null == scset || null == data.getObject(DataKey.TimeValue.name()))
      // return null;

      // find a SC which contains the mouse at current time
      SoundCircle sc = null;
      for (SoundCircle s : soundCircleTable.values()) {
        // if a SC contains the mouse, stay in the current state.
        if (s.contains(e.getPoint(), timeValue)) {
          sc = s;
          break;
        }
      }

      if (null == sc) return getName();

      // choose the SC
      selectedSC = sc;

      c.repaint();
      return SCchoosen.class.getName();
    }
Example #2
0
    private String onMouseClicked(MouseEvent e, Bundle data) {
      int timeValue = (int) data.getObject(DataKey.TimeValue.name());
      Component c = (Component) data.getObject(DataKey.ComponentToRepaint.name());

      // find a SC which contains the mouse at current time
      for (SoundCircle sc : soundCircleTable.values()) {
        // if a SC contains the mouse, do nothing and stay in the current state.
        if (sc.contains(e.getPoint(), timeValue)) return getName();
      }

      selectedSC = null;
      c.repaint();
      return PaintingSC.class.getName();
    }