Package swingtree.style
Class StyleTrait<C extends JComponent>
java.lang.Object
swingtree.style.StyleTrait<C>
- Type Parameters:
C- The type ofJComponentthisStyleTraitis 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 JComponents 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 StyleTraits and
Stylers using the StyleSheet.add(StyleTrait, Styler) method.-
Method Summary
Modifier and TypeMethodDescriptionboolean<E extends Enum<E>>
StyleTrait<C> group(E group) Creates a newStyleTraitwith the same properties as this one, but with the given group in terms of anEnum.Creates a newStyleTraitwith the same properties as this one, but with the given group name.inthashCode()<E extends Enum<E>>
StyleTrait<C> id(E id) Creates a newStyleTraitwith the same properties as this one, but with the given id in terms of anEnum.Creates a newStyleTraitwith the same properties as this one, but with the given id.final <E extends Enum<E>>
StyleTrait<C> inherits(E... superGroups) Creates a newStyleTraitwith the same properties as this one, but with an array of groups to inherit from in terms ofEnums.Creates a newStyleTraitwith the same properties as this one, but with an array of groups to inherit from.toString()<T extends C>
StyleTrait<T> Creates a newStyleTraitwith the same properties as this one, but with the given component type to which a style should be applied.
-
Method Details
-
group
Creates a newStyleTraitwith the same properties as this one, but with the given group name.
Note that this method defines the group in terms of aStringwhich can be problematic with respect to compile-time safety.
Please consider usinggroup(Enum)instead.- Parameters:
group- The new group name.- Returns:
- A new
StyleTraitwith the same properties as this one, but with the given group name.
-
group
Creates a newStyleTraitwith the same properties as this one, but with the given group in terms of anEnum.- Type Parameters:
E- The type of theEnumto use as the group enum- Parameters:
group- The new group in terms of anEnum.- Returns:
- A new
StyleTraitwith the same properties as this one, but with the given group name.
-
id
Creates a newStyleTraitwith the same properties as this one, but with the given id.
Note that this method defines the id in terms of aStringwhich can be problematic with respect to compile-time safety.
Please consider usingid(Enum)instead.- Parameters:
id- The new id.- Returns:
- A new
StyleTraitwith the same properties as this one, but with the given id.
-
id
Creates a newStyleTraitwith the same properties as this one, but with the given id in terms of anEnum.- Type Parameters:
E- The type of theEnumto use as the id enum- Parameters:
id- The new id in terms of anEnum.- Returns:
- A new
StyleTraitwith the same properties as this one, but with the given id.
-
inherits
Creates a newStyleTraitwith the same properties as this one, but with an array of groups to inherit from.
Note that this method defines the groups in terms ofStrings 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
StyleTraitwith the same properties as this one, but with the given groups to inherit from.
-
inherits
Creates a newStyleTraitwith the same properties as this one, but with an array of groups to inherit from in terms ofEnums.- Type Parameters:
E- The type of theEnums to use as the super group enums- Parameters:
superGroups- The new groups to inherit from in terms ofEnums.- Returns:
- A new
StyleTraitwith the same properties as this one, but with the given groups to inherit from.
-
type
Creates a newStyleTraitwith 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 theJComponentto use as the type- Parameters:
type- The new type.- Returns:
- A new
StyleTraitwith the same properties as this one, but with the given type.
-
toString
-
hashCode
public int hashCode() -
equals
-