My program is supposed to draw a simple line on the Swing generated panel. Everything else is fine except the one error produced by the drawLine command. This is my code:
public static void main(String[] args) {
JFrame f = new JFrame("Swing Paint Demo");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setVisible(true);
Graphics.drawLine(20,20,20,20);
}
}
It produces the error: Cannot make a static reference to the non-static method drawLine(int, int, int, int) from the type Graphics.
Any ideas?
Thanks in advance