public void paint(Graphics g) { Image bufi = createImage(width, height); Graphics bufg = bufi.getGraphics(); super.paint(g); MyTime myTime = new MyTime(); bufg.setFont(font); bufg.setColor(fontColor); bufg.drawString(myTime.time, drawPointX, drawPointY); g.drawImage(bufi, drawPointX, drawPointY, this); }
public void update(Graphics g) { Dimension size = getSize(); if (offscreen == null) offscreen = createImage((size.width < 1) ? 1 : size.width, (size.height < 1) ? 1 : size.height); Graphics og = offscreen.getGraphics(); if (og != null) try { og.setClip(g.getClip()); og.setColor(getBackground()); og.fillRect(0, 0, size.width, size.height); super.paint(og); } finally { og.dispose(); } paint(g); }
/** ******************************************************************* */ public void paint(Graphics g) { super.paint(g); draw(g); }