Bean Visibility in Java |
Bean Visibility in Java:
The interface Visibility needs to be implemented by an advanced bean irrespective of a GUI. This interface defines methods that allow the bean to specify if it requires a GUI and it also allows the environment to notify the bean about the availability of a GUI.
So there might be two cases:
- If a Bean need GUI:
the method needsGui() returns true. If a bean is executing without a GUI,avoidingGui() should return true
- If a Bean does not need GUI:
the method needsGui() returns false. So if no GUI is available the bean is notified with dontUseGui() and if a GUI is available the bean is notified with okToUseGui() The Structure of Visibility interface is given as:
public abstract interface java.beans.Visibility {
//Methods
public abstract boolean avoidingGui();
public abstract void dontUseGui();
public abstract boolean needsGui();
public abstract void okToUseGui();
}