GraphicsとGraphics2Dの違いは何ですか?
Graphics2D は Graphics の拡張かどうか?
public void paintComponent(Graphics g)
{
super.paintComponent(g);
g.drawRect(25, 25, 20, 20); //use Graphics to paint rectangle
Graphics2D g2 =(Graphics2D)g;
g2.drawRect(0, 0, 20, 20); // use Graphics2D to paint rectangle
}