Java JTextComponent setWarningBackground(JTextComponent comp)

Here you can find the source of setWarningBackground(JTextComponent comp)

Description

Sets the text component's background to a color that shall indicate that the component's content is invalid with warning severity.

Note: The component background colors are managed by the look&feel implementation.

License

Open Source License

Parameter

Parameter Description
comp the text component that shall get a new background

Declaration

public static void setWarningBackground(JTextComponent comp) 

Method Source Code


//package com.java2s;
import java.awt.Color;

import javax.swing.text.JTextComponent;

public class Main {
    private static final Color WARNING_BACKGROUND = new Color(255, 235, 205);

    /**/*  w ww .ja va 2  s.  co m*/
     * Sets the text component's background to a color that shall indicate
     * that the component's content is invalid with warning severity.<p>
     * 
     * <strong>Note:</strong> The component background colors are 
     * managed by the look&amp;feel implementation. Many l&amp;fs will honor a
     * custom foreground color and custom border configuration. However, some 
     * l&amp;fs may ignore these custom settings. It is recommended to check
     * the appearance in all l&amp;fs available in an application.
     * 
     * @param comp   the text component that shall get a new background
     * 
     * @see #setMandatoryBackground(JTextComponent)
     * @see #setErrorBackground(JTextComponent)
     */
    public static void setWarningBackground(JTextComponent comp) {
        comp.setBackground(WARNING_BACKGROUND);
    }
}

Related

  1. setTextComponentTransparent( JTextComponent paramJTextComponent)
  2. setTextComponentTransparent( JTextComponent textComponent)
  3. setTextComponentTransparent( JTextComponent textComponent)
  4. setTextComponetIntegerValid(final JTextComponent c)
  5. setTextStyle(JTextComponent txt)
  6. textComponentAsLabel(JTextComponent textcomponent)
  7. value(JTextComponent txt)