Exemple #1
0
 public void mouseEntered(MouseEvent e) {
   super.mouseEntered(e);
   if (slider.isEnabled()) {
     isRollover = thumbRect.contains(e.getPoint());
     slider.repaint();
   }
 }
Exemple #2
0
 public void mouseExited(MouseEvent e) {
   super.mouseExited(e);
   if (slider.isEnabled()) {
     isRollover = false;
     slider.repaint();
   }
 }
 @Override
 public void mouseReleased(MouseEvent e) {
   lowerDragging = false;
   upperDragging = false;
   middleDragging = false;
   slider.setValueIsAdjusting(false);
   super.mouseReleased(e);
 }
Exemple #4
0
 public void mouseMoved(MouseEvent e) {
   super.mouseMoved(e);
   if (slider.isEnabled()) {
     boolean rollover = thumbRect.contains(e.getPoint());
     if (rollover != isRollover) {
       isRollover = rollover;
       slider.repaint();
     }
   }
 }
    /**
     * Overridden to determine when a drag event ends. This method will also determine when the tool
     * tip Dialog should stop showing.
     *
     * @see TrackListener#mouseReleased(MouseEvent)
     */
    public void mouseReleased(MouseEvent event) {
      super.mouseReleased(event);
      if (isDragging && slider instanceof OneKnobSlider) {
        isDragging = false;
        ((OneKnobSlider) slider).onMouseReleased();
      }

      /*
             if (showTipLabel && tipDialog != null)
      {
      	if (tipDialog.isVisible()) tipDialog.setVisible(false);
      }
             slider.repaint();
       */
    }
    /**
     * Overridden function of the slider track listener method mouseDragged as this method relied on
     * the private member of isDragged in sliderUI. Has to override this as we could not set the
     * isDragging variable in the basicSliderUI. :-( *Why private??!*
     *
     * @see TrackListener#mouseDragged(MouseEvent)
     */
    public void mouseDragged(MouseEvent event) {
      super.mouseDragged(event);
      isDragging = true;
      /*
      if (showTipLabel && tipDialog != null && endLabel != null &&
      	slider.isVisible())
      {
      	Point location = slider.getLocationOnScreen();
      	location.x += thumbRect.x+TOOLTIP_OFFSET;
      	location.y += thumbRect.y;

      	tipDialog.setTipString(
      			endLabel+" : " + slider.getValue());
      	tipDialog.setLocation(location);
      	tipDialog.setVisible(true);
      }
       */
    }
    /**
     * Overloaded the <code>mousePressed</code> event in the TrackListener.
     *
     * @see TrackListener#mousePressed(MouseEvent)
     */
    public void mousePressed(MouseEvent event) {
      // Check to see that the slider is enabled before proceeeding.
      if (!slider.isEnabled()) return;
      isDragging = true;
      // Get mouse x, y positions.
      currentMouseX = event.getX();
      currentMouseY = event.getY();

      // If the slider has {@link #setFocusEnabled} true then
      // request focus.
      if (slider.isRequestFocusEnabled()) slider.requestFocus();

      // Check to see if the thumb was clicked.
      if (thumbRect.contains(currentMouseX, currentMouseY)) super.mousePressed(event);

      if (showArrows) {
        if (minArrowRect.contains(currentMouseX, currentMouseY)) {
          int value = slider.getValue();
          isDragging = false;
          if (value > slider.getMinimum()) {
            // scrollTimer.stop();
            scrollListener.setScrollByBlock(false);
            scrollListener.setDirection(OneKnobSliderUI.NEGATIVE_SCROLL);
            // scrollTimer.start();
            slider.repaint();
          }
          return;
        }
        if (maxArrowRect.contains(currentMouseX, currentMouseY)) {
          int value = slider.getValue();
          isDragging = false;
          if (value < slider.getMaximum()) {
            // scrollTimer.stop();
            scrollListener.setScrollByBlock(false);
            scrollListener.setDirection(OneKnobSliderUI.POSITIVE_SCROLL);
            // scrollTimer.start();
            slider.repaint();
          }
          return;
        }
      }

      slider.repaint();
    }
 public void mouseReleased(MouseEvent e) {
   super.mouseReleased(e);
   Rectangle r = getTrackBounds();
   scrollbar.repaint(r.x, r.y, r.width, r.height);
 }
 public void mouseExited(MouseEvent e) {
   super.mouseExited(e);
   isRollover = false;
   Rectangle r = getTrackBounds();
   scrollbar.repaint(r.x, r.y, r.width, r.height);
 }