@Retention(RUNTIME)
@Target({FIELD,TYPE})
@Repeatable(Options.class)
public @interface Option
The
Option annotation is used to set general information to the annotated
component. There are only a few attributes this annotation provides.
TIP: This annotation is Repeatable, so there can be multiple
definition on each component. Duplicate attributes will be overridden.
Changes since 1.1.0: Dynamic method invocation to retrieve values
for each attribute can now be used. You can simply query the UIManager
for a property.
- Since:
- 1.0
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.StringbackgroundSpecifies the background color of the annotated component.booleanenabledSpecifies whether the annotated component should be enabled or disabled after initialization.java.lang.StringforegroundSpecifies the foreground color of the annotated component.java.lang.StringinitIf the component's attributes should be changed locally in a defined method.java.lang.StringtargetThis attribute specifies the parent component the annotated component should be added to.java.lang.StringtextThe single line of text this component will display.java.lang.StringtitleThis is the title of the annotatedFramecomponent.
-
Element Details
-
target
java.lang.String targetThis attribute specifies the parent component the annotated component should be added to. The keywordthisrefers to the class object which is annotated withSwing.- Returns:
- The parent component's field name
- Default:
- ""
-
title
java.lang.String titleThis is the title of the annotatedFramecomponent.- Returns:
- the title of the frame
- Default:
- ""
-
text
java.lang.String textThe single line of text this component will display.- Returns:
- The text this component will display
- Default:
- ""
-
init
java.lang.String initIf the component's attributes should be changed locally in a defined method.It specifies a method in the same class which is called after the component has been initialized. This method takes no arguments.
- Returns:
- the target method name
- Default:
- ""
-
background
java.lang.String backgroundSpecifies the background color of the annotated component.- Returns:
- The background color name
- Default:
- ""
-
foreground
java.lang.String foregroundSpecifies the foreground color of the annotated component.- Returns:
- The foreground color name
- Default:
- ""
-
enabled
boolean enabledSpecifies whether the annotated component should be enabled or disabled after initialization.- Returns:
trueif the annotated component should be enabled;falseotherwise
- Default:
- true
-