Java JComboBox setErrorBackground(JComboBox comp)

Here you can find the source of setErrorBackground(JComboBox comp)

Description

set Error Background

License

Open Source License

Declaration

public static void setErrorBackground(JComboBox comp) 

Method Source Code


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

import javax.swing.JComboBox;

import javax.swing.JLabel;
import javax.swing.JList;

import javax.swing.text.JTextComponent;

public class Main {
    public static final Color ERROR_BACKGROUND = new Color(255, 215, 215);

    /**/*  www.j  a  v  a  2  s  .  c  om*/
     * Sets the text component's background to a color that shall indicate that the component's content has is invalid with error 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 #setWarningBackground(JTextComponent)
     */
    public static void setErrorBackground(JTextComponent comp) {
        comp.setBackground(ERROR_BACKGROUND);
    }

    public static void setErrorBackground(JComboBox comp) {
        comp.setBackground(ERROR_BACKGROUND);
    }

    public static void setErrorBackground(JList comp) {
        comp.setBackground(ERROR_BACKGROUND);
    }

    public static void setErrorBackground(JLabel comp) {
        comp.setBackground(ERROR_BACKGROUND);
    }
}

Related

  1. removeAllListeners(JComboBox box)
  2. resetComboBoxInfo(JComboBox jComboBoxField, ArrayList comboBoxArray, String expression)
  3. resetPhaseBox(JComboBox phaseBox)
  4. setColorMenu(JComboBox choice)
  5. setComboBoxTheme(JComboBox comboBox)
  6. setJComboBoxAsHeavyweight(JComboBox combo)
  7. setPopupComboChoices(JComboBox aComboBox, String aS)
  8. setShouldUseAlternSdk(boolean shouldUse, final JCheckBox useAlternativeSdkCB, final JComboBox alternativeSdksComboBox, final JComboBox myModulesComboBox)
  9. setupComboBoxMaxRows( T inComboBox)