private boolean shouldIgnore(MouseEvent e) {

      System.out.println(
          " in shouldIgnore ret  " + (!SwingUtilities.isLeftMouseButton(e) || !table.isEnabled()));

      return !SwingUtilities.isLeftMouseButton(e) || !table.isEnabled();
    }
Exemple #2
0
  @Override
  public void mouseClicked(MouseEvent e) {
    IFormeEditable courbePrecSelect = null;
    if (this.pan.getFormeSelectionnee() != null) courbePrecSelect = this.pan.getFormeSelectionnee();

    if (SwingUtilities.isRightMouseButton(e)) Action.selectionner(this.pan, e.getX(), e.getY());

    switch (Action.getActionCourante()) {
      case Action.AJOUTER:
        if (SwingUtilities.isLeftMouseButton(e)) Action.ajouter(this.pan, e.getX(), e.getY());
        break;
      case Action.COMBINER:
        if (SwingUtilities.isRightMouseButton(e))
          Action.combiner(courbePrecSelect, this.pan.getFormeSelectionnee());
        break;
      case Action.SUPPRIMER:
        if (SwingUtilities.isLeftMouseButton(e)) Action.supprimer(pan);
        break;
      case Action.ROTATION:
        if (SwingUtilities.isLeftMouseButton(e))
          Action.deplacer(this.pan.getFormeSelectionnee().getCentreRot(), e.getX(), e.getY());
        break;
    }

    this.pan.repaint();
  }
 public void itemClicked(VisualItem item, MouseEvent e) {
   if (!SwingUtilities.isLeftMouseButton(e)) return;
   if (e.getClickCount() == 2) {
     String id = item.getString("id");
     BrowserLauncher.showDocument(URL + id);
   }
 }
Exemple #4
0
 @Override
 public void mouseClicked(MouseEvent e) {
   if (SwingUtilities.isRightMouseButton(e) && noteData.getSelectedNote() != null) {
     final String url =
         OsmApi.getOsmApi().getBaseUrl() + "notes/" + noteData.getSelectedNote().getId();
     ClipboardUtils.copyString(url);
     return;
   } else if (!SwingUtilities.isLeftMouseButton(e)) {
     return;
   }
   Point clickPoint = e.getPoint();
   double snapDistance = 10;
   double minDistance = Double.MAX_VALUE;
   final int iconHeight = ImageProvider.ImageSizes.SMALLICON.getAdjustedHeight();
   Note closestNote = null;
   for (Note note : noteData.getNotes()) {
     Point notePoint = Main.map.mapView.getPoint(note.getLatLon());
     // move the note point to the center of the icon where users are most likely to click when
     // selecting
     notePoint.setLocation(notePoint.getX(), notePoint.getY() - iconHeight / 2);
     double dist = clickPoint.distanceSq(notePoint);
     if (minDistance > dist && clickPoint.distance(notePoint) < snapDistance) {
       minDistance = dist;
       closestNote = note;
     }
   }
   noteData.setSelectedNote(closestNote);
 }
 @Override
 public void mouseReleased(MouseEvent evt) {
   if (isDragging()) {
     doDragSlider(evt, false);
     setDragging(false);
     setDraggedSliderIndex(INVALID_INDEX);
     applyChanges();
   } else if (!maybeShowSliderActions(evt) && SwingUtilities.isLeftMouseButton(evt)) {
     int mode = 0;
     int sliderIndex = getSelectedSliderIndex(evt);
     if (sliderIndex != INVALID_INDEX && getModel().isColorEditable()) {
       mode = 1;
     }
     if (mode == 0) {
       if (sliderIndex == INVALID_INDEX) {
         sliderIndex = getSelectedSliderTextIndex(evt);
       }
       if (sliderIndex != INVALID_INDEX) {
         mode = 2;
       }
     }
     if (mode == 1) {
       editSliderColor(evt, sliderIndex);
     } else if (mode == 2) {
       editSliderSample(evt, sliderIndex);
     }
   }
 }
