本文整理了Java中javax.swing.JSlider.getMousePosition()
方法的一些代码示例,展示了JSlider.getMousePosition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSlider.getMousePosition()
方法的具体详情如下:
包路径:javax.swing.JSlider
类名称:JSlider
方法名:getMousePosition
暂无
代码示例来源:origin: stackoverflow.com
JSlider slider = new JSlider(JSlider.HORIZONTAL);
slider.setUI(new MetalSliderUI() {
protected void scrollDueToClickInTrack(int direction) {
// this is the default behaviour, let's comment that out
//scrollByBlock(direction);
int value = slider.getValue();
if (slider.getOrientation() == JSlider.HORIZONTAL) {
value = this.valueForXPosition(slider.getMousePosition().x);
} else if (slider.getOrientation() == JSlider.VERTICAL) {
value = this.valueForYPosition(slider.getMousePosition().y);
}
slider.setValue(value);
}
});
代码示例来源:origin: khuxtable/seaglass
thumbRect.y = valuePosition - (thumbRect.height / 2);
Point mousePosition = slider.getMousePosition();
if (mousePosition != null) {
updateThumbState(mousePosition.x, mousePosition.y);
内容来源于网络,如有侵权,请联系作者删除!