コード例 #1
0
 /**
  * Displays on the image the currently selected z-section and time-point.
  *
  * @see MouseListener#mousePressed(MouseEvent)
  */
 public void mousePressed(MouseEvent e) {
   pressedPoint = e.getPoint();
   canvas.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
   // SwingUtilities.convertPointToScreen(pressedPoint, canvas);
   if (canvas instanceof BrowserBICanvas)
     ((BrowserBICanvas) canvas).setPaintedString(model.getDefaultZ(), model.getDefaultT());
 }
コード例 #2
0
 /**
  * Determines the value of the z-section.
  *
  * @see MouseWheelListener#mouseWheelMoved(MouseWheelEvent)
  */
 public void mouseWheelMoved(MouseWheelEvent e) {
   if (model.isBigImage()) return;
   if (e.isAltDown() || e.isShiftDown() || e.isControlDown()) { // zooming
     if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
       int v = e.getWheelRotation();
       model.zoom(v < 0); // zoom in and out.
     }
     return;
   }
   // change the z-section.
   int maxZ = model.getMaxZ();
   int maxT = model.getMaxT();
   if (maxZ <= 0 && maxT <= 0) return;
   boolean up = true;
   if (e.getWheelRotation() > 0) up = false;
   if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
     int v = model.getDefaultZ() - e.getWheelRotation();
     if (up) {
       if (v <= maxZ) {
         model.setSelectedXYPlane(v, -1);
         if (canvas instanceof BrowserBICanvas)
           ((BrowserBICanvas) canvas).setPaintedString(v, model.getDefaultT());
       } else {
         if (canvas instanceof BrowserBICanvas)
           ((BrowserBICanvas) canvas).setPaintedString(-1, -1);
       }
     } else { // moving down
       if (v >= 0) {
         model.setSelectedXYPlane(v, -1);
         if (canvas instanceof BrowserBICanvas)
           ((BrowserBICanvas) canvas).setPaintedString(v, model.getDefaultT());
       } else {
         if (canvas instanceof BrowserBICanvas)
           ((BrowserBICanvas) canvas).setPaintedString(-1, -1);
       }
     }
   }
 }