private void updatePipette() { Dialog pickerDialog = getPickerDialog(); if (pickerDialog != null && pickerDialog.isShowing()) { Point mouseLoc = updateLocation(); if (mouseLoc == null) return; final Color c = getPixelColor(mouseLoc); if (!c.equals(getColor()) || !mouseLoc.equals(myPreviousLocation)) { setColor(c); myPreviousLocation.setLocation(mouseLoc); myCaptureRect.setBounds( mouseLoc.x - HOT_SPOT.x + SIZE / 2 - 2, mouseLoc.y - HOT_SPOT.y + SIZE / 2 - 2, 5, 5); BufferedImage capture = myRobot.createScreenCapture(myCaptureRect); // Clear the cursor graphics myGraphics.setComposite(AlphaComposite.Src); myGraphics.setColor(UIUtil.TRANSPARENT_COLOR); myGraphics.fillRect(0, 0, myImage.getWidth(), myImage.getHeight()); myGraphics.drawImage( capture, myZoomRect.x, myZoomRect.y, myZoomRect.width, myZoomRect.height, this); // cropping round image myGraphics.setComposite(AlphaComposite.getInstance(AlphaComposite.DST_OUT)); myGraphics.drawImage( myMaskImage, myZoomRect.x, myZoomRect.y, myZoomRect.width, myZoomRect.height, this); // paint magnifier myGraphics.setComposite(AlphaComposite.SrcOver); UIUtil.drawImage( myGraphics, myPipetteImage, SIZE - AllIcons.Ide.Pipette.getIconWidth(), 0, this); pickerDialog.setCursor( myParent.getToolkit().createCustomCursor(myImage, HOT_SPOT, "ColorPicker")); notifyListener(c, 300); } } }