下面是一个使用 Java 实现绘制爱心的示例代码:
import java.awt.*;
import javax.swing.*;
public class Heart extends JComponent {
private int width = 300;
private int height = 300;
public void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints