import javax.swing.*;
import java.awt.*;
public class Flower extends JFrame {
public Flower() {
super("小花");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(400, 400);
setLocationRelativeTo(null);
setVisible(true);
}
public static void main(String[] args) {
new Flower();
}
@Override
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setPaint(Color.YELLOW);
g2d.fillOval(50, 50, 300, 300);
g2d.setPaint(Color.RED);
g2d.fillOval(150, 150, 100, 100);
g2d.setPaint(Color.ORANGE);
g2d.fillOval(250, 250, 80, 80);
g2d.setPaint(Color.PINK);
g2d.fillOval(350, 350, 60, 60);
}
}