日期:2014-05-20  浏览次数:20737 次

为什么Canvas.getGraphics()获取不到呢
用的是jdk1.7,我是java新手,
panel=new Panel();

Canvas canvas=new Canvas();
canvas.setSize(500, 500);
canvas.setBackground(Color.black);

canvas.setVisible(true);
canvas.setEnabled(true);
panel.add(canvas);
panel.setLayout(null);
Graphics gp = canvas.getGraphics();
gp.drawArc(30, 30, 30, 30, 30, 30);

------解决方案--------------------
文明一点