7
图形和图形2D有什么区别?
Graphics2D是否是图形的扩展?图形和Graphics2D之间的区别?
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
}
它实际上是具有AffineTransform类方法的Graphics类。 –