SWT - get actual screen position of an image
问题 I have drawn an image on a Composite using the following code imageCanvas = new Composite(shell, SWT.BORDER); //adding paintListener to the canvas imageCanvas.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { if (sourceImage != null) { // draw the image e.gc.drawImage(sourceImage, 120, 150); //check the bounds of the image using the getBounds function Rectangle newrec = sourceImage.getBounds(); System.out.println("X: " +newrec.x + " Y: "+newrec.y ); //