Java help

JosephC

Paragon
Joined
Aug 22, 2009
Messages
1,703
Reaction score
1
FP$
599
Hi, I need a bit of help with Java. I instantiated my class using

private BGPanel bgp;
this.bgp = bgp;

but then when I try to print out bgp (or call any methods within it) it's null.

This has worked for me before but for some reason it wont allow me to do it now.
 
its been a while since i used java but you need to instantiate your instance by using
bgp = new BGPanel();

if your contructor takes arguments, you can pass stuff along to it like

bgp = new BGPanel(parameters);
then you can do

this.bgp = bgp; in your constructor
 
Back
Top Bottom