// draw petals for the spiral
Transform transform;
int n = petalSpinner.getSelection();
for (int i = 0; i < n; i++) {
transform = new Transform(device);
transform.translate(width / 2, height / 2);
transform.rotate(-(angle + 360 / n * i));
gc.setTransform(transform);
gc.drawArc(0, 0, width / 3, height / 6, 0, 180);
transform.dispose();
}