문제

I am trying to select a coordinate from a grid using JSliders. Can I make it so when it clicks one it clicks the other as well, one is vertical while the other is horizontal? So I can drag them both at once.

What I'm trying to do is set the horizontal slider based on horizontal movements of the mouse and set the vertical slider based on vertical movements of the mouse.

도움이 되었습니까?

해결책

What I'm trying to do is set the horizontal slider based on horizontal movements of the mouse and set the vertical slider based on vertical movements of the mouse.

Instead I would attach a mouse listener to the area itself, and match the x/y sliders to match the mouse co-ordinates. Of course, it would help to have the sliders also change the position, but independently of each other.

다른 팁

Yes you can do this. Simply get the value from the JSlider that's being dragged and use it to set the BoundedRangeModel of the other JSlider.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top