Java多拇指滑块

时间:2015-12-30 19:34:10

标签: java swing jslider rangeslider

我为this java swing range slider制作了第三个拇指 - 黄色的拇指。如果我移动第一个和第二个拇指,我会看到在向左或向右移动时jlabels中值的变化。但是第三个拇指(它有黄色并且来自我)只向最后一个值发送给jLabel2,它没有显示向右或向左移动时值的变化。如何解决这个问题,以便在运动过程中看到变化的值?

我的GitHub链接:

https://github.com/zeydbilal/RangeSliderWithThreeThumbs/blob/master/src/rangeSliderWithThreeThumbs/RangeSliderWithThreeThumbs.java

我的测试文件中的代码:

rangeSliderWithThreeThumbs1.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                rangeSliderWithThreeThumbs1StateChanged(evt);
            }
        });

private void 
rangeSliderWithThreeThumbs1StateChanged(javax.swing.event.ChangeEvent evt) {                                                         
//value from fist thumb 
   jLabel1.setText(Integer.toString(rangeSliderWithThreeThumbs1.getValue()));
//value from second thumb 
   jLabel3.setText(Integer.toString(rangeSliderWithThreeThumbs1.getUpperValue()));
//value from third thumb  
  jLabel2.setText(Integer.toString(rangeSliderWithThreeThumbs1.getSecondUpperValue()));
    } 

enter image description here

0 个答案:

没有答案