Dialog () { Dialog pickerDialog = getPickerDialog(); if (pickerDialog == null) { pickerDialog = super.getOrCreatePickerDialog(); pickerDialog.addMouseListener(new MouseAdapter() { @Override public void mouseExited(MouseEvent event) { updatePipette(); } }); pickerDialog.addMouseMotionListener(new MouseAdapter() { @Override public void mouseMoved(MouseEvent e) { updatePipette(); } }); pickerDialog.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { if (e.isTemporary()) { pickAndClose(); } else { cancelPipette(); } } }); pickerDialog.setSize(DIALOG_SIZE, DIALOG_SIZE); myMaskImage = UIUtil.createImage(pickerDialog, SIZE, SIZE, BufferedImage.TYPE_INT_ARGB); Graphics2D maskG = myMaskImage.createGraphics(); maskG.setColor(Color.BLUE); maskG.fillRect(0, 0, SIZE, SIZE); maskG.setColor(Color.RED); maskG.setComposite(AlphaComposite.SrcOut); maskG.fillRect(0, 0, SIZE, SIZE); maskG.dispose(); myPipetteImage = UIUtil.createImage(pickerDialog, AllIcons.Ide.Pipette.getIconWidth(), AllIcons.Ide.Pipette.getIconHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = myPipetteImage.createGraphics(); AllIcons.Ide.Pipette.paintIcon(null, graphics, 0, 0); graphics.dispose(); myImage = myParent.getGraphicsConfiguration().createCompatibleImage(SIZE, SIZE, Transparency.TRANSLUCENT); myGraphics = (Graphics2D)myImage.getGraphics(); myGraphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); } return pickerDialog; }