import javax.swing.*;
public class Heart extends JPanel {
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(Color.RED);
int[] x = {75, 100, 125, 100};
int[] y = {100, 75, 100, 125};
g2d.fillPolygon(x, y, 4);
g2d.fillOval(50, 50, 50, 50);
g2d.fillOval(100, 50, 50, 50);
}
}
暂无评论