Example usage for java.awt Component setBackground

List of usage examples for java.awt Component setBackground

Introduction

In this page you can find the example usage for java.awt Component setBackground.

Prototype

public void setBackground(Color c) 

Source Link

Document

Sets the background color of this component.

Usage

From source file:edu.ku.brc.specify.plugins.sgr.SGRResultsDisplay.java

private JTable createTable(DefaultTableModel resultsTableModel, final List<List<Color>> rowColors) {
    JTable table = new JTable(resultsTableModel) {
        public Component prepareRenderer(TableCellRenderer renderer, int rowIndex, int colIndex) {
            Component c = super.prepareRenderer(renderer, rowIndex, colIndex);

            final Color bgColor = isCellSelected(rowIndex, colIndex) ? getSelectionBackground()
                    : rowColors.get(rowIndex).get(colIndex);

            c.setBackground(bgColor);
            return c;
        }//from   ww w  .ja  va  2s .  c o m
    };

    DefaultTableCellRenderer tcr = getTableCellRenderer();//model.getRowInfoList());
    for (int i = 0; i < resultsTableModel.getColumnCount(); i++) {
        if (resultsTableModel.getColumnClass(i) != Boolean.class) {
            table.setDefaultRenderer(resultsTableModel.getColumnClass(i), tcr);
        }
    }

    table.setCellSelectionEnabled(true);

    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    UIHelper.makeTableHeadersCentered(table, false);
    table.setDefaultRenderer(String.class, new BiColorTableCellRenderer(false));
    table.setRowHeight(ROW_HEIGHT);

    autoResizeColWidth(table, resultsTableModel);
    return table;
}

From source file:ecosim.gui.SummaryPane.java

/**
 *  Private method to build the table pane.
 *
 *  @return A JLayeredPane containing the table pane.
 *///  ww w  .j  a va2 s. c o m
private JLayeredPane makeTablePane() {
    String[] columnNames = { "", "Estimate", "Hillclimbing", "Low", "High" };
    Integer[] columnWidths = { 250, 60, 60, 60, 60 };
    Object[][] rowData = { { "Number of putative ecotypes (npop)", null, null, null, null },
            { "Rate of ecotype formation (omega)", null, null, null, null },
            { "Rate of periodic selection (sigma)", null, null, null, null } };
    final JLayeredPane pane = new JLayeredPane();
    final JTable table = new JTable(rowData, columnNames) {
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };
    final JTableHeader header = table.getTableHeader();
    pane.setLayout(new BorderLayout());
    header.setReorderingAllowed(false);
    TableColumnModel cm = table.getColumnModel();
    for (int i = 0; i < columnWidths.length; i++) {
        TableColumn column = cm.getColumn(i);
        column.setMinWidth(columnWidths[i]);
        if (i == 0) {
            column.setCellRenderer(new DefaultTableCellRenderer() {
                public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                        boolean hasFocus, int row, int column) {
                    Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus,
                            row, column);
                    cell.setBackground(header.getBackground());
                    cell.setForeground(header.getForeground());
                    return cell;
                }
            });
        }
    }
    pane.add(table.getTableHeader(), "North");
    pane.add(table, "Center");
    // Watch for changes to the Summary object.
    summary.addObserver(new Observer() {
        public void update(Observable o, Object obj) {
            Summary s = (Summary) obj;
            ParameterEstimate estimate = s.getEstimate();
            ParameterSet hillclimbing = s.getHillclimbing();
            ParameterSet[] ci = s.getConfidenceInterval();
            if (estimate != null) {
                ParameterSet e = estimate.getResult();
                table.setValueAt(e.getNpop(), 0, 1);
                table.setValueAt(String.format("%.4f", e.getOmega()), 1, 1);
                table.setValueAt(String.format("%.4f", e.getSigma()), 2, 1);
            }
            if (hillclimbing != null) {
                table.setValueAt(hillclimbing.getNpop(), 0, 2);
                table.setValueAt(String.format("%.4f", hillclimbing.getOmega()), 1, 2);
                table.setValueAt(String.format("%.4f", hillclimbing.getSigma()), 2, 2);
            }
            if (ci[0].getNpop() != null) {
                table.setValueAt(ci[0].getNpop(), 0, 3);
                table.setValueAt(ci[1].getNpop(), 0, 4);
            }
            if (ci[1].getOmega() != null) {
                table.setValueAt(String.format("%.4f", ci[0].getOmega()), 1, 3);

                String fmt = "%.4f";
                if (ci[1].getOmega() > 10.0D) {
                    fmt = "%.1f";
                } else if (ci[1].getOmega() > 1.0D) {
                    fmt = "%.2f";
                }
                table.setValueAt(String.format(fmt, ci[1].getOmega()), 1, 4);
            }
            if (ci[1].getSigma() != null) {
                table.setValueAt(String.format("%.4f", ci[0].getSigma()), 2, 3);
                if (ci[1].getSigma() > 100.0D - MasterVariables.EPSILON) {
                    table.setValueAt("100", 2, 4);
                } else {
                    String fmt = "%.4f";
                    if (ci[1].getSigma() > 10.0D) {
                        fmt = "%.1f";
                    } else if (ci[1].getSigma() > 1.0D) {
                        fmt = "%.2f";
                    }
                    table.setValueAt(String.format(fmt, ci[1].getSigma()), 2, 4);
                }
            }
            pane.repaint();
        }
    });
    return pane;
}

