本文整理匯總了Java中javax.swing.JSlider.getValueIsAdjusting方法的典型用法代碼示例。如果您正苦於以下問題:Java JSlider.getValueIsAdjusting方法的具體用法?Java JSlider.getValueIsAdjusting怎麽用?Java JSlider.getValueIsAdjusting使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JSlider
的用法示例。
在下文中一共展示了JSlider.getValueIsAdjusting方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: stateChanged
import javax.swing.JSlider; //導入方法依賴的package包/類
@Override
public void stateChanged(ChangeEvent e) {
JSlider source = (JSlider)e.getSource();
if (!source.getValueIsAdjusting()) {
int fps = source.getValue();
String varName = source.getName();
//regenerate data set and repaint
int i;
for( i = 1; i<vars.size();i++)
if(vars.get(i).contentEquals(varName))
break;
varsValues.set(i,rangesLeft.get(i).add(steps.get(i).multiply(new BigDecimal(fps))));
//System.out.println(i);
String chartName=FunctionToPlot;
for(int j = 1; j < vars.size();j++){
chartName = SmartReplace.get(chartName,vars.get(j),varsValues.get(j).toPlainString());
//chartName = chartName.replace(vars.get(j),varsValues.get(j).toPlainString());
sliderLabels[j-1].setText(vars.get(j)+'='+varsValues.get(j).toPlainString());
}
try{
chartP.setChart(createChart(getDataset(),chartName));
}
catch(Exception ex){
System.out.println(ex.getMessage());
}
// chartPanel = new ChartPanel(chart);
//contentPanel.repaint();
//this.repaint();
//this.setVisible(true);
}
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
示例2: stateChanged
import javax.swing.JSlider; //導入方法依賴的package包/類
@Override
public void stateChanged(ChangeEvent e) {
JSlider source = (JSlider)e.getSource();
if (!source.getValueIsAdjusting()) {
int fps = source.getValue();
String varName = source.getName();
//regenerate data set and repaint
int i;
for( i = 1; i<vars.size();i++)
if(vars.get(i).contentEquals(varName))
break;
varsValues.set(i,rangesLeft.get(i).add(steps.get(i).multiply(new BigDecimal(fps))));
//System.out.println(i);
String chartName=FunctionToPlot;
for(int j = 1; j < vars.size();j++){
chartName = SmartReplace.get(chartName,vars.get(j),varsValues.get(j).toPlainString());
//chartName = chartName.replace(vars.get(j),varsValues.get(j).toPlainString());
sliderLabels[j-1].setText(vars.get(j)+'='+varsValues.get(j).toPlainString());
}
try{
chartP.setChart(createPolarChart(getDataset(),chartName));
}
catch(Exception ex){
System.out.println(ex.getMessage());
}
// chartPanel = new ChartPanel(chart);
//contentPanel.repaint();
//this.repaint();
//this.setVisible(true);
}
}
示例3: setServo
import javax.swing.JSlider; //導入方法依賴的package包/類
void setServo (int servo,ChangeEvent evt){
if(hwInterface==null){
log.warning("interface is null");
return;
}
if ( !( evt.getSource() instanceof JSlider ) ){
log.warning("evt not from a slider: " + evt);
}
JSlider slider = (JSlider)evt.getSource();
if ( !liveSlidersEnabled && slider.getValueIsAdjusting() ){
return;
}
float f = (float)slider.getValue() / MAX_SLIDER;
if ( hwInterface == null ){
log.warning("null hardware interface");
return;
}
try{
if ( synchronizeCheckBox.isSelected() ){
setAllServos(f);
} else{
hwInterface.setServoValue(servo,f);
}
} catch ( HardwareInterfaceException e ){
e.printStackTrace();
}
}