Package swingtree
Enum Class UI.ComponentArea
- All Implemented Interfaces:
Serializable,Comparable<UI.ComponentArea>,Constable,UIEnum<UI.ComponentArea>
- Enclosing class:
UI
@Immutable
public static enum UI.ComponentArea
extends Enum<UI.ComponentArea>
implements UIEnum<UI.ComponentArea>
Names a region of a styled component. A style lays a component out as three nested
rings: the margin holds the outermost ring, the border width the next one, and what
the border leaves over is the innermost region. This enum names those three, and
two more which are unions of them.
Pass one to ImageConf.clipTo(swingtree.UI.ComponentArea) to clip an image to
a region, to ComponentStyleDelegate.painter(Layer, ComponentArea, Painter)
to confine your own painting to it, or to
UIForAnySwing.onMouseEnter(ComponentArea, Action) to be told when the cursor
reaches it, all as part of the style API (see UIForAnySwing.withStyle(Styler)).
The following list describes what each enum instance represents:
EXTERIOR- The ring the margin leaves around everything else.BORDER- The ring the border width fills, between the exterior and the interior.INTERIOR- Everything the border leaves over, which isALL - EXTERIOR - BORDER.BODY- The border and the interior together, which isALL - EXTERIOR.ALL- The whole component, which isEXTERIOR + BORDER + INTERIOR.
contains(ComponentArea) spells those unions out, and
outerBoundary() names the UI.ComponentBoundary an area starts at.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe ring the margin leaves around everything else. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(UI.ComponentArea other) Returns the boundary line this area starts at, coming from the outside in.static UI.ComponentAreaReturns the enum constant of this class with the specified name.static UI.ComponentArea[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ALL
-
EXTERIOR
The ring the margin leaves around everything else. -
BORDER
-
INTERIOR
-
BODY
-
-
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
-
outerBoundary
Returns the boundary line this area starts at, coming from the outside in.ALLandEXTERIORboth start at the outer edge of the component,BORDERandBODYboth start where the margin ends, andINTERIORstarts where the border ends.Two areas can share one boundary, so this is not the inverse of
UI.ComponentBoundary.wrappedArea():UI.ComponentBoundary.OUTER_TO_EXTERIORis the answer for bothALLandEXTERIOR, and going back from it answersALL. OnlyALL,BODYandINTERIORsurvive the round trip.- Returns:
- The
UI.ComponentBoundarythat tightly wraps this area.
-
contains
Tells whether this area covers every pixel the given area covers, which spells out the set algebra the constants of this enum are defined by:ALLcovers all of them,BODYcoversBORDERandINTERIOR, and the three remaining areas cover only themselves, because they do not overlap.- Parameters:
other- The area to test for being covered by this one.- Returns:
- True if every pixel of
otheralso belongs to this area.
-