请问Canvas作为方法参数怎么画图呢?public void doCanvas(Canvas _Canvas){这边怎样用 paint(Graphics g)}
请问Canvas作为方法参数怎么画图呢?
public void doCanvas(Canvas _Canvas){
这边怎样用 paint(Graphics g)
}
[解决办法]
public void paintComponent(Graphics g)
{
Graphics2D g2 = (Graphics2D)g;
super.paintComponent(g);
Image img = Toolkit.getDefaultToolkit().getImage("d:\\a.jpg");
g2.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), this);
}
查看更多 下一篇
相关新闻