SHARE
TWEET

Untitled

a guest Jan 13th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     /**
  2.      * Clicks on an empty place in a canvas
  3.      *
  4.      * @param canvas diagram pane to click on
  5.      */
  6.     public static void clickInDiagram(JComponentOperator canvas, boolean rightClick)
  7.     {
  8.  
  9.         int pointCoo = 20;
  10.         Point startPoint = new Point(pointCoo, pointCoo);
  11.  
  12.         DiagramPresentationElement activeDiagram = Application.getInstance().getProject().getActiveDiagram();
  13.  
  14.         // run through 1000 pixels
  15.         for (int i = 0; i < 1000; i++)
  16.         {
  17.             PresentationElement element = activeDiagram.getPresentationElementAt(startPoint);
  18.             if (element == null)
  19.             {
  20.                 canvas.moveMouse(startPoint.x, startPoint.y);
  21.                 if (rightClick)
  22.                 {
  23.                     canvas.clickForPopup(startPoint.x, startPoint.y);
  24.                 }
  25.                 else
  26.                 {
  27.                     canvas.clickMouse(startPoint.x, startPoint.y, 1);
  28.                 }
  29.                 break;
  30.             }
  31.             else
  32.             {
  33.                 pointCoo++;
  34.                 startPoint.setLocation(pointCoo, pointCoo);
  35.             }
  36.         }
  37.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top