net.java.truelicense.swing.util.ComponentEnabler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truelicense-swing Show documentation
Show all versions of truelicense-swing Show documentation
The TrueLicense Swing module provides a graphical user interface for
consuming license keys.
/*
* Copyright (C) 2005-2015 Schlichtherle IT Services.
* All rights reserved. Use is subject to license terms.
*/
package net.java.truelicense.swing.util;
import java.awt.*;
import java.io.Serializable;
import javax.annotation.concurrent.Immutable;
/**
* A proxy for enabling or disabling a {@link Component}.
*
* @since TrueLicense 2.3
* @author Christian Schlichtherle
*/
@Immutable
public abstract class ComponentEnabler implements Enabler, Serializable {
private static final long serialVersionUID = 0L;
protected abstract Component component();
public final void enable() { enabled(true); }
public final void disable() { enabled(false); }
@Override public boolean enabled() { return component().isEnabled(); }
@Override public void enabled(boolean value) { component().setEnabled(value); }
}