public void paintComponent(Graphics gr) { Graphics2D g = (Graphics2D) gr; Object oldHints = QuaquaUtilities.beginGraphics((Graphics2D) g); g.drawImage(crayonsImage, 0, 0, this); if (selectedCrayon != null) { /* g.setColor(new Color(0x60ffffff & selectedCrayon.color.getRGB(),true)); g.fill(selectedCrayon.shape); */ g.setColor(getForeground()); FontMetrics fm = g.getFontMetrics(); int nameWidth = fm.stringWidth(selectedCrayon.name); g.drawString( selectedCrayon.name, (crayonsImage.getWidth(this) - nameWidth) / 2, fm.getAscent() + 1); } QuaquaUtilities.endGraphics((Graphics2D) g, oldHints); }