From source file:org.datacleaner.widgets.DCFileChooser.java

private void setContainerBackground(Component component, Color bg) {
    if (component instanceof Container) {
        Container c = (Container) component;
        // drill further down the tree
        Component child = c.getComponent(0);
        if (child instanceof Container) {
            Container childContainer = (Container) child;
            if (childContainer.getComponentCount() == 1) {
                setContainerBackground(childContainer, bg);
            }/*ww w.  j  a v a 2 s . com*/
        }
    }
    component.setBackground(bg);
}

From source file:edu.ku.brc.af.ui.forms.CarryForwardConfigDlg.java

@Override
public void createUI() {
    super.createUI();

    buildTableModel(mvParent);//from  w  w  w. ja va 2 s.  c o  m

    model = new CFTableModel();
    table = new JTable(model) {
        //  Returning the Class of each column will allow different
        //  renderers to be used based on Class
        public Class<?> getColumnClass(int column) {
            return getValueAt(0, column).getClass();
        }

        public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
            Component c = super.prepareRenderer(renderer, row, column);
            if (!c.getBackground().equals(getSelectionBackground())) {
                CFWItem item = items.get(row);
                c.setBackground(item.getColor());
            }
            return c;
        }
    };

    UIHelper.makeTableHeadersCentered(table, false);

    //((DefaultTableCellRenderer)table.getColumnModel().getColumn(1).getCellRenderer()).setHorizontalAlignment(SwingConstants.CENTER);

    JScrollPane sp = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    contentPanel = sp;//new JPanel(new BorderLayout()));
    mainPanel.add(contentPanel, BorderLayout.CENTER);
}

From source file:EvenOddRenderer.java

public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    Component renderer = DEFAULT_RENDERER.getTableCellRendererComponent(table, value, isSelected, hasFocus, row,
            column);/*from ww  w.  j a  v a2  s  . co  m*/
    Color foreground, background;
    if (isSelected) {
        foreground = Color.YELLOW;
        background = Color.GREEN;
    } else {
        if (row % 2 == 0) {
            foreground = Color.BLUE;
            background = Color.WHITE;
        } else {
            foreground = Color.WHITE;
            background = Color.BLUE;
        }
    }
    renderer.setForeground(foreground);
    renderer.setBackground(background);
    return renderer;
}

From source file:RendererSample.java

