저는 desktoppane과 jscrollbar가있는 netbeans 플랫폼 (netbeans 모듈)에서 데스크탑 응용 프로그램을 개발 중입니다. 내가 MouseWheelListener를를 구현하는 클래스의 생성자에서마우스 휠 리스너가 jscrollbar에서 작동하지 않습니다.
scrollBar.addMouseWheelListener(this);
을 추가했습니다.
mouse value is------------ MOUSE_WHEEL,(8,49),absolute(0,0),button=0,clickCount=0,scrollType=WHEEL_UNIT_SCROLL,scrollAmount=3,wheelRotation=1
내가 mosue 수 있도록 이제 어떻게해야 내가 마우스의 휠을 스크롤하고 때 위 SOUT의
private void scrollBarMouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
System.out.println("mouse value is------------ " + evt.paramString());
}
OUPUT에 값을 얻고 있지만 지금은 스크롤 막대를 스크롤하지 않는 것입니다 jscrollbar의 휠 이벤트?
내가 검색 한하지만 난 스크롤 이벤트를 발견하지만 난 명시 적으로 스크롤을 찾고 있어요 ..
는 내가 추가 코드를 제거하고 표시된 것을 내가 다음 샘플 코드
public final class ScrollableWindow1TopComponent extends TopComponent implements ComponentListener, MouseWheelListener {
private javax.swing.JScrollBar scrollBar;
private javax.swing.JDesktopPane scrollableGraphnewContainer;
public ScrollableWindow1TopComponent() {
this.addComponentListener(this);
scrollBar.addMouseWheelListener(this);
}
private void scrollBarMouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
System.out.println("mouse value is------------ " + evt.paramString());
}
private void scrollBarAdjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {
//code that works fine
}
}
에 의해 처리됩니다 스크롤 및 물건의 나머지의 값을 증가 있도록 음의 값을 제공하는 [sscce] (HTTP ://www.sscce.org). – user1329572
* "여기에 예제 코드가 있습니다."** 더 나은 도움을 받으려면 ** [SSCCE] (http://sscce.org/)를 게시하십시오. ** –
그리고 J2SE 클래스 이름을 올바르게 대문자로 만드십시오. 나는 내 시간이 다른 사람들을 돕는 데 더 잘 쓰일 것이라는 것을 깨달았을 때 그 엉망을 편집하려고했습니다. –