SliderValueProperty extends IntProperty implements ChangeListener { public SliderValueProperty(@NotNull JSlider slider) { mySlider = slider; mySlider.addChangeListener(this); } SliderValueProperty(@NotNull JSlider slider); @Override void stateChanged(ChangeEvent e); @NotNull @Override Integer get();  }
@Test public void testSliderValueProperty() throws Exception { JSlider slider = new JSlider(0, 100, 50); SliderValueProperty sliderValue = new SliderValueProperty(slider); CountListener listener = new CountListener(); sliderValue.addListener(listener); assertThat(sliderValue.get()).isEqualTo(50); assertThat(listener.getCount()).isEqualTo(0); slider.setValue(90); assertThat(sliderValue.get()).isEqualTo(90); assertThat(listener.getCount()).isEqualTo(1); sliderValue.set(10); assertThat(slider.getValue()).isEqualTo(10); assertThat(listener.getCount()).isEqualTo(2); }