i am comfortable drawing on JFrame but that same code doesnt work on JApplet. i get a null pointer exception for the returned graphics object of getGraphics() method although the method is shared by both components. here is what i have.
import javax.swing.*;
public class myClass extends JApplet{
public myClass(){this.getGraphics().fillRect(10, 10, 100, 100);}
public static void main(String[] args) {new myClass();}
}
help me by correcting it please.

New Topic/Question
Reply




MultiQuote





|