I'm trying to use the Animator class from the framework, from inside my JFrame I do:
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
Animator animator = new Animator(100);
animator.addTarget(new PropertySetter(AnimatedIcon.this, "alpha", 0.0f));
animator.setAcceleration(0.2f);
animator.setDeceleration(0.4f);
animator.start();
}
});
But as a result I get the following error:
"Problem with propertySett开发者_开发问答er in ObjectModifier
Problem invoking method in setValue:java.lang.NullPointerException
"
Please help, I tried many things to resolve it, without success.
(AnimatedIcon is an outer class)
How about this?
super.mouseClicked(e);
PropertySetter setter = new PropertySetter(AnimatedIcon.this, "alpha", 0.0f));
Animator animator = new Animator(100, setter);
animator.setAcceleration(0.2f);
animator.setDeceleration(0.4f);
animator.start();
Thanks everyone, I found out my mistake: the class was not declared as public, but as default instead. Since I'm working with framework that use annotations, and the framework is not from the same package, the non-public class did not allow to use its' methods from the outside.
精彩评论