Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用从网格中选择坐标JSliders。我可以让它在单击一个时也单击另一个,一个是垂直的,另一个是水平的?所以我可以同时拖动它们。
JSliders
我要做的是根据鼠标的水平移动设置水平滑块,并根据鼠标的垂直移动设置垂直滑块。
是的,你可以这样做。只需从被拖动的 JSlider 中获取值,并使用它来设置另一个 JSlider 的 BoundedRangeModel。
相反,我会将鼠标侦听器附加到该区域本身,并匹配 x/y 滑块以匹配鼠标坐标。当然,让滑块也改变位置会有所帮助,但彼此独立。