cmsc 0 Light Poster

I'm trying to use bufferedImage to display the bac kground of my application but i'm not successful.
I don't get what's wrong with it

here's the part of the code:

Graphics g;
BufferedImage offscreen;

offscreen= ImageIO.read(new File("mainScreen.png"));
g.drawImage(offscreen, 0, 0, null);

and i use the paintcomponent() here :

public void paintComponent(Graphics g){
	
		g.drawImage(offscreen, 0, 0, null);
	}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.