提示出错,Cannot make a static reference to the non-static method getGraphics() from the type JFrame。如果直接定义Graohics g=new Graphisc()时候又提示Cannot instantiate the type Graphics 怎么解决,急,想要用drawLine方法但是不能用啊
怎么实现pant方法,用g还是用JFrame的对象?
追答public class TestMain extends JFrame {Graphics g=null;
g.setColor(Color.BLACK);
g.fillRect(0, 0, j.getWidth(), j.getHeight());
为什么我这么写运行后什么都没有了
你确定你这代码没有报空指针?