Here you can find the source of getMandatoryBorder()
Border
that is used to indicate that a component's content is mandatory
public static Border getMandatoryBorder()
//package com.java2s; import java.awt.Color; import javax.swing.border.Border; import javax.swing.border.CompoundBorder; import javax.swing.border.LineBorder; import javax.swing.plaf.basic.BasicBorders; public class Main { private static final Color MANDATORY_FOREGROUND = new Color(70, 70, 210); /**//from ww w . ja va2s. c o m * Holds a cached Border that is used to indicate mandatory text components. * It will be lazily created in method {@link #getMandatoryBorder()}. * * @see #getMandatoryBorder() * @see #setMandatoryBorder(JTextComponent) */ private static Border mandatoryBorder; /** * Lazily creates and returns a {@link Border} instance that is used * to indicate that a component's content is mandatory. * * @return a <code>Border</code> that is used to indicate that * a component's content is mandatory */ public static Border getMandatoryBorder() { if (mandatoryBorder == null) { mandatoryBorder = new CompoundBorder(new LineBorder(getMandatoryForeground()), new BasicBorders.MarginBorder()); } return mandatoryBorder; } /** * Returns a default foreground color that can be used as the component * foreground for components with mandatory content. Typically this * color will be used with instances of {@link JTextComponent}.<p> * * <strong>Note:</strong> The component foreground and border colors are * managed by the look&feel implementation. Many l&fs will honor a * custom foreground color and custom border configuration. However, some * l&fs may ignore these custom settings. It is recommended to check * the appearance in all l&fs available in an application. * * @return a foreground color useful for components with mandatory content * * @see #getMandatoryBackground() * @see #getMandatoryBorder() */ public static Color getMandatoryForeground() { return MANDATORY_FOREGROUND; } }