import javax.swing.*; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.*; import java.awt.Color; public class Graphics2DTest5 extends JPanel{ public static void main(String[] args){ JFrame frame = new JFrame(); Graphics2DTest5 app = new Graphics2DTest5(); frame.getContentPane().add(app); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(10, 10, 300, 200); frame.setTitle("ƒ^ƒCƒgƒ‹"); frame.setVisible(true); } public void paintComponent(Graphics g){ Graphics2D g2 = (Graphics2D)g; g2.setBackground(Color.PINK); g2.clearRect(0, 0, getWidth(), getHeight()); } }