Example usage for javax.swing JComponent setBackground

List of usage examples for javax.swing JComponent setBackground

Introduction

In this page you can find the example usage for javax.swing JComponent setBackground.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The background color of the component.")
public void setBackground(Color bg) 

Source Link

Document

Sets the background color of this component.

Usage

From source file:Main.java

public static void setDelimitedColor(JComponent component, boolean selected) {
    component.setForeground(selected ? DELIMITER_BG : NORMAL_FG);
    component.setBackground(selected ? NORMAL_BG : DELIMITER_BG);
}

From source file:com.aw.swing.mvp.ui.painter.PainterMessages.java

public static void paintException(JComponent jComponent) {
    if (jComponent instanceof JComboBox) {
        LookAndFeelManager.assignRequiredPainter((JComboBox) jComponent);
    } else {//from   ww  w. j  ava 2 s  . c  om
        jComponent.setBackground(ColorInfoProvider.COLOR_ERROR);
    }

    //        jComponent.setBorder(new LineBorder(ColorInfoProvider.COLOR_BORDER_ERROR));
}

From source file:com.haulmont.cuba.desktop.gui.components.DesktopComponentsHelper.java

public static void decorateMissingValue(JComponent jComponent, boolean missingValueState) {
    jComponent.setBackground(missingValueState ? requiredBgColor : defaultBgColor);
}

From source file:MyCheckBoxUI.java

public void installUI(JComponent c) {
    super.installUI(c);
    c.setBackground(Color.red);
    c.addMouseListener(this);
}

From source file:MyCheckBoxUI.java

public void mouseEntered(MouseEvent e) {
    JComponent c = (JComponent) e.getComponent();
    c.setBackground(Color.blue);
    c.repaint();
}

From source file:MyCheckBoxUI.java

public void mouseExited(MouseEvent e) {
    JComponent c = (JComponent) e.getComponent();
    c.setBackground(Color.red);
    c.repaint();
}

From source file:org.jdal.swing.validation.BackgroundErrorProcessor.java

/**
 * {@inheritDoc}//from www . j  av a  2 s. c  o  m
 */
public void reset() {
    for (JComponent c : colorMap.keySet()) {
        c.setBackground(colorMap.get(c));
        c.setToolTipText(null);
    }
    colorMap.clear();
}

From source file:MyButtonUI.java

public void mouseReleased(MouseEvent e) {
    JComponent c = (JComponent) e.getComponent();
    c.setBorder(m_borderRaised);/*ww w.j a va 2 s.c  o  m*/
    c.setBackground(m_backgroundNormal);
}

From source file:MyButtonUI.java

public void mousePressed(MouseEvent e) {
    JComponent c = (JComponent) e.getComponent();
    c.setBorder(m_borderLowered);/* w  ww . j a v  a 2  s . c  o  m*/
    c.setBackground(m_backgroundPressed);
}

From source file:MyButtonUI.java

public void keyReleased(KeyEvent e) {
    int code = e.getKeyCode();
    if (code == KeyEvent.VK_ENTER || code == KeyEvent.VK_SPACE) {
        JComponent c = (JComponent) e.getComponent();
        c.setBorder(m_borderRaised);/*from ww w  .j av  a  2s .co m*/
        c.setBackground(m_backgroundNormal);
    }
}