【发布时间】:2013-10-21 02:41:26
【问题描述】:
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
}
【问题讨论】:
-
它实际上是带有AffineTransform类方法的Graphics类。
标签: java swing graphics graphics2d