• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
11 views
exception in thread "awt-eventqueue-0" java.lang.nullpointerexception
by (1.5k points)  
reshown by

1 Answer

0 votes
The variable num is invalid, and until you relegate a non-invalid an incentive to it will stay invalid. Presently there are two conceivable fixes:

1) appoint a non-invalid an incentive to num in its constructor

2) check against invalid in paintComponent:

?

super.paintComponent(page);

in the event that (num != invalid)

{

page.drawLine(50,50,50+num.real,50+num.imag);

}
by (8.9k points)  
...