Esempio n. 1
0
 /** Event handler for {@link AdjustmentEvent}s */
 @Override
 public void adjustmentValueChanged(AdjustmentEvent e) {
   if (!enabledMap.get(e.getAdjustable())) return;
   for (Adjustable a : synchronizedAdjustables) {
     if (a != e.getAdjustable() && isParticipatingInSynchronizedScrolling(a)) {
       a.setValue(e.getValue());
     }
   }
 }
Esempio n. 2
0
 public void adjustmentValueChanged(AdjustmentEvent e) {
   if (e.getValueIsAdjusting() || getRowCount() == 0) {
     return;
   }
   if (jsb.getMaximum() != 0 && e.getValue() > 0) {
     if ((jsb.getMaximum() - jsb.getVisibleAmount()) <= e.getValue()) {
       control.fetchNextRecords();
     }
   }
 }
Esempio n. 3
0
 /*
  * Method of the AdjustmenListener interface.
  */
 @Override
 public void adjustmentValueChanged(final AdjustmentEvent e) {
   if (bar != null && e.getSource() == bar) {
     final AdjustmentEvent myE =
         new AdjustmentEvent(
             this, e.getID(), e.getAdjustmentType(), e.getValue(), e.getValueIsAdjusting());
     final AdjustmentListener listener = adjustmentListener;
     if (listener != null) {
       listener.adjustmentValueChanged(myE);
     }
   }
 }
Esempio n. 4
0
 public void adjustmentValueChanged(AdjustmentEvent event) {
   if (event.getSource() == SBrecpos) {
     if (event.getAdjustmentType() == AdjustmentEvent.TRACK) {
       goTo(SBrecpos.getValue());
       return;
     }
     if (event.getID() == AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED) {
       SBrecpos.setEnabled(false);
       goTo(SBrecpos.getValue());
       SBrecpos.setEnabled(true);
     }
   }
 }
Esempio n. 5
0
  /* (non-Javadoc)
   * @see java.awt.event.AdjustmentListener#adjustmentValueChanged(java.awt.event.AdjustmentEvent)
   *
   * Thread safety: This method is thread safe
   */
  @Override
  public void adjustmentValueChanged(AdjustmentEvent e) {

    if (!this.ignoreAdjustmentChange) {
      this.fastTextView.setParagraph(e.getValue());
    }
  }
 public void adjustmentValueChanged(AdjustmentEvent e) {
   Object ob = e.getSource();
   int p, q, r;
   p = s1.getValue();
   q = s2.getValue();
   r = s3.getValue();
   Color c = new Color(p, q, r);
   p1.setBackground(c);
 }
Esempio n. 7
0
    // This method is called whenever the value of a scrollbar is changed,
    // either by the user or programmatically.
    public void adjustmentValueChanged(AdjustmentEvent evt) {
      Adjustable source = evt.getAdjustable();

      // getValueIsAdjusting() returns true if the user is currently
      // dragging the scrollbar's knob and has not picked a final value
      if (evt.getValueIsAdjusting()) {
        // The user is dragging the knob
        return;
      }

      // Determine which scrollbar fired the event
      int orient = source.getOrientation();
      if (orient == Adjustable.HORIZONTAL) {
        // Event from horizontal scrollbar
      } else {
        // Event from vertical scrollbar
      }

      // Determine the type of event
      int type = evt.getAdjustmentType();
      switch (type) {
        case AdjustmentEvent.UNIT_INCREMENT:
          // Scrollbar was increased by one unit
          break;
        case AdjustmentEvent.UNIT_DECREMENT:
          // Scrollbar was decreased by one unit
          break;
        case AdjustmentEvent.BLOCK_INCREMENT:
          // Scrollbar was increased by one block
          break;
        case AdjustmentEvent.BLOCK_DECREMENT:
          // Scrollbar was decreased by one block
          break;
        case AdjustmentEvent.TRACK:
          // The knob on the scrollbar was dragged
          break;
      }

      // Get current value
      int value = evt.getValue();

      headerPanelLeft.setAdjustment(value);
      headerPanelRight.setAdjustment(value);
    }
 /** Capture des évènements des scrollbars */
 public void adjustmentValueChanged(AdjustmentEvent e) {
   if (e.getSource().equals(sb_victoires)) {
     int valeur = sb_victoires.getValue();
     lbl_victoires.setText("Nombre De Victoires: " + valeur);
     nb_victoires = valeur;
   } else {
     int valeur = sb_fps.getValue();
     lbl_fps.setText("FPS: " + valeur);
     fps = valeur;
   }
 } // adjustmentValueChanged()
