List of usage examples for javax.swing JSlider getValueIsAdjusting
public boolean getValueIsAdjusting()
From source file:RegisterChangeListenerToJSlider.java
public static void main(String[] a) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSlider framesPerSecond = new JSlider(JSlider.HORIZONTAL, 10, 100, 20); framesPerSecond.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (!source.getValueIsAdjusting()) { int fps = (int) source.getValue(); System.out.println(fps); }//from w w w . ja v a 2 s . c o m } }); frame.add(framesPerSecond, "North"); frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JSlider slider = new JSlider(); slider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { JSlider slider = (JSlider) evt.getSource(); if (!slider.getValueIsAdjusting()) { int value = slider.getValue(); System.out.println(value); }/*from www .java2 s. c om*/ } }); }
From source file:JSliderOnJOptionPane.java
static JSlider getSlider(final JOptionPane optionPane) { JSlider slider = new JSlider(); slider.setMajorTickSpacing(10);/* ww w . j a v a2 s.c o m*/ slider.setPaintTicks(true); slider.setPaintLabels(true); ChangeListener changeListener = new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { JSlider theSlider = (JSlider) changeEvent.getSource(); if (!theSlider.getValueIsAdjusting()) { optionPane.setInputValue(new Integer(theSlider.getValue())); } } }; slider.addChangeListener(changeListener); return slider; }
From source file:MessagePopup.java
public static JSlider getSlider(final JOptionPane optionPane) { JSlider slider = new JSlider(); slider.setMajorTickSpacing(10);/*from ww w .ja v a 2 s. com*/ slider.setPaintTicks(true); slider.setPaintLabels(true); ChangeListener changeListener = new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { JSlider theSlider = (JSlider) changeEvent.getSource(); if (!theSlider.getValueIsAdjusting()) { optionPane.setInputValue(new Integer(theSlider.getValue())); } } }; slider.addChangeListener(changeListener); return slider; }
From source file:BoundedChangeListener.java
public void stateChanged(ChangeEvent changeEvent) { Object source = changeEvent.getSource(); if (source instanceof BoundedRangeModel) { BoundedRangeModel aModel = (BoundedRangeModel) source; if (!aModel.getValueIsAdjusting()) { System.out.println("Changed: " + aModel.getValue()); }/* ww w . jav a2 s . com*/ } else if (source instanceof JSlider) { JSlider theJSlider = (JSlider) source; if (!theJSlider.getValueIsAdjusting()) { System.out.println("Slider changed: " + theJSlider.getValue()); } } else { System.out.println("Something changed: " + source); } }
From source file:Main.java
public void stateChanged(ChangeEvent changeEvent) { Object source = changeEvent.getSource(); if (source instanceof BoundedRangeModel) { BoundedRangeModel aModel = (BoundedRangeModel) source; if (!aModel.getValueIsAdjusting()) { System.out.println("Changed: " + aModel.getValue()); }/*w w w .j a va2 s.c o m*/ } else if (source instanceof JSlider) { JSlider theJSlider = (JSlider) source; if (!theJSlider.getValueIsAdjusting()) { System.out.println("Slider changed: " + theJSlider.getValue()); } } else if (source instanceof JProgressBar) { JProgressBar theJProgressBar = (JProgressBar) source; System.out.println("ProgressBar changed: " + theJProgressBar.getValue()); } else { System.out.println("Something changed: " + source); } }
From source file:it.unibas.spicygui.vista.listener.SliderChangeListener.java
public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (!source.getValueIsAdjusting()) { double confidence = (double) source.getValue() / 100; for (Widget connectionWidget : connectionLayer.getChildren()) { ConnectionInfo connectionInfo = (ConnectionInfo) connectionLayer .getChildConstraint(connectionWidget); if (connectionInfo != null) { if (connectionInfo.getConfidence() < confidence) { connectionWidget.setVisible(false); scene.validate();/*www . jav a2s .c om*/ } else { connectionWidget.setVisible(true); scene.validate(); } } } } }
From source file:components.SliderDemo.java
/** Listen to the slider. */ public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (!source.getValueIsAdjusting()) { int fps = (int) source.getValue(); if (fps == 0) { if (!frozen) stopAnimation();// w w w . j ava2 s. c o m } else { delay = 1000 / fps; timer.setDelay(delay); timer.setInitialDelay(delay * 10); if (frozen) startAnimation(); } } }
From source file:org.csml.tommo.sugar.modules.heatmap.MixedHeatmapDialog.java
private JSlider createMixParameterSlider() { JSlider slider = new JSlider(JSlider.VERTICAL, 0, 100, (int) (mixOperation.getParameter() * 100.0)); slider.setMajorTickSpacing(10);//from ww w.j ava 2 s . c o m slider.setSnapToTicks(true); slider.setPaintTicks(true); // slider.setPaintLabels(true); slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent event) { JSlider source = (JSlider) event.getSource(); if (!source.getValueIsAdjusting()) { double param = (double) source.getValue() / (double) 100.0; updateMixParameter(param); } } }); return slider; }
From source file:de.unibayreuth.bayeos.goat.options.JOptionDialog.java
private void jSliderShapeSizeStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSliderShapeSizeStateChanged JSlider s = (JSlider) evt.getSource(); if (!s.getValueIsAdjusting()) { pref.putInt("shapesize", s.getValue()); }/*from w ww . j a v a2s . c om*/ }