* @see org.eclipse.swt.examples.graphics.GraphicsTab#paint(org.eclipse.swt.graphics.GC, int, int)
*/
public void paint(GC gc, int width, int height) {
if (!example.checkAdvancedGraphics())
return;
Device device = gc.getDevice();
// diameter of the circle in pixels
int diameter = width < height ? width - 25 : height - 25;
if (!getAnimation() && nextNumber == 0) {
Font font = new Font(device, CountDownTab.getPlatformFontFace(1), diameter / 2, SWT.NONE);
gc.setFont(font);
// display "SWT"
gc.setForeground(device.getSystemColor(SWT.COLOR_DARK_BLUE));
gc.setTextAntialias(SWT.ON);
// determine the dimensions of the word
String text = GraphicsExample.getResourceString("SWT");
Point point = gc.stringExtent(text);
int textWidth = point.x;
int textHeight = point.y;
gc.drawString(text, (width - textWidth) / 2, (height - textHeight) / 2, true);
font.dispose();
} else {
Font font = new Font(device, CountDownTab.getPlatformFontFace(0), 6 * diameter / 10, SWT.NONE);
gc.setFont(font);
// set attributes from controls
gc.setLineWidth(lineWidthSpinner.getSelection());
gc.setLineCap(lineCap); // round line ends
gc.setAntialias(antialias); // smooth jagged edges
gc.setTextAntialias(antialias); // smooth jagged edges
// draw the circles
Path path = new Path(device);
path.addArc((width - diameter) / 2, (height - diameter) / 2, diameter, diameter, 0, 360);
path
.addArc((width - diameter + 50) / 2, (height - diameter + 50) / 2, diameter - 50, diameter - 50, 0,
360);
gc.drawPath(path);
gc.setBackground(device.getSystemColor(SWT.COLOR_RED));
gc.fillPath(path);
path.dispose();
Point point = gc.stringExtent(new Integer(nextNumber).toString());
int textWidth = point.x;
int textHeight = point.y;
// draw the number
gc.drawString(new Integer(nextNumber).toString(), (width - textWidth) / 2, (height - textHeight) / 2, true);
// draw the rotating arm
Transform transform = new Transform(device);
transform.translate(width / 2, height / 2);
transform.rotate(angle);
gc.setTransform(transform);
gc.setForeground(device.getSystemColor(SWT.COLOR_RED));
gc.drawLine(0, 0, diameter / 2, 0);
transform.dispose();
font.dispose();
}