public void mouseDragged(MouseEvent e) {
   graphContainer
       .getGraphControl()
       .dispatchEvent(
           SwingUtilities.convertMouseEvent(
               (Component) e.getSource(), e, graphContainer.getGraphControl()));
 }
      @Override
      public void mouseDragged(MouseEvent e) {
        if (!myDragging) return;
        MouseEvent event = SwingUtilities.convertMouseEvent(e.getComponent(), e, MyDivider.this);
        final ToolWindowAnchor anchor = myInfo.getAnchor();
        final Point point = event.getPoint();
        final Container windowPane = InternalDecorator.this.getParent();
        myLastPoint = SwingUtilities.convertPoint(MyDivider.this, point, windowPane);
        myLastPoint.x = Math.min(Math.max(myLastPoint.x, 0), windowPane.getWidth());
        myLastPoint.y = Math.min(Math.max(myLastPoint.y, 0), windowPane.getHeight());

        final Rectangle bounds = InternalDecorator.this.getBounds();
        if (anchor == ToolWindowAnchor.TOP) {
          InternalDecorator.this.setBounds(0, 0, bounds.width, myLastPoint.y);
        } else if (anchor == ToolWindowAnchor.LEFT) {
          InternalDecorator.this.setBounds(0, 0, myLastPoint.x, bounds.height);
        } else if (anchor == ToolWindowAnchor.BOTTOM) {
          InternalDecorator.this.setBounds(
              0, myLastPoint.y, bounds.width, windowPane.getHeight() - myLastPoint.y);
        } else if (anchor == ToolWindowAnchor.RIGHT) {
          InternalDecorator.this.setBounds(
              myLastPoint.x, 0, windowPane.getWidth() - myLastPoint.x, bounds.height);
        }
        InternalDecorator.this.validate();
        e.consume();
      }
 /* Repost event to dispatchComponent */
 private boolean repostEvent(MouseEvent e) {
   if (dispatchComponent == null) {
     return false;
   }
   MouseEvent editorMouseEvent = SwingUtilities.convertMouseEvent(grid, e, dispatchComponent);
   dispatchComponent.dispatchEvent(editorMouseEvent);
   return true;
 }
 private boolean repostEvent(MouseEvent e) {
   // Check for isEditing() in case another event has
   // caused the editor to be removed. See bug #4306499.
   if (dispatchComponent == null || !isEditing()) {
     return false;
   }
   MouseEvent e2 = SwingUtilities.convertMouseEvent(JListMutable.this, e, dispatchComponent);
   dispatchComponent.dispatchEvent(e2);
   return true;
 }
 // Event forwarding. We need it if user does press-and-drag gesture for opening popup and
 // choosing item there.
 // It works in JComboBox, here we provide the same behavior
 private void dispatchEventToPopup(MouseEvent e) {
   if (myPopup != null && myPopup.isVisible()) {
     JComponent content = myPopup.getContent();
     Rectangle rectangle = content.getBounds();
     Point location = rectangle.getLocation();
     SwingUtilities.convertPointToScreen(location, content);
     Point eventPoint = e.getLocationOnScreen();
     rectangle.setLocation(location);
     if (rectangle.contains(eventPoint)) {
       MouseEvent event =
           SwingUtilities.convertMouseEvent(e.getComponent(), e, myPopup.getContent());
       Component component =
           SwingUtilities.getDeepestComponentAt(content, event.getX(), event.getY());
       if (component != null) component.dispatchEvent(event);
     }
   }
 }
    public void mousePressed(MouseEvent e) {
      // Selects to create a handler for resizing
      if (!graph.isCellSelected(cell)) {
        graphContainer.selectCellForEvent(cell, e);
      }

      // Initiates a resize event in the handler
      mxCellHandler handler = graphContainer.getSubHandler().getHandler(cell);

      if (handler != null) {
        // Starts the resize at index 7 (bottom right)
        handler.start(
            SwingUtilities.convertMouseEvent(
                (Component) e.getSource(), e, graphContainer.getGraphControl()),
            index);
        e.consume();
      }
    }
예제 #7
0
 /**
  * @param aEvent
  * @return
  */
 protected final MouseEvent convertEvent(final MouseEvent aEvent) {
   JComponent view = SwingComponentUtils.getDeepestComponentAt(aEvent);
   return SwingUtilities.convertMouseEvent(aEvent.getComponent(), aEvent, view);
 }
예제 #8
0
 private void dispatchEvent(MouseEvent me) {
   Component src = me.getComponent();
   comp.dispatchEvent(SwingUtilities.convertMouseEvent(src, me, comp));
   src.repaint();
 }
 boolean isInDragZone(MouseEvent e) {
   final Point p = SwingUtilities.convertMouseEvent(e.getComponent(), e, this).getPoint();
   return Math.abs(myInfo.getAnchor().isHorizontal() ? p.y : p.x) < 6;
 }