public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    Component renderer = DEFAULT_RENDERER.getTableCellRendererComponent(table, value, isSelected, hasFocus, row,
            column);//from w w  w  .j a va 2 s. c o  m
    ((JLabel) renderer).setOpaque(true);
    Color foreground, background;
    if (isSelected) {
        foreground = Color.yellow;
        background = Color.green;
    } else {
        if (row % 2 == 0) {
            foreground = Color.blue;
            background = Color.white;
        } else {
            foreground = Color.white;
            background = Color.blue;
        }
    }
    renderer.setForeground(foreground);
    renderer.setBackground(background);
    return renderer;
}

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

public ListViewTablePanel(Object[][] data, String[] columnNames, Class[] columnClasses, int[] hiddenColumns,
        boolean allowSearch, boolean allowSort, boolean allowPages, boolean allowSelection) {

    this.hiddenColumns = hiddenColumns;
    table = new SortableTable() {
        @Override//w  w w.  ja v a2s  . c om
        public Component prepareRenderer(TableCellRenderer renderer, int Index_row, int Index_col) {
            Component comp = super.prepareRenderer(renderer, Index_row, Index_col);
            //even index, selected or not selected

            if (isRowSelected(Index_row)) {
                comp.setBackground(ViewUtil.detailSelectedBackground);
            } else {
                if (Index_row % 2 == 0) {
                    comp.setBackground(evenRowColor);
                } else {
                    comp.setBackground(oddRowColor);
                }
            }
            comp.setForeground(ViewUtil.detailForeground);

            comp.setFont(comp.getFont().deriveFont(fontSize));

            return comp;
        }
    };

    table.setBorder(null);
    table.setSelectionForeground(Color.darkGray);
    table.setRowHeight(30);
    table.setClearSelectionOnTableDataChanges(true);
    table.setOptimized(true);
    table.setColumnAutoResizable(true);
    table.setAutoResort(false);
    //table.setDragEnabled(false);
    //table.setRowHeight(20);
    table.setSortable(allowSort);
    table.setSortingEnabled(allowSort);
    table.setFocusable(allowSelection);
    table.setCellSelectionEnabled(allowSelection);
    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    table.setAutoResizeMode(SortableTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);

    //table.setMinimumSize(new Dimension(500,999));
    //table.setPreferredSize(new Dimension(500,999));

    //column chooser
    TableHeaderPopupMenuInstaller installer = new TableHeaderPopupMenuInstaller(table);
    installer.addTableHeaderPopupMenuCustomizer(new AutoResizePopupMenuCustomizer());
    columnChooser = new ColumnChooser(table);
    installer.addTableHeaderPopupMenuCustomizer(columnChooser);

    AutoFilterTableHeader header = new AutoFilterTableHeader(table);
    header.setAutoFilterEnabled(true);
    header.setShowFilterIcon(true);
    header.setShowFilterName(true);
    table.setTableHeader(header);

    filterField = new QuickTableFilterField(model);
    filterField.setHintText("Type to search");

    setLayout(new BorderLayout(3, 3));
    fieldPanel = ViewUtil.getClearPanel();
    fieldPanel.setLayout(new GridBagLayout());
    setOpaque(false);

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.weightx = 1.0;
    //gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.fill = GridBagConstraints.BOTH;
    if (allowSearch) {
        fieldPanel.add(filterField, gbc);
    }
    if (columnNames.length > 1) {
        JButton chooseColumnButton = new JButton("Fields");
        chooseColumnButton.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseReleased(MouseEvent e) {
                columnChooser.showDialog();
            }
        });
        gbc.weightx = 0.0;
        gbc.fill = GridBagConstraints.NONE;
        fieldPanel.add(chooseColumnButton, gbc);
    }

    setTableModel(data, columnNames, columnClasses);

    if (allowSort) {
        add(fieldPanel, BorderLayout.NORTH);
    }

    JScrollPane jsp = new JScrollPane(table);
    jsp.setBorder(null);
    add(jsp, BorderLayout.CENTER);

    updateData(data);
    updateView();
}

From source file:hermes.browser.components.WatchTable.java

/**
 * Rows are: Color.RED if an alert level has been breached. Color.ORANGE if
 * an exception has occured gathering the data
 */// w w w. j a  v  a  2 s.c  o  m
