Пример #1
0
 public void toggleMarkReferencePoint(boolean on) {
   if (on) {
     iPane.setMouseInputAdapter(mListenerPointMarker);
     // for custom Cursor
     Toolkit toolkit = Toolkit.getDefaultToolkit();
     URL url = getClass().getResource("icons/pointCursor.gif");
     Image cursorImage = toolkit.getImage(url);
     Point cursorHotSpot = new Point(15, 15);
     Cursor customCursor = toolkit.createCustomCursor(cursorImage, cursorHotSpot, "Cursor");
     iPane.setCursor(customCursor);
     // iPane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
   } else {
     iPane.restoreDefaultMouseInputAdapter();
     iPane.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
   }
 }
Пример #2
0
 private void markCurrentPoint(MouseEvent e) {
   Point2D zc = iPane.toUserSpace(e.getX(), e.getY());
   int x = (int) (zc.getX());
   int y = (int) (zc.getY());
   Point p = new Point(x, y);
   System.out.println("Marked point: " + p);
   markedPointsList.add(p);
 }