Package swingtree.style
Class StyleTrait<C extends JComponent>
java.lang.Object
swingtree.style.StyleTrait<C>
- Type Parameters:
C
- The type ofJComponent
thisStyleTrait
is for.
A
See
Instances of this are supposed to be created and registered inside custom
StyleTrait
contains a set of properties that will be used to
target specific JComponent
s matching said properties, so that
you can associate custom Styler
lambdas with them
which are using the ComponentStyleDelegate
API
to configure the style of the component. See
StyleSheet.add(StyleTrait, Styler)
for more information. Instances of this are supposed to be created and registered inside custom
StyleSheet
extensions, more specifically a StyleSheet.configure()
implementation in which you can register your StyleTrait
s and
Styler
s using the StyleSheet.add(StyleTrait, Styler)
method.-
Method Summary
Modifier and TypeMethodDescriptionboolean
<E extends Enum<E>>
StyleTrait<C>group
(E group) Creates a newStyleTrait
with the same properties as this one, but with the given group in terms of anEnum
.Creates a newStyleTrait
with the same properties as this one, but with the given group name.int
hashCode()
<E extends Enum<E>>
StyleTrait<C>id
(E id) Creates a newStyleTrait
with the same properties as this one, but with the given id in terms of anEnum
.Creates a newStyleTrait
with the same properties as this one, but with the given id.final <E extends Enum<E>>
StyleTrait<C>inherits
(E... superGroups) Creates a newStyleTrait
with the same properties as this one, but with an array of groups to inherit from in terms ofEnum
s.Creates a newStyleTrait
with the same properties as this one, but with an array of groups to inherit from.toString()
<T extends C>
StyleTrait<T>Creates a newStyleTrait
with the same properties as this one, but with the given component type to which a style should be applied.
-
Method Details
-
group
Creates a newStyleTrait
with the same properties as this one, but with the given group name.
Note that this method defines the group in terms of aString
which can be problematic with respect to compile-time safety.
Please consider usinggroup(Enum)
instead.- Parameters:
group
- The new group name.- Returns:
- A new
StyleTrait
with the same properties as this one, but with the given group name.
-
group
Creates a newStyleTrait
with the same properties as this one, but with the given group in terms of anEnum
.- Type Parameters:
E
- The type of theEnum
to use as the group enum- Parameters:
group
- The new group in terms of anEnum
.- Returns:
- A new
StyleTrait
with the same properties as this one, but with the given group name.
-
id
Creates a newStyleTrait
with the same properties as this one, but with the given id.
Note that this method defines the id in terms of aString
which can be problematic with respect to compile-time safety.
Please consider usingid(Enum)
instead.- Parameters:
id
- The new id.- Returns:
- A new
StyleTrait
with the same properties as this one, but with the given id.
-
id
Creates a newStyleTrait
with the same properties as this one, but with the given id in terms of anEnum
.- Type Parameters:
E
- The type of theEnum
to use as the id enum- Parameters:
id
- The new id in terms of anEnum
.- Returns:
- A new
StyleTrait
with the same properties as this one, but with the given id.
-
inherits
Creates a newStyleTrait
with the same properties as this one, but with an array of groups to inherit from.
Note that this method defines the groups in terms ofString
s which can be problematic with respect to compile-time safety.
Please consider usinginherits(Enum[])
instead.- Parameters:
superGroups
- The new groups to inherit from.- Returns:
- A new
StyleTrait
with the same properties as this one, but with the given groups to inherit from.
-
inherits
Creates a newStyleTrait
with the same properties as this one, but with an array of groups to inherit from in terms ofEnum
s.- Type Parameters:
E
- The type of theEnum
s to use as the super group enums- Parameters:
superGroups
- The new groups to inherit from in terms ofEnum
s.- Returns:
- A new
StyleTrait
with the same properties as this one, but with the given groups to inherit from.
-
type
Creates a newStyleTrait
with the same properties as this one, but with the given component type to which a style should be applied.- Type Parameters:
T
- The type of theJComponent
to use as the type- Parameters:
type
- The new type.- Returns:
- A new
StyleTrait
with the same properties as this one, but with the given type.
-
toString
-
hashCode
public int hashCode() -
equals
-