public void paint(Graphics g) { if (comp != null) { width = comp.getWidth() / 6; height = comp.getHeight() * 2 / 3; } g.setColor(bgColor); g.fillRect(x, y, width, height); g.setColor(fgColor); g.setFont(font); g.drawString(strTray, x / 2 + width / 2, y + height + 10); super.paint(g); }
public void paint(Graphics g) { super.paint(g); if (thumbnail != null) { int x = getWidth() / 2 - thumbnail.getIconWidth() / 2; int y = getHeight() / 2 - thumbnail.getIconHeight() / 2; if (y < 0) { y = 0; } if (x < 5) { x = 5; } thumbnail.paintIcon(this, g, x, y); } }
@Override public void paint(Graphics g) { super.paint(g); }