// <applet code="ConcentricApplet" width="400" height="400"></applet>
import java.awt.*;
import javax.swing.*;
public class ConcentricApplet extends JApplet {
public void init() {
setLayout(new BorderLayout());
add(new ConcentricPanel());
}
}
class ConcentricPanel extends JPanel {
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
int w = getWidth();
int h = getHeight();
int r = Math.min(w, h)/8;
int cx = w/2;
int cy = h/2;
for(int i = 0; i < 4; i++) {
int d = (i+1)*r;
int x = cx - d/2;
int y = cy - d/2;
g2.drawOval(x, y, d, d);
}
}
}