void (Graphics graphics) { Graphics2D g = (Graphics2D)graphics.create(); try { g.setRenderingHint(KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); int h = (int)(getHeight() *.8); int w = h / 2; float thickness = h * .1F; AffineTransform transform = g.getTransform(); if (transform == null) { transform = new AffineTransform(1, 0, -thickness / h, 1, thickness * 3, thickness / 4); } else { transform.concatenate(new AffineTransform(1, 0, -thickness / h, 1, thickness * 3, thickness / 4)); } g.setTransform(transform); g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); g.setColor(UIManager.getColor("Label.foreground")); myCalendar.setTimeInMillis(System.currentTimeMillis()); boolean is24 = is24Hours(); int hours = myCalendar.get(is24 ? HOUR_OF_DAY : HOUR); if (hours == 0 && !is24) { hours = 12; } int minutes = myCalendar.get(MINUTE); int x = 0; int y = (getHeight() - h) / 2; boolean eveningDot = !is24 && myCalendar.get(HOUR_OF_DAY) > 11; if (eveningDot) { g.setStroke(new BasicStroke(thickness * 2, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); g.draw(new Line2D.Float(x + thickness, y + thickness, x + thickness, y + thickness + thickness / 20)); } g.setStroke(new BasicStroke(thickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); if (hours >= 10) paintDigit(g, x, y, w, h, thickness, hours / 10); x += w + thickness * 2; paintDigit(g, x, y, w, h, thickness, hours % 10); x += w + thickness * 2; g.draw(new Line2D.Float(x, y + h / 2 - thickness * 2, x, y + h / 2 - thickness * 2 + thickness / 20)); g.draw(new Line2D.Float(x, y + h / 2 + thickness * 2, x, y + h / 2 + thickness * 2 + thickness / 20)); x += thickness * 2; paintDigit(g, x, y, w, h, thickness, minutes / 10); x += w + thickness * 2; paintDigit(g, x, y, w, h, thickness, minutes % 10); scheduleNextRepaint(); } finally { g.dispose(); } }