Annotation Type Margin


@Retention(RUNTIME)
@Target(FIELD)
public @interface Margin
In order to add custom borders to a component or to change the border of a specific component this annotation is used.

Each attribute is used for a different border type. The different attributes and its context of use are described below. The implemented BorderTypes are the following:

  • EtchedBorder
  • BevelBorder
  • TitledBorder
  • LineBorder
  • CompoundBorder
  • EmptyBorder
Some attributes related to the borders are used by two or more types. For example, add a border to a simple JLabel:
  @Margin(value = TitledBorder.class, title = "some text")
  private JLabel label;
 
Since:
1.0
  • Required Element Summary

    Required Elements 
    Modifier and Type Required Element Description
    java.lang.Class<? extends javax.swing.border.Border> value  
  • Optional Element Summary

    Optional Elements 
    Modifier and Type Optional Element Description
    int bevelType  
    java.lang.Class<? extends javax.swing.border.Border> compoundInside
    This value specifies the border type which will be added to the component.
    java.lang.Class<? extends javax.swing.border.Border> compoundOutside
    This value specifies the border type which will be added to the component.
    int emptyBottom  
    int emptyLeft  
    int emptyRight  
    int emptyTop  
    int etchedType
    Declared the used etched border type.
    java.lang.String highlight  
    java.lang.String lineColor
    Retrieves the color of the border to add.
    boolean lineRounded  
    int lineThickness  
    java.lang.String shadow  
    java.lang.String title  
  • Element Details

    • value

      java.lang.Class<? extends javax.swing.border.Border> value
      Returns:
      the actual border type
    • emptyTop

      int emptyTop
      Returns:
      The top inset of the border.
      Default:
      -1
    • emptyBottom

      int emptyBottom
      Returns:
      The bottom inset of the border.
      Default:
      -1
    • emptyLeft

      int emptyLeft
      Returns:
      The left inset of the border.
      Default:
      -1
    • emptyRight

      int emptyRight
      Returns:
      The right inset of the border.
      Default:
      -1
    • title

      java.lang.String title
      Returns:
      The title the border should display.
      Default:
      ""
    • bevelType

      int bevelType
      Returns:
      The bevel type.
      Default:
      -1
    • highlight

      java.lang.String highlight
      Returns:
      The color to use for the highlight.
      Default:
      ""
    • shadow

      java.lang.String shadow
      Returns:
      The color to use for the shadow.
      Default:
      ""
    • lineColor

      java.lang.String lineColor
      Retrieves the color of the border to add. Yet, only color names are accepted. If no color is found to that name, no action will be taken.
      Returns:
      Color of the border.
      Default:
      ""
    • lineThickness

      int lineThickness
      Returns:
      Thickness of the border.
      Default:
      -1
    • lineRounded

      boolean lineRounded
      Returns:
      Whether the border has rounded corners.
      Default:
      false
    • compoundInside

      java.lang.Class<? extends javax.swing.border.Border> compoundInside
      This value specifies the border type which will be added to the component.
      Returns:
      the inside compound border
      Default:
      javax.swing.border.Border.class
    • compoundOutside

      java.lang.Class<? extends javax.swing.border.Border> compoundOutside
      This value specifies the border type which will be added to the component.
      Returns:
      the outside compound border
      Default:
      javax.swing.border.Border.class
    • etchedType

      int etchedType
      Declared the used etched border type.
      Returns:
      the EtchedBorder.getEtchType() value
      Default:
      -1