I have 2 class files, the first one is the main applet file and the other has the paint method in it. When I call the paint method from the main applet file, the grahics dont get drawn, the applet just goes grey.
These are my 2 files:
mainApplet.java
import javax.swing.JApplet;
public class mainApplet extends JApplet {
paintMethod paintString = new paintMethod();
public void init(){
paintString.paint(getGraphics());
}
}
paintMethod.java
import java.awt.Graphics;
import java.awt.Font;
public class paintMethod {
public void paint(Graphics g){
g.setFont(new Font("Arial", Font.BOLD, 20));
g.drawString("Hello", 5, 15);
}
}
All I manage to get is a grey screen. I know it will end up being a simple mistake that I have made. But if anyone could help, that would be great :)