Example usage for javax.swing JSeparator setBackground

List of usage examples for javax.swing JSeparator setBackground

Introduction

In this page you can find the example usage for javax.swing JSeparator 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:org.openmicroscopy.shoola.agents.metadata.util.FilesetInfoDialog.java

/**
 * Sets the data to display//w  w w .  j  ava 2s.c  om
 * 
 * @param set
 *            The fileset which paths should be shown
 * @param importType
 *            The import type
 */
public void setData(Set<FilesetData> set, ImportType importType) {
    if (set == null)
        return;

    JPanel content = new JPanel();
    content.setLayout(new GridBagLayout());
    content.setBackground(UIUtilities.BACKGROUND_COLOR);

    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHEAST;

    if (CollectionUtils.isEmpty(set)) {
        JLabel l = new JLabel("No information available.");
        l.setBackground(UIUtilities.BACKGROUND_COLOR);
        content.add(l, c);
    } else {
        int size = 0;
        FilesetData fsd = set.iterator().next();
        if (Fileset.class.isAssignableFrom(fsd.asIObject().getClass())) {
            size = ((Fileset) fsd.asIObject()).sizeOfUsedFiles();
        }
        String txt = size <= 1 ? "Image file" : "Image files";
        JLabel l = new JLabel(size + " " + txt);
        l.setBackground(UIUtilities.BACKGROUND_COLOR);
        content.add(l, c);
        c.gridy++;

        JSeparator sep = new JSeparator(JSeparator.HORIZONTAL);
        sep.setBackground(UIUtilities.BACKGROUND_COLOR);
        content.add(sep, c);
        c.gridy++;

        String header = (importType == ImportType.HARDLINK || importType == ImportType.SOFTLINK)
                ? "Imported with <b>--transfer=" + importType.getSymbol() + "</b> from:"
                : "Imported from:";

        ExpandableTextPane t1 = new ExpandableTextPane();
        t1.setBackground(UIUtilities.BACKGROUND_COLOR);
        t1.setText(header + "<br/>" + getOriginPaths(set));
        content.add(t1, c);
        c.gridy++;

        JSeparator sep2 = new JSeparator(JSeparator.HORIZONTAL);
        sep2.setBackground(UIUtilities.BACKGROUND_COLOR);
        content.add(sep2, c);
        c.gridy++;

        ExpandableTextPane t2 = new ExpandableTextPane();
        t2.setBackground(UIUtilities.BACKGROUND_COLOR);
        t2.setText("Path on server:<br/>" + getServerPaths(set));
        content.add(t2, c);

    }

    setCanvas(new JScrollPane(content));
}

From source file:org.ut.biolab.medsavant.client.view.UpdatesPanel.java

private JSeparator createSeparator() {
    JSeparator sep = new JSeparator(JSeparator.HORIZONTAL);
    sep.setMaximumSize(new Dimension(1000, 1));
    sep.setBackground(Color.WHITE);
    sep.setForeground(Color.LIGHT_GRAY);
    return sep;//from   ww  w  .jav  a2 s. c om
}