2011-02-06 2 views
0
에서 propertySetter에 문제가

내 JFrame의 내부에서 내가 수행 프레임 워크에서 애니메이터 클래스를 사용하려고 해요 : :색녀 리치 클라이언트 ObjectModifier

@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(); 
} 
}); 

을하지만 다음과 같은 오류가 결과로 "ObjectModifier의 propertySetter 문제 setValue:java.lang.NullPointerException의 메소드 호출 문제" 도와 주시겠습니까? 성공하지 않고도 많은 문제를 해결하기 위해 노력했습니다. (AnimatedIcon은 외부 클래스 임)

+0

예제 코드에는'});이 추가되었습니다. –

+0

어떤 라인에서이 예외가 발생합니까? –

+0

animator.start(); 예외가 throw됩니다. (예외로 인쇄되는 것이 아니라 간단한 System.out.ptint (...)로 인쇄됩니다.) –

답변

0

어때?

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(); 
+0

방금 ​​시도했지만 아무것도 변경되지 않았습니다. 같은 오류. –

+0

'PropertySetter' 클래스의 소스 코드를 읽으면'AnimatedIcon' 클래스에서'setAlpha (..)'가 누락 된 것처럼 보입니다. 해당 클래스에 API가 있음을 확인할 수 있습니까? – limc

0

모두에게 감사드립니다. 내 실수를 알았습니다. 클래스는 공개로 선언되지 않았지만 기본적으로 대신 나타납니다. 어노테이션을 사용하는 프레임 워크로 작업하고 있으며 프레임 워크가 동일한 패키지에 있지 않기 때문에 비공개 클래스는 외부의 메소드를 사용할 수 없습니다.

관련 문제