Package swingtree
Enum Class UI.Active
- All Implemented Interfaces:
Serializable,Comparable<UI.Active>,Constable,UIEnum<UI.Active>
- Enclosing class:
UI
A three way answer to "should this be here?":
NEVER says no whatever
happens, ALWAYS says yes whatever happens, and AS_NEEDED hands
the question on to the situation at hand.
SwingTree uses it for the scroll bar policy of a scroll pane, where the situation
is whether the content is taller or wider than the viewport. Nothing about it is
specific to scroll bars though, and decide(boolean) applies the same
three way choice to a condition of your own.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionbooleandecide(boolean needed) Answers whether the thing this policy governs should be present, given whether the situation calls for it.static UI.ActiveReturns the enum constant of this class with the specified name.static UI.Active[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NEVER
Keep the thing away, whatever the situation. -
AS_NEEDED
Let the situation decide, so the thing is there exactly when it is called for. -
ALWAYS
Keep the thing present, whatever the situation.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
decide
public boolean decide(boolean needed) Answers whether the thing this policy governs should be present, given whether the situation calls for it.NEVERandALWAYSare answers the user of your program already gave, so they ignore the argument; onlyAS_NEEDEDpasses it through. Writing the decision aspolicy == ALWAYS || neededinstead lets a runtime condition overrule aNEVERthe user asked for.
-