Annotation Type Option


@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.String background
    Specifies the background color of the annotated component.
    boolean enabled
    Specifies whether the annotated component should be enabled or disabled after initialization.
    java.lang.String foreground
    Specifies the foreground color of the annotated component.
    java.lang.String init
    If the component's attributes should be changed locally in a defined method.
    java.lang.String target
    This attribute specifies the parent component the annotated component should be added to.
    java.lang.String text
    The single line of text this component will display.
    java.lang.String title
    This is the title of the annotated Frame component.
  • Element Details

    • target

      java.lang.String target
      This attribute specifies the parent component the annotated component should be added to. The keyword this refers to the class object which is annotated with Swing.
      Returns:
      The parent component's field name
      Default:
      ""
    • title

      java.lang.String title
      This is the title of the annotated Frame component.
      Returns:
      the title of the frame
      Default:
      ""
    • text

      java.lang.String text
      The single line of text this component will display.
      Returns:
      The text this component will display
      Default:
      ""
    • init

      java.lang.String init
      If 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 background
      Specifies the background color of the annotated component.
      Returns:
      The background color name
      Default:
      ""
    • foreground

      java.lang.String foreground
      Specifies the foreground color of the annotated component.
      Returns:
      The foreground color name
      Default:
      ""
    • enabled

      boolean enabled
      Specifies whether the annotated component should be enabled or disabled after initialization.
      Returns:
      true if the annotated component should be enabled; false otherwise
      Default:
      true