What did you expect? You create a new Data with the default constructor, which takes no parameters.
So every instance variable Data has is still null.
Of cource you need to set the value's first....
Type: Posts; User: ufotje
What did you expect? You create a new Data with the default constructor, which takes no parameters.
So every instance variable Data has is still null.
Of cource you need to set the value's first....
Lol apperently not, otherwise he wouldn't have run in to that error...
--- Update ---
No offence, but if you have to ask something like this, I would start with following some basic java...
Sorry my bad it should be:
public MyMouseHandler(Data data){
...
}
class MyMouseHandler extends MouseAdapter {
private Data dt;
//Add Constructor
class MyMouseHandler(Data data){
dt = data;
}
//Add Getter
public Data...
He said classvariable so I automaticly asumed it was static, what's the point otherwise of creating a classvariable.
If he uses your solution, I would declare a private instance variable and provide...
Or don't make an instance at al and call the classvariable direct.
YourClass.variable