I have a start method that looks something like this
void start(){
LayeredPane lp = new JLayeredPane();
lp.setvisible(true);
add(lp)
Graphics g = lp.getGraphics();
g.drawString("check", 20, 20);
}
This throws a NullPointerException, any action on lp.getGraphics returns a NullPointerException. I don't know why this is happening.
If I put the drawString inside paint(Graphics g)
everything else disappears and only the
String shows.