⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e795. getting and setting the values of a jslider component.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
// To create a slider, see e794 Creating a JSlider Component
    
    // Get the current value
    int value = slider.getValue();
    
    // Get the minimum value
    int min = slider.getMinimum();
    
    // Get the maximum value
    int max = slider.getMaximum();
    
    // Get the extent
    int extent = slider.getExtent();
    // Change the minimum value
    int newMin = 0;
    slider.setMinimum(newMin);
    
    // Change the maximum value
    int newMax = 256;
    slider.setMaximum(newMax);
    
    // Set the value; the new value will be forced into the bar's range
    int newValue = 33;
    slider.setValue(newValue);
    
    // Set the extent
    int newExtent = 10;
    slider.setExtent(newExtent);

It is also possible to set all the values at once by using the model: 
    slider.getModel().setRangeProperties(newValue, newExtent, newMin, newMax, false);


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -