Code example for JSlider

Methods: addChangeListener

0
		registerPressureSlider(view);
	} 
 
	private void registerPressureSlider(final PressureView view) {
		final JSlider pressureSlider = view.getPressureSlider();
		pressureSlider.addChangeListener(new ChangeListener() {
			@Override 
			public void stateChanged(ChangeEvent arg0) {
				setPressure((double) pressureSlider.getValue() / 100);
			} 
		}); 
	} 
 
	protected void setPressure(double value) {
		final PressureModel model = (PressureModel) mSensorModel;
		final PressureView view = (PressureView) mSensorView;
		if (model.getReadPressure() != value) {
			model.setPressure(value);
			view.setPressure(value);
		} 
Experience pair programming with AI  Get Codota for Java