EnabledProperty extends BoolProperty implements PropertyChangeListener { public EnabledProperty(@NotNull JComponent component) { myComponent = component; myComponent.addPropertyChangeListener("enabled", this); } EnabledProperty(@NotNull JComponent component); @Override void propertyChange(PropertyChangeEvent propertyChangeEvent); @NotNull @Override Boolean get();  }
@Test public void testEnabledProperty() { JButton button = new JButton(); EnabledProperty enabledProperty = new EnabledProperty(button); CountListener listener = new CountListener(); enabledProperty.addListener(listener); assertThat(enabledProperty.get()).isTrue(); assertThat(listener.getCount()).isEqualTo(0); button.setEnabled(false); assertThat(enabledProperty.get()).isFalse(); assertThat(listener.getCount()).isEqualTo(1); enabledProperty.set(true); assertThat(button.isEnabled()).isTrue(); assertThat(listener.getCount()).isEqualTo(2); }