Esempio n. 9
0
    public void adjustmentValueChanged(AdjustmentEvent e) {

      // doe niets als er gedragged wordt

      if (DEBUG) {
        System.out.println("adjustmentValueChanged()");
        System.out.println("dragging: " + _scroller.getValueIsAdjusting());
      }

      if (!_scroller.getValueIsAdjusting()) scrollViewTo(e.getValue());
    }
Esempio n. 10
0
 public synchronized void adjustmentValueChanged(AdjustmentEvent e) {
   Object source = e.getSource();
   for (int i = 0; i < slider.size(); i++) {
     if (source == slider.elementAt(i)) {
       Scrollbar sb = (Scrollbar) source;
       TextField tf = (TextField) numberField.elementAt(sliderIndexes[i]);
       int digits = sliderScales[i] == 1.0 ? 0 : 2;
       tf.setText("" + IJ.d2s(sb.getValue() / sliderScales[i], digits));
     }
   }
 }
Esempio n. 11
0
    public synchronized void adjustmentValueChanged(AdjustmentEvent e) {

      if (!checkImage()) {
        IJ.beep();
        IJ.showStatus("No Image");
        return;
      }

      if (e.getSource() == minSlider) {
        adjustMinHue((int) minSlider.getValue());
      } else if (e.getSource() == maxSlider) {
        adjustMaxHue((int) maxSlider.getValue());
      } else if (e.getSource() == minSlider2) {
        adjustMinSat((int) minSlider2.getValue());
      } else if (e.getSource() == maxSlider2) {
        adjustMaxSat((int) maxSlider2.getValue());
      } else if (e.getSource() == minSlider3) {
        adjustMinBri((int) minSlider3.getValue());
      } else if (e.getSource() == maxSlider3) {
        adjustMaxBri((int) maxSlider3.getValue());
      }
      originalB.setEnabled(true);
      updateLabels();
      updatePlot();
      notify();
    }
Esempio n. 12
0
 public synchronized void adjustmentValueChanged(AdjustmentEvent e) {
   if (!running2 || imp.isHyperStack()) {
     if (e.getSource() == cSelector) {
       c = cSelector.getValue();
       if (c == imp.getChannel() && e.getAdjustmentType() == AdjustmentEvent.TRACK) return;
     } else if (e.getSource() == zSelector) {
       z = zSelector.getValue();
       int slice = hyperStack ? imp.getSlice() : imp.getCurrentSlice();
       if (z == slice && e.getAdjustmentType() == AdjustmentEvent.TRACK) return;
     } else if (e.getSource() == tSelector) {
       t = tSelector.getValue();
       if (t == imp.getFrame() && e.getAdjustmentType() == AdjustmentEvent.TRACK) return;
     }
     updatePosition();
     notify();
   }
   if (!running) syncWindows(e.getSource());
 }
    public void adjustmentValueChanged(AdjustmentEvent evt) {
      int value = evt.getValue();
      int extent = getVerticalScrollBar().getModel().getExtent();
      int maximum = getVerticalScrollBar().getMaximum();

      boolean jump = false;
      // detect jumps from updated posts
      if (value > lastValue && Math.abs(lastValue - value) > SCROLL_JUMP_BOUND) jump = true;

      lastValue = value;
      if (jump) {
        // do not allow jumps (jump back)
        getVerticalScrollBar().setValue(getVerticalScrollBar().getMinimum());
        return;
      }

      if (value + extent == maximum) {
        String query = SearchTab.inputPane.inputArea.getText();

        try {
          if (Search.currentSearchType.equals(Search.SearchType.LOCAL_INDEX)) {
            localSearch.search(query, Posts.maxPostCount[0]);
          } else if (Search.currentSearchType.equals(Search.SearchType.WEB_SERVICE)) {
            webServiceSearch.search(query, Posts.maxPostCount[0]);
          } else if (Search.currentSearchType.equals(Search.SearchType.STACKEXCHANGE_API)) {
            stackExchangeSearch.search(query, Posts.maxPostCount[0]);
          }

          if (ResultsSorter.currentSortOption == ResultsSorter.SortType.BY_SCORE) {
            ResultsSorter.sortFilesByScore();
          }

          posts.update();
        } catch (Exception e) {
          Notification.createErrorNotification(e.getMessage());
        }
      }
    }
Esempio n. 14
0
 public void adjustmentValueChanged(AdjustmentEvent e) {
   ball.setDelay(jsbDelay.getMaximum() - e.getValue());
 }
Esempio n. 15
0
 /** This method is called in case the scroll bar changes its set value due user interaction. */
 @Override
 public void adjustmentValueChanged(@Nonnull final AdjustmentEvent e) {
   parentInstance.setCurrentValue(e.getValue());
 }