public Component prepareRenderer(TableCellRenderer renderer, int y, int x) {
    final Component rval = super.prepareRenderer(renderer, y, x);
    final int originalY = y;
    y = getActualRowAt(y);

    final WatchInfo info = watchModel.getRow(y);
    Component c = null;

    /*
     * I don't understand this bit - unless I get the actual renderer when the
     * component is an ExpandablePanel the first column shades incorrectly.
     */

    if (rval instanceof ExpandablePanel) {
        ExpandablePanel ep = (ExpandablePanel) rval;
        c = ep.getActualRenderer();
    } else {
        c = rval;
    }

    boolean previousInAlert = info.isInAlert();

    if (info != null) {
        if (info.getE() != null) {
            info.setInAlert(true);
            c.setBackground(new Color(255, 255, 153));
            c.setForeground(Color.BLACK);
        } else if (info.getDepthAlert() != 0 && (info.getDepth() > info.getDepthAlert())) {
            info.setInAlert(true);
            c.setBackground(new Color(255, 204, 153));
            c.setForeground(Color.BLACK);
        } else if (info.getAgeAlert() != 0
                && (System.currentTimeMillis() - info.getAgeAlert() > info.getAgeAlert())) {
            info.setInAlert(true);
            c.setBackground(new Color(255, 204, 153));
            c.setForeground(Color.BLACK);
        } else if (originalY % 2 == 0 && !isCellSelected(originalY, x)) {
            info.setInAlert(false);
            c.setBackground(Color.LIGHT_GRAY);
            c.setForeground(Color.BLACK);

        } else if (!isCellSelected(originalY, x)) {
            //
            // If not shaded, match the table's background

            info.setInAlert(false);
            c.setBackground(Color.WHITE);
            c.setForeground(Color.BLACK);
        }
    }

    return rval;
}

From source file:org.esa.snap.ui.tooladapter.model.OperatorParametersTable.java

@Override
public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
    Component component = super.prepareRenderer(renderer, row, column);
    ToolParameterDescriptor descriptor = operator.getToolParameterDescriptors().get(row);
    switch (descriptor.getName()) {
    case ToolAdapterConstants.TOOL_SOURCE_PRODUCT_ID:
    case ToolAdapterConstants.TOOL_SOURCE_PRODUCT_FILE:
    case ToolAdapterConstants.TOOL_TARGET_PRODUCT_ID:
    case ToolAdapterConstants.TOOL_TARGET_PRODUCT_FILE:
        component.setBackground(Color.lightGray);
        break;/*w  w w .j a  v  a 2 s.c  o m*/
    default:
        component.setBackground(SystemColor.text);
        break;
    }
    return component;
}

From source file:org.tinymediamanager.ui.movies.settings.MovieScraperSettingsPanel.java

/**
 * Instantiates a new movie scraper settings panel.
 *//*from  w w w . ja  v a2 s  .com*/