Exemple #6
0
 public void mousePressed(MouseEvent e)
 {
     if(skin != null && e.getSource() == SkinUnit.this && SwingUtilities.isLeftMouseButton(e))
     {
         keeper.changeSkin(skin, true);
     }
 }
 public void mouseClicked(MouseEvent e) {
   if (SwingUtilities.isLeftMouseButton(e)) {
     leftClickAction(e);
   } else {
     rightClickAction(e);
   }
 }
Exemple #8
0
 @Override
 public void mouseReleased(MouseEvent e) {
   if (SwingUtilities.isLeftMouseButton(e)) {
     isMouseDown = false;
     reload();
   }
 }
 /**
  * @see prefuse.controls.Control#itemPressed(prefuse.visual.VisualItem, java.awt.event.MouseEvent)
  */
 public void itemPressed(VisualItem item, MouseEvent e) {
   if (!SwingUtilities.isLeftMouseButton(e)) return;
   dragged = false;
   Display d = (Display) e.getComponent();
   d.getAbsoluteCoordinate(e.getPoint(), down);
   if (item instanceof AggregateItem) setFixed(item, true);
 }
Exemple #10
0
 public void mouseReleased(MouseEvent e) {
   // 左ボタンの場合
   if (SwingUtilities.isLeftMouseButton(e)) {
     if (!underDrag || (timer != null && timer.isRunning())) return;
     underDrag = false;
     if ((fromPos != null) && (toPos != null)) {
       if (Math.min(fromPos.x, toPos.x) < 0) massStart = Math.max(0, massStart - massRange / 3);
       else if (Math.max(fromPos.x, toPos.x) > getWidth())
         massStart = Math.min(massRangeMax - massRange, massStart + massRange / 3);
       else {
         if (peaks1 != null) {
           timer =
               new Timer(
                   30,
                   new AnimationTimer(
                       Math.abs(fromPos.x - toPos.x), Math.min(fromPos.x, toPos.x)));
           timer.start();
         } else {
           fromPos = toPos = null;
           repaint();
         }
       }
     }
   }
 }
 /**
  * Manages mouse clicks
  *
  * @param e the event
  * @see javax.swing.text.DefaultCaret#mouseClicked(java.awt.event.MouseEvent)
  */
 public void mouseClicked(MouseEvent e) {
   if (SwingUtilities.isMiddleMouseButton(e) && e.getClickCount() == 1) {
     /** * PASTE USING MIDDLE BUTTON ** */
     JTextComponent c = (JTextComponent) e.getSource();
     if (c != null) {
       Toolkit tk = c.getToolkit();
       Clipboard buffer = tk.getSystemSelection();
       if (buffer != null) {
         Transferable trans = buffer.getContents(null);
         if (trans.isDataFlavorSupported(DataFlavor.stringFlavor)) {
           try {
             String pastedText = (String) trans.getTransferData(DataFlavor.stringFlavor);
             ((JTextPane) getConsole().getConfiguration().getInputCommandView())
                 .replaceSelection(pastedText);
           } catch (UnsupportedFlavorException e1) {
             e1.printStackTrace();
           } catch (IOException e1) {
             e1.printStackTrace();
           }
         }
       }
     }
   } else if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 1) {
     /** * SEND THE FOCUS TO THE INPUT COMMAND VIEW ** */
     ((JTextPane) getConsole().getConfiguration().getInputCommandView()).requestFocus();
     ((JTextPane) getConsole().getConfiguration().getInputCommandView())
         .getCaret()
         .setVisible(true);
   } else {
     /** * DELEGATE TO THE SYSTEM ** */
     super.mouseClicked(e);
   }
 }
  @Override
  public void mouseDragged(MouseEvent evt) {
    if (!SwingUtilities.isLeftMouseButton(evt)) return;

    Point current = evt.getPoint();
    double x = viewer.getCenter().getX();
    double y = viewer.getCenter().getY();

    if (prev != null) {
      x += prev.x - current.x;
      y += prev.y - current.y;
    }

    if (!viewer.isNegativeYAllowed()) {
      if (y < 0) {
        y = 0;
      }
    }

    int maxHeight =
        (int)
            (viewer.getTileFactory().getMapSize(viewer.getZoom()).getHeight()
                * viewer.getTileFactory().getTileSize(viewer.getZoom()));
    if (y > maxHeight) {
      y = maxHeight;
    }

    prev = current;
    viewer.setCenter(new Point2D.Double(x, y));
    viewer.repaint();
  }
  private void jList1MouseClicked(
      java.awt.event.MouseEvent evt) { // GEN-FIRST:event_jList1MouseClicked

    if (SwingUtilities.isLeftMouseButton(evt) && evt.getClickCount() == 2) {
      jButtonSaveActionPerformed(null);
    }
  } // GEN-LAST:event_jList1MouseClicked
  @Override
  public void mouseReleased(MouseEvent evt) {
    if (!SwingUtilities.isLeftMouseButton(evt)) return;

    prev = null;
    viewer.setCursor(priorCursor);
  }