Esempio n. 16
0
  /**
   * Converts a new event to an old one (used for compatibility). If the new event cannot be
   * converted (because no old equivalent exists) then this returns null.
   *
   * <p>Note: this method is here instead of in each individual new event class in java.awt.event
   * because we don't want to make it public and it needs to be called from java.awt.
   */
  Event convertToOld() {
    Object src = getSource();
    int newid = id;

    switch (id) {
      case KeyEvent.KEY_PRESSED:
      case KeyEvent.KEY_RELEASED:
        KeyEvent ke = (KeyEvent) this;
        if (ke.isActionKey()) {
          newid = (id == KeyEvent.KEY_PRESSED ? Event.KEY_ACTION : Event.KEY_ACTION_RELEASE);
        }
        int keyCode = ke.getKeyCode();
        if (keyCode == KeyEvent.VK_SHIFT
            || keyCode == KeyEvent.VK_CONTROL
            || keyCode == KeyEvent.VK_ALT) {
          return null; // suppress modifier keys in old event model.
        }
        // no mask for button1 existed in old Event - strip it out
        return new Event(
            src,
            ke.getWhen(),
            newid,
            0,
            0,
            Event.getOldEventKey(ke),
            (ke.getModifiers() & ~InputEvent.BUTTON1_MASK));

      case MouseEvent.MOUSE_PRESSED:
      case MouseEvent.MOUSE_RELEASED:
      case MouseEvent.MOUSE_MOVED:
      case MouseEvent.MOUSE_DRAGGED:
      case MouseEvent.MOUSE_ENTERED:
      case MouseEvent.MOUSE_EXITED:
        MouseEvent me = (MouseEvent) this;
        // no mask for button1 existed in old Event - strip it out
        Event olde =
            new Event(
                src,
                me.getWhen(),
                newid,
                me.getX(),
                me.getY(),
                0,
                (me.getModifiers() & ~InputEvent.BUTTON1_MASK));
        olde.clickCount = me.getClickCount();
        return olde;

      case FocusEvent.FOCUS_GAINED:
        return new Event(src, Event.GOT_FOCUS, null);

      case FocusEvent.FOCUS_LOST:
        return new Event(src, Event.LOST_FOCUS, null);

      case WindowEvent.WINDOW_CLOSING:
      case WindowEvent.WINDOW_ICONIFIED:
      case WindowEvent.WINDOW_DEICONIFIED:
        return new Event(src, newid, null);

      case ComponentEvent.COMPONENT_MOVED:
        if (src instanceof Frame || src instanceof Dialog) {
          Point p = ((Component) src).getLocation();
          return new Event(src, 0, Event.WINDOW_MOVED, p.x, p.y, 0, 0);
        }
        break;

      case ActionEvent.ACTION_PERFORMED:
        ActionEvent ae = (ActionEvent) this;
        String cmd;
        if (src instanceof Button) {
          cmd = ((Button) src).getLabel();
        } else if (src instanceof MenuItem) {
          cmd = ((MenuItem) src).getLabel();
        } else {
          cmd = ae.getActionCommand();
        }
        return new Event(src, 0, newid, 0, 0, 0, ae.getModifiers(), cmd);

      case ItemEvent.ITEM_STATE_CHANGED:
        ItemEvent ie = (ItemEvent) this;
        Object arg;
        if (src instanceof List) {
          newid =
              (ie.getStateChange() == ItemEvent.SELECTED ? Event.LIST_SELECT : Event.LIST_DESELECT);
          arg = ie.getItem();
        } else {
          newid = Event.ACTION_EVENT;
          if (src instanceof Choice) {
            arg = ie.getItem();

          } else { // Checkbox
            arg = new Boolean(ie.getStateChange() == ItemEvent.SELECTED);
          }
        }
        return new Event(src, newid, arg);

      case AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED:
        AdjustmentEvent aje = (AdjustmentEvent) this;
        switch (aje.getAdjustmentType()) {
          case AdjustmentEvent.UNIT_INCREMENT:
            newid = Event.SCROLL_LINE_DOWN;
            break;
          case AdjustmentEvent.UNIT_DECREMENT:
            newid = Event.SCROLL_LINE_UP;
            break;
          case AdjustmentEvent.BLOCK_INCREMENT:
            newid = Event.SCROLL_PAGE_DOWN;
            break;
          case AdjustmentEvent.BLOCK_DECREMENT:
            newid = Event.SCROLL_PAGE_UP;
            break;
          case AdjustmentEvent.TRACK:
            if (aje.getValueIsAdjusting()) {
              newid = Event.SCROLL_ABSOLUTE;
            } else {
              newid = Event.SCROLL_END;
            }
            break;
          default:
            return null;
        }
        return new Event(src, newid, new Integer(aje.getValue()));

      default:
    }
    return null;
  }
Esempio n. 17
0
 public void adjustmentValueChanged(AdjustmentEvent e) {
   if (e.getValueIsAdjusting()) {
     devArray[id].lastSetVal = e.getValue();
   }
 }