Here you can find the source of setMandatoryBackground(JTextComponent comp)
Parameter | Description |
---|---|
comp | the text component that shall get a new background |
public static void setMandatoryBackground(JTextComponent comp)
//package com.java2s; import java.awt.Color; import javax.swing.text.JTextComponent; public class Main { public static final Color MANDATORY_BACKGROUND = new Color(235, 235, 255); /**//from w ww. ja v a 2 s .co m * Sets the text component's background to a color that shall indicate that the component's content is mandatory. * <p> * * <strong>Note:</strong> The component background 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. * * @param comp * the text component that shall get a new background * * @see #setMandatoryBorder(JTextComponent) * @see #setErrorBackground(JTextComponent) * @see #setWarningBackground(JTextComponent) */ public static void setMandatoryBackground(JTextComponent comp) { comp.setBackground(MANDATORY_BACKGROUND); } }