Exemple #15
0
 @Override
 public void mousePressed(MouseEvent e) {
   if (SwingUtilities.isLeftMouseButton(e)) {
     isMouseDown = true;
     reload();
   }
 }
 @Override
 public void mouseClicked(MouseEvent e) {
   if (SwingUtilities.isLeftMouseButton(e) && (e.getClickCount() == 2)) {
     Point2D point = e.getPoint();
     panel.zoom(point, 1);
   }
 }
Exemple #17
0
  @Override
  public final void mousePressed(final MouseEvent e) {
    if (!isEnabled() || !isFocusable()) return;

    requestFocusInWindow();
    cursor(true);

    if (SwingUtilities.isMiddleMouseButton(e)) copy();

    final boolean marking = e.isShiftDown();
    final boolean nomark = !text.marked();
    if (SwingUtilities.isLeftMouseButton(e)) {
      final int c = e.getClickCount();
      if (c == 1) {
        // selection mode
        if (marking && nomark) text.startMark();
        rend.select(scroll.pos(), e.getPoint(), marking);
      } else if (c == 2) {
        text.selectWord();
      } else {
        text.selectLine();
      }
    } else if (nomark) {
      rend.select(scroll.pos(), e.getPoint(), false);
    }
  }
Exemple #18
0
 @Override
 public void mouseReleased(MouseEvent event) {
   if (SwingUtilities.isLeftMouseButton(event) && !ctrlPressed) {
     freehand.setImgNr();
     freehand.newImg = true;
   }
 }
Exemple #19
0
  @Override
  public final void mousePressed(final MouseEvent e) {
    if (!isEnabled() || !isFocusable()) return;

    requestFocusInWindow();
    caret(true);

    if (SwingUtilities.isMiddleMouseButton(e)) copy();

    final boolean shift = e.isShiftDown();
    final boolean selected = editor.selected();
    if (SwingUtilities.isLeftMouseButton(e)) {
      final int c = e.getClickCount();
      if (c == 1) {
        // selection mode
        if (shift) editor.startSelection(true);
        select(e.getPoint(), !shift);
      } else if (c == 2) {
        editor.selectWord();
      } else {
        editor.selectLine();
      }
    } else if (!selected) {
      select(e.getPoint(), true);
    }
  }
    /**
     * Mouse event processor.
     *
     * @param e event.
     */
    protected void processMouseEvent(MouseEvent e) {
      if (e.getID() == MouseEvent.MOUSE_PRESSED && SwingUtilities.isLeftMouseButton(e)) {
        setCollapsed(!collapsed);

        ResultGroupPanel group = (ResultGroupPanel) getParent();
        group.setCollapsed(collapsed);
      }
    }
    @Override
    public void mouseClicked(MouseEvent e) {
      if (e.getClickCount() < 2 || !SwingUtilities.isLeftMouseButton(e)) return;

      selectAllListSelectedPrimitives();
      // zoom/center on selection
      AutoScaleAction.zoomTo(getAllSelectedPrimitives());
    }
    @Override
    public void mouseDragged(MouseEvent e) {
      if (!SwingUtilities.isLeftMouseButton(e)) return;

      mUIModel.pan(mLastMousePosition.x - e.getX(), mLastMousePosition.y - e.getY());

      mLastMousePosition = e.getPoint();
    }
 /**
  * @see prefuse.controls.Control#itemReleased(prefuse.visual.VisualItem,
  *     java.awt.event.MouseEvent)
  */
 public void itemReleased(VisualItem item, MouseEvent e) {
   if (!SwingUtilities.isLeftMouseButton(e)) return;
   if (dragged) {
     activeItem = null;
     setFixed(item, false);
     dragged = false;
   }
 }
  @Override
  public void mousePressed(MouseEvent evt) {
    if (!SwingUtilities.isLeftMouseButton(evt)) return;

    prev = evt.getPoint();
    priorCursor = viewer.getCursor();
    viewer.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
  }
