I was curious about a little problem I was having with updating a Graphics2D in a seperate method from the constructor or main. Pretty much I have a BufferedImage as a private Variable of the class which extends Frame/JFrame, and in the constructor I form it as a new BufferedImage with x and y dimensions.
Now I call upon a method a seperate method, which forms the Graphics2D component from the BufferedImage, and whenever I attempt to draw onto the Graphics2D I get a null pointer exception. Is there something I'm missing here?
Please paste the code here.
No worries, I figured out what I was doing wrong. Sadly it was a beginner's mistake.
But I do have another question more towards optimization. What is the fastest way to draw an Image onto a Graphics component?