Example usage for java.awt Container getBackground

List of usage examples for java.awt Container getBackground

Introduction

In this page you can find the example usage for java.awt Container getBackground.

Prototype

@Transient
public Color getBackground() 

Source Link

Document

Gets the background color of this component.

Usage

From source file:net.sourceforge.msscodefactory.cflib.v1_11.CFLib.Swing.CFJEditorPane.java

public void setEnabled(boolean value) {
    super.setEnabled(value);
    if (value) {// w w w.  ja v a  2  s  .c om
        setBackground(Color.WHITE);
    } else {
        Container cont = getParent();
        if (cont != null) {
            setBackground(cont.getBackground());
        }
    }
    setForeground(Color.BLACK);
    setDisabledTextColor(Color.BLACK);
}

From source file:net.sourceforge.msscodefactory.cflib.v1_11.CFLib.Swing.CFJReferenceEditor.java

public void setEnabled(boolean value) {
    super.setEnabled(value);
    JTextField textField = getTextFieldQualifiedName();
    if (textField != null) {
        textField.setEnabled(false);/*  ww w. j a  va  2  s .c  o  m*/
        if (value) {
            textField.setBackground(Color.WHITE);
        } else {
            Container cont = getParent();
            if (cont != null) {
                textField.setBackground(cont.getBackground());
            }
        }
        textField.setForeground(Color.BLACK);
        textField.setDisabledTextColor(Color.BLACK);
    }
    JButton button = getButtonPickReference();
    if (button != null) {
        button.setEnabled(value);
    }
    button = getButtonViewReference();
    if (button != null) {
        button.setEnabled(true);
    }
}

From source file:org.apache.cayenne.modeler.dialog.ErrorDebugDialog.java

protected void init() {
    setResizable(false);//from  w ww  .ja va 2 s  .c  om

    Container pane = this.getContentPane();
    pane.setLayout(new BorderLayout());

    // info area
    JEditorPane infoText = new JEditorPane("text/html", infoHTML());
    infoText.setBackground(pane.getBackground());
    infoText.setEditable(false);
    // popup hyperlinks
    infoText.addHyperlinkListener(this);

    JPanel infoPanel = new JPanel();
    infoPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    infoPanel.add(infoText);
    pane.add(infoPanel, BorderLayout.NORTH);

    // exception area
    if (throwable != null) {
        exText.setEditable(false);
        exText.setLineWrap(true);
        exText.setWrapStyleWord(true);
        exText.setRows(16);
        exText.setColumns(40);
        JScrollPane exScroll = new JScrollPane(exText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        exPanel = new JPanel();
        exPanel.setLayout(new BorderLayout());
        exPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        exPanel.add(exScroll, BorderLayout.CENTER);

        // buttons
        showHide = new JButton("");
        showHide.addActionListener(this);
        if (isDetailed()) {
            showDetails();
        } else {
            hideDetails();
        }
    }

    close = new JButton("Close");
    close.addActionListener(this);

    JButton[] buttons = (showHide != null) ? new JButton[] { showHide, close } : new JButton[] { close };
    pane.add(PanelFactory.createButtonPanel(buttons), BorderLayout.SOUTH);

    //add a listener to clear static variables, not to produce garbage
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            instance = null;
        }
    });

    // prepare to display
    this.pack();
    this.centerWindow();
}