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); }
@Override public void paint(Graphics g, JComponent c) { String style = (String) c.getClientProperty("Quaqua.Button.style"); if (style != null && style.equals("help")) { Insets insets = c.getInsets(); UIManager.getIcon("Button.helpIcon").paintIcon(c, g, insets.left, insets.top); return; } Object oldHints = QuaquaUtilities.beginGraphics((Graphics2D) g); if (((AbstractButton) c).isBorderPainted()) { Border b = c.getBorder(); if (b != null && b instanceof BackgroundBorder) { ((BackgroundBorder) b) .getBackgroundBorder() .paintBorder(c, g, 0, 0, c.getWidth(), c.getHeight()); } } super.paint(g, c); QuaquaUtilities.endGraphics((Graphics2D) g, oldHints); Debug.paint(g, c, this); }