コード例 #1
0
  @Override
  protected void paintChildren(Graphics g) {

    autoscale();

    super.paintChildren(g);
    if (IGV.getInstance().isRulerEnabled()) {
      int start = MouseInfo.getPointerInfo().getLocation().x - getLocationOnScreen().x;
      g.setColor(Color.BLACK);
      g.drawLine(start, 0, start, getHeight());
    }
  }
コード例 #2
0
 @Override
 public void dragGestureRecognized(DragGestureEvent dge) {
   Cursor cursor = null;
   BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
   paint(bi.getGraphics());
   ImageMover.start(bi, MouseInfo.getPointerInfo().getLocation());
   String s = "[ANDITEM]";
   if (dge.getDragAction() == DnDConstants.ACTION_COPY) {
     cursor = DragSource.DefaultCopyDrop;
   }
   dge.startDrag(
       cursor, new SimpleDragObject.TransferableSimpleDragObject(new SimpleDragObject(s)));
 }