public MovieScraperSettingsPanel() {
    // data init
    MediaScraper defaultMediaScraper = MovieList.getInstance().getDefaultMediaScraper();
    int selectedIndex = 0;
    int counter = 0;
    for (MediaScraper scraper : MovieList.getInstance().getAvailableMediaScrapers()) {
        MovieScraper movieScraper = new MovieScraper(scraper);
        if (scraper.equals(defaultMediaScraper)) {
            movieScraper.defaultScraper = true;
            selectedIndex = counter;
        }
        scrapers.add(movieScraper);
        counter++;
    }
    // UI init
    setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
            FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                    RowSpec.decode("default:grow"), }));
    JPanel panelMovieScrapers = new JPanel();
    panelMovieScrapers.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
            BUNDLE.getString("scraper.metadata"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); // $NON-NLS-1$
    add(panelMovieScrapers, "2, 2, 3, 1, fill, fill");
    panelMovieScrapers.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC,
            FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("50dlu:grow"),
            FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("150dlu:grow"),
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, }));

    scrollPaneScraper = new JScrollPane();
    panelMovieScrapers.add(scrollPaneScraper, "2, 2, 3, 1, fill, fill");

    tableScraper = new JTable() {
        private static final long serialVersionUID = -144223066269069772L;

        @Override
        public java.awt.Component prepareRenderer(TableCellRenderer renderer, int row, int col) {
            java.awt.Component comp = super.prepareRenderer(renderer, row, col);
            String value = getModel().getValueAt(row, 2).toString();
            if (!Globals.isDonator() && value.startsWith("Kodi")) { // FIXME: use scraper.isEnabled() somehow?
                comp.setBackground(Color.lightGray);
                comp.setEnabled(false);
            } else {
                comp.setBackground(Color.white);
                comp.setEnabled(true);
            }
            return comp;
        }
    };
    tableScraper.setRowHeight(29);
    scrollPaneScraper.setViewportView(tableScraper);

    scrollPane = new JScrollPane();
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setBorder(null);
    panelMovieScrapers.add(scrollPane, "6, 1, 1, 7, fill, fill");

    panelScraperDetails = new ScrollablePanel();
    scrollPane.setViewportView(panelScraperDetails);
    panelScraperDetails
            .setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("default:grow"), }, new RowSpec[] {
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, }));
    {
        // add a CSS rule to force body tags to use the default label font
        // instead of the value in javax.swing.text.html.default.csss
        Font font = UIManager.getFont("Label.font");
        String bodyRule = "body { font-family: " + font.getFamily() + "; " + "font-size: " + font.getSize()
                + "pt; }";

        tpScraperDescription = new JTextPane();
        tpScraperDescription.setOpaque(false);
        tpScraperDescription.setEditorKit(new HTMLEditorKit());
        ((HTMLDocument) tpScraperDescription.getDocument()).getStyleSheet().addRule(bodyRule);
        panelScraperDetails.add(tpScraperDescription, "1, 1, default, top");
    }

    panelScraperOptions = new JPanel();
    panelScraperOptions.setLayout(new FlowLayout(FlowLayout.LEFT));
    panelScraperDetails.add(panelScraperOptions, "1, 3, fill, top");

    JSeparator separator = new JSeparator();
    panelMovieScrapers.add(separator, "2, 4, 3, 1");

    JLabel lblScraperLanguage = new JLabel(BUNDLE.getString("Settings.preferredLanguage")); //$NON-NLS-1$
    panelMovieScrapers.add(lblScraperLanguage, "2, 5, right, default");

    cbScraperLanguage = new JComboBox(MediaLanguages.values());
    panelMovieScrapers.add(cbScraperLanguage, "4, 5");

    JLabel lblCountry = new JLabel(BUNDLE.getString("Settings.certificationCountry")); //$NON-NLS-1$
    panelMovieScrapers.add(lblCountry, "2, 7, right, default");

    cbCertificationCountry = new JComboBox(CountryCode.values());
    panelMovieScrapers.add(cbCertificationCountry, "4, 7, fill, default");
    panelMovieScrapers.add(new JSeparator(), "2, 8, 5, 1");

    chckbxScraperFallback = new JCheckBox(BUNDLE.getString("Settings.scraperfallback")); //$NON-NLS-1$
    panelMovieScrapers.add(chckbxScraperFallback, "2, 9, 5, 1");

    panelScraperMetadataContainer = new JPanel();
    panelScraperMetadataContainer.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
            BUNDLE.getString("scraper.metadata.defaults"), TitledBorder.LEADING, TitledBorder.TOP, null, //$NON-NLS-1$
            new Color(51, 51, 51)));
    add(panelScraperMetadataContainer, "2, 4, fill, fill");
    panelScraperMetadataContainer.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("10dlu"),
                    FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), },
            new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                    FormFactory.DEFAULT_ROWSPEC, FormFactory.NARROW_LINE_GAP_ROWSPEC,
                    FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, }));

    panelScraperMetadata = new MovieScraperMetadataPanel(
            Settings.getInstance().getMovieScraperMetadataConfig());
    panelScraperMetadataContainer.add(panelScraperMetadata, "1, 1, 4, 1, fill, default");

    chckbxAutomaticallyScrapeImages = new JCheckBox(BUNDLE.getString("Settings.default.autoscrape")); //$NON-NLS-1$
    panelScraperMetadataContainer.add(chckbxAutomaticallyScrapeImages, "2, 3, 3, 1");

    chckbxImageLanguage = new JCheckBox(BUNDLE.getString("Settings.default.autoscrape.language"));//$NON-NLS-1$
    panelScraperMetadataContainer.add(chckbxImageLanguage, "4, 5");

    panelAutomaticScraper = new JPanel();
    panelAutomaticScraper.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.automaticscraper"), //$NON-NLS-1$
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panelAutomaticScraper, "4, 4, fill, fill");
    panelAutomaticScraper.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC,
                    ColumnSpec.decode("default:grow"), },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, }));

    JLabel lblScraperTreshold = new JLabel(BUNDLE.getString("Settings.scraperTreshold")); //$NON-NLS-1$
    panelAutomaticScraper.add(lblScraperTreshold, "1, 2, default, top");

    sliderThreshold = new JSlider();
    sliderThreshold.setMinorTickSpacing(5);
    sliderThreshold.setMajorTickSpacing(10);
    sliderThreshold.setPaintTicks(true);
    sliderThreshold.setPaintLabels(true);
    sliderThreshold.setValue((int) (settings.getScraperThreshold() * 100));

    Hashtable<Integer, JLabel> labelTable = new java.util.Hashtable<>();
    labelTable.put(100, new JLabel("1.0"));
    labelTable.put(75, new JLabel("0.75"));
    labelTable.put(50, new JLabel("0.50"));
    labelTable.put(25, new JLabel("0.25"));
    labelTable.put(0, new JLabel("0.0"));
    sliderThreshold.setLabelTable(labelTable);
    sliderThreshold.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent arg0) {
            settings.setScraperThreshold(sliderThreshold.getValue() / 100.0);
        }
    });
    panelAutomaticScraper.add(sliderThreshold, "3, 2");

    lblScraperThresholdHint = new JTextPane();
    panelAutomaticScraper.add(lblScraperThresholdHint, "1, 6, 3, 1");
    lblScraperThresholdHint.setOpaque(false);
    TmmFontHelper.changeFont(lblScraperThresholdHint, 0.833);
    lblScraperThresholdHint.setText(BUNDLE.getString("Settings.scraperTreshold.hint")); //$NON-NLS-1$

    initDataBindings();

    // adjust table columns
    // Checkbox and Logo shall have minimal width
    TableColumnResizer.setMaxWidthForColumn(tableScraper, 0, 2);
    TableColumnResizer.setMaxWidthForColumn(tableScraper, 1, 2);
    TableColumnResizer.adjustColumnPreferredWidths(tableScraper, 5);

    // implement listener to simulate button group
    tableScraper.getModel().addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent arg0) {
            // click on the checkbox
            if (arg0.getColumn() == 0) {
                int row = arg0.getFirstRow();
                MovieScraper changedScraper = scrapers.get(row);
                // if flag default scraper was changed, change all other flags
                if (changedScraper.getDefaultScraper()) {
                    settings.setMovieScraper(changedScraper.getScraperId());
                    for (MovieScraper scraper : scrapers) {
                        if (scraper != changedScraper) {
                            scraper.setDefaultScraper(Boolean.FALSE);
                        }
                    }
                }
            }
        }
    });

    // implement selection listener to load settings
    tableScraper.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            int index = tableScraper.convertRowIndexToModel(tableScraper.getSelectedRow());
            if (index > -1) {
                panelScraperOptions.removeAll();
                if (scrapers.get(index).getMediaProvider().getProviderInfo().getConfig().hasConfig()) {
                    panelScraperOptions
                            .add(new MediaScraperConfigurationPanel(scrapers.get(index).getMediaProvider()));
                }
                panelScraperOptions.revalidate();
            }
        }
    });

    // select default movie scraper
    if (counter > 0) {
        tableScraper.getSelectionModel().setSelectionInterval(selectedIndex, selectedIndex);
    }
}