Exemple #25
0
  public void mousePressed(MouseEvent e) {

    updateGlobalMouse();

    int mX = e.getX();
    int mY = e.getY();

    if (SwingUtilities.isLeftMouseButton(e)) {

      leftMousePressed = true;

      // Check for HUD panel presses
      if (hudPanel.contains(mX, mY) && showMiniMap) {

        if (miniMapRect.contains(mX, mY)) {

          startedInMiniMap = true;

          // Centre the camera to the field position of the mini-map click
          centreCamOnPt(getFieldPtFromMiniMapClick(mX, mY));
        }

        return;
      }

      // Check for Hive creation
      if (placingHive) {

        // TODO: check if the placement location is valid

        // Create a larvae pod out of the selected larvae
        myPlayer.spawnPod(mouseGlobal, myPlayer.getSelectedLarvae());

        placingHive = false;
        startedInHiveCreation = true;

        return;
      }

      // Default

      // Save the start point of the selection rectangle
      startSelect.set(mouseGlobal);

      startedInMiniMap = false;
      startedInHiveCreation = false;

    } else if (SwingUtilities.isRightMouseButton(e)) {

      if (!miniMapRect.contains(mX, mY) || !showMiniMap) {
        myPlayer.handleRightClick(mouseGlobal.x(), mouseGlobal.y());
      } else {
        Pt fieldPos = getFieldPtFromMiniMapClick(mX, mY);
        myPlayer.handleRightClick(fieldPos.x(), fieldPos.y());
      }
    }
  }
Exemple #26
0
 /** Handle mouse input. */
 public void mousePressed(MouseEvent e) {
   if (SwingUtilities.isLeftMouseButton(e)) {
     if (this.contains(e.getX(), e.getY())) {
       if (!this.hasFocus() && this.isRequestFocusEnabled()) {
         this.requestFocus();
       }
     }
   }
 }
Exemple #27
0
  @Override
  public final void mouseDragged(final MouseEvent e) {
    if (!SwingUtilities.isLeftMouseButton(e)) return;

    // selection mode
    select(e.getPoint(), false);
    final int y = Math.max(20, Math.min(e.getY(), getHeight() - 20));
    if (y != e.getY()) scroll.pos(scroll.pos() + e.getY() - y);
  }
 @Override
 public void mouseClicked(MouseEvent e) {
   if (SwingUtilities.isLeftMouseButton(e)) {
     p.selectionnerPlan();
   }
   if (SwingUtilities.isRightMouseButton(e)) {
     p.afficherPopup(e);
   }
 }
 /** @param e */
 @Override
 public void mousePressed(MouseEvent e) {
   if (SwingUtilities.isRightMouseButton(e)) {
     simulationBox.rightPress(new Viewport(e.getX(), e.getY()));
   }
   if (SwingUtilities.isLeftMouseButton(e)) {
     simulationBox.leftPress(new Viewport(e.getX(), e.getY()));
   }
 }
Exemple #30
0
    public void mousePressed(MouseEvent e) {
      // 左ボタンの場合
      if (SwingUtilities.isLeftMouseButton(e)) {

        if (timer != null && timer.isRunning()) return;

        fromPos = toPos = e.getPoint();
      }
    }