class IconProperty extends OptionalProperty<Icon> implements PropertyChangeListener {

  @NotNull
  @Override
  public Optional<Icon> get() {
    if (myComponent instanceof JLabel) {
      return Optional.ofNullable(((JLabel)myComponent).getIcon());
    }
    else if (myComponent instanceof AbstractButton) {
      return Optional.ofNullable(((AbstractButton)myComponent).getIcon());
    }
    else {
      throw new IllegalStateException("Unexpected icon component type: " + myComponent.getClass().getSimpleName());
    }
  }

  public  IconProperty(@NotNull JLabel label);
  public  IconProperty(@NotNull AbstractButton button);

}