void (Graphics g) { applyRenderingHints(g); Dialog pickerDialog = getPickerDialog(); if (pickerDialog != null && pickerDialog.isShowing()) { Point mouseLoc = updateLocation(); if (mouseLoc == null) return; //final int pixels = UIUtil.isRetina(graphics2d) ? PIXELS / 2 + 1 : PIXELS; int left = PIXELS / 2 + 1; Rectangle captureRectangle = new Rectangle(mouseLoc.x - left, mouseLoc.y - left, PIXELS, PIXELS); BufferedImage captureScreen = captureScreen(pickerDialog, captureRectangle); if (captureScreen == null || captureScreen.getWidth() < PIXELS || captureRectangle.getHeight() < PIXELS) { cancelPipette(); return; } //noinspection UseJBColor Color newColor = new Color(captureScreen.getRGB(captureRectangle.width / 2, captureRectangle.height / 2)); Graphics2D graphics2d = ((Graphics2D)g); Point offset = new Point(10, 10); graphics2d.setComposite(AlphaComposite.Clear); graphics2d.fillRect(0, 0, getWidth(), getHeight()); graphics2d.setComposite(AlphaComposite.Src); graphics2d.clip(new Ellipse2D.Double(offset.x, offset.y, SIZE, SIZE)); graphics2d.drawImage(captureScreen, offset.x, offset.y, SIZE, SIZE, this); // paint magnifier graphics2d.setComposite(AlphaComposite.SrcOver); drawPixelGrid(graphics2d, offset); drawCenterPixel(graphics2d, offset, newColor); drawCurrentColorRectangle(graphics2d, offset, newColor); graphics2d.setClip(0, 0, getWidth(), getHeight()); drawMagnifierBorder(newColor, graphics2d, offset); pickerDialog.repaint(); if (!newColor.equals(getColor())) { setColor(newColor); notifyListener(newColor, 300); } } }