Example usage for javax.swing JSeparator JSeparator

List of usage examples for javax.swing JSeparator JSeparator

Introduction

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

Prototype

public JSeparator() 

Source Link

Document

Creates a new horizontal separator.

Usage

From source file:org.openmicroscopy.shoola.util.ui.graphutils.ChartObject.java

/**
 * Builds the graph and returns the UI component hosting it.
 * /*from   w  w  w.j a v a  2 s.c  om*/
 * @param image The background image of the plot.
 * @param removeLegend Pass <code>true</code> to remove the legend,
 *                   <code>false</code>.
 * @param actions Additional actions which will be added to the chart's popup menu
 *
 * @return See above.
 */
public JPanel getChart(Image image, boolean removeLegend, List<AbstractAction> actions) {
    backgroundImage = image;
    createChart();
    if (removeLegend)
        chart.removeLegend();
    JPanel graphPanel = new JPanel();
    if (chart == null)
        return graphPanel;
    graphPanel.setLayout(new BorderLayout());

    // create ChartPanel which does not include "Save as..." menu, as it
    // only allows JPEG; instead provide "Save as" functionality as custom action
    ChartPanel p = new ChartPanel(chart, true, false, true, true, true);
    if (!CollectionUtils.isEmpty(actions))
        p.getPopupMenu().add(new JSeparator());
    for (AbstractAction action : actions) {
        JMenuItem exportMenu = new JMenuItem(action);
        p.getPopupMenu().add(exportMenu);
    }

    graphPanel.add(p, BorderLayout.CENTER);
    return graphPanel;
}

From source file:org.openmicroscopy.shoola.util.ui.search.SearchComponent.java

/**
 * Adds the specified component to the result display.
 * /* ww  w  . ja  v  a2 s  .co  m*/
 * @param result The component to add.
 * @param clear Pass <code>true</code> to remove the previous components,
 *              <code>false</code> otherwise.
 */
public void addResult(JComponent result, boolean clear) {
    if (clear)
        resultPane.removeAll();
    if (result == null)
        return;
    resultPane.add(result);
    resultPane.add(new JSeparator());
    result.setBackground(UIUtilities.BACKGROUND_COLOR);
    revalidate();
    repaint();
}

From source file:org.p_vcd.ui.VcdDialog.java

public VcdDialog() {
    setSize(700, 450);/*from  w ww  . j  a va2  s . c om*/
    setTitle("P-VCD - Video Copy Detection");
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.currentStep = 1;

    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new CardLayout(0, 0));
    {
        JPanel panel_Step1 = new JPanel();
        contentPanel.add(panel_Step1, "card_step1");
        panel_Step1.setLayout(new BorderLayout(0, 0));
        JLabel lblTitle = new JLabel("STEP 1 - Video Database (the \"known\")");
        panel_Step1.add(lblTitle, BorderLayout.NORTH);
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));

        JPanel panel_1 = new JPanel();
        panel_Step1.add(panel_1, BorderLayout.CENTER);
        panel_1.setLayout(new MigLayout("", "[250px,grow][20px][250px,grow]", "[][][230px,grow][][][]"));

        JLabel lblNewLabel = new JLabel("Please select the video databases to search in:");
        panel_1.add(lblNewLabel, "cell 0 0");

        panel_1.add(lbl_refDbTitle, "cell 2 1");

        JScrollPane scrollPane_1 = new JScrollPane();
        panel_1.add(scrollPane_1, "cell 0 1 1 3,grow");
        panel_refDatabasesList.setBackground(Color.WHITE);

        scrollPane_1.setViewportView(panel_refDatabasesList);
        panel_refDatabasesList.setLayout(new MigLayout("gapy 10", "[200px]", "[][]"));

        JScrollPane scrollPane = new JScrollPane();
        scrollPane.setBorder(null);
        panel_1.add(scrollPane, "cell 2 2,grow");

        scrollPane.setViewportView(lbl_refDbFiles);

        panel_1.add(lbl_refDbMetadata, "cell 2 3");

        JButton btnNewDatabase = new JButton("New database...");
        panel_1.add(btnNewDatabase, "cell 0 4");
        btnNewDatabase.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                newDatabaseButton();
            }
        });
    }
    {
        JPanel panel_Step2 = new JPanel();
        contentPanel.add(panel_Step2, "card_step2");
        panel_Step2.setLayout(new BorderLayout(0, 0));
        JLabel lblTitle = new JLabel("STEP 2 - Query (the \"unknown\")");
        panel_Step2.add(lblTitle, BorderLayout.NORTH);
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));

        JPanel panel = new JPanel();
        panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Query",
                TitledBorder.LEADING, TitledBorder.TOP, null, null));
        panel_Step2.add(panel, BorderLayout.CENTER);
        panel.setLayout(
                new MigLayout("", "[160px][grow]", "[25px][grow,top][25px][grow,top][25px][grow,top][grow]"));

        ButtonGroup queryButtonGroup = new ButtonGroup();

        queryButtonGroup.add(radio_queryFile);
        radio_queryFile.setFont(new Font("Tahoma", Font.PLAIN, 13));
        panel.add(radio_queryFile, "cell 0 0");

        lbl_queryFile.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                radio_queryFile.setSelected(true);
            }
        });
        panel.add(lbl_queryFile, "flowy,cell 1 0");

        JButton btnSelectFile = new JButton("Select File...");
        btnSelectFile.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                selectFileButton();
            }
        });
        panel.add(btnSelectFile, "cell 1 0");

        JLabel lblIumageOrVideo = new JLabel("Select an image or video in the local machine.");
        panel.add(lblIumageOrVideo, "cell 1 1");

        queryButtonGroup.add(radio_queryUrl);
        radio_queryUrl.setFont(new Font("Tahoma", Font.PLAIN, 13));
        panel.add(radio_queryUrl, "cell 0 2");

        txt_queryUrl.addKeyListener(new KeyAdapter() {
            @Override
            public void keyReleased(KeyEvent e) {
                radio_queryUrl.setSelected(true);
            }
        });
        txt_queryUrl.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                radio_queryUrl.setSelected(true);
            }
        });
        txt_queryUrl.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                radio_queryUrl.setSelected(true);
            }
        });
        txt_queryUrl.setText("http://");
        panel.add(txt_queryUrl, "flowy,cell 1 2");
        txt_queryUrl.setColumns(50);

        JLabel lblUrlToA = new JLabel(
                "<html>Enter the URL to download an image or video.<br>You can use a URL like: http://www.youtube.com/watch?v=... </html>");
        panel.add(lblUrlToA, "flowy,cell 1 3");

        queryButtonGroup.add(radio_queryDb);
        radio_queryDb.setFont(new Font("Tahoma", Font.PLAIN, 13));
        panel.add(radio_queryDb, "cell 0 4");

        comboBox_queryDb.setMaximumRowCount(12);
        comboBox_queryDb.setPreferredSize(new Dimension(100, 20));
        comboBox_queryDb.setMinimumSize(new Dimension(100, 20));
        comboBox_queryDb.addPropertyChangeListener(new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                if (comboBox_queryDb.getSelectedIndex() > 0)
                    radio_queryDb.setSelected(true);
                updateQueryDbDetail();
            }
        });
        comboBox_queryDb.addKeyListener(new KeyAdapter() {
            @Override
            public void keyReleased(KeyEvent e) {
                if (comboBox_queryDb.getSelectedIndex() > 0)
                    radio_queryDb.setSelected(true);
                updateQueryDbDetail();
            }
        });

        panel.add(comboBox_queryDb, "flowx,cell 1 4");

        panel.add(lbl_queryDb, "cell 1 4");

        JLabel lblPleaseNopteThe = new JLabel("<html>A search is run for each video in the database.</html>");
        panel.add(lblPleaseNopteThe, "cell 1 5");

    }
    {
        JPanel panel_Step3 = new JPanel();
        contentPanel.add(panel_Step3, "card_step3");
        panel_Step3.setLayout(new BorderLayout(0, 0));

        JLabel lblTitle = new JLabel("STEP 3 - Search Options");
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        panel_Step3.add(lblTitle, BorderLayout.NORTH);

        JPanel panel2 = new JPanel();
        panel2.setLayout(new FlowLayout());
        panel_Step3.add(panel2, BorderLayout.CENTER);
        JPanel panel = new JPanel();
        panel2.add(panel);
        panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Basic Options",
                TitledBorder.LEADING, TitledBorder.TOP, null, null));
        panel.setLayout(new MigLayout("gapy 5px", "[30px][101px]", "[][][][][][][20px]"));

        ButtonGroup buttonGroup = new ButtonGroup();

        buttonGroup.add(radio_searchByGlobal);
        radio_searchByGlobal.setFont(new Font("Tahoma", Font.PLAIN, 13));
        radio_searchByGlobal.setSelected(true);
        panel.add(radio_searchByGlobal, "cell 0 0 2 1,alignx left,aligny top");

        JLabel lblNewLabel_2 = new JLabel(
                "Detects most of the copies that are visually alike to the original.");
        panel.add(lblNewLabel_2, "cell 1 1");

        JButton btnOptions = new JButton("Advanced Options...");
        btnOptions.setEnabled(false);
        panel.add(btnOptions, "cell 1 2");

        buttonGroup.add(radio_searchByLocal);
        radio_searchByLocal.setFont(new Font("Tahoma", Font.PLAIN, 13));
        panel.add(radio_searchByLocal, "cell 0 4 2 1,alignx left,aligny top");

        JLabel lblNewLabel_3 = new JLabel(
                "Requires more resources (disk space, search time, memory) but can detect more copies.");
        panel.add(lblNewLabel_3, "cell 1 5");

        JButton btnOptions_1 = new JButton("Advanced Options...");
        btnOptions_1.setEnabled(false);
        panel.add(btnOptions_1, "cell 1 6");

    }
    {
        JPanel panel_Step4 = new JPanel();
        contentPanel.add(panel_Step4, "card_step4");
        panel_Step4.setLayout(new BorderLayout(0, 0));

        JLabel lblTitle = new JLabel("STEP 4 - Search");
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));
        panel_Step4.add(lblTitle, BorderLayout.NORTH);

        JScrollPane scrollPane = new JScrollPane();
        panel_Step4.add(scrollPane, BorderLayout.CENTER);

        textConsole.setFont(new Font("Monospaced", Font.PLAIN, 11));
        textConsole.setForeground(Color.WHITE);
        textConsole.setBackground(Color.BLACK);
        textConsole.setEditable(false);
        textConsole.setCursor(new Cursor(Cursor.TEXT_CURSOR));
        textConsole.setText(
                "Press 'Next' button to start the search...\nNote: Depending on the selected options, the search may take up to several hours.");
        scrollPane.setViewportView(textConsole);

        JPanel panel = new JPanel();
        panel_Step4.add(panel, BorderLayout.SOUTH);
        panel.setLayout(new GridLayout(0, 1, 0, 0));

        JSeparator separator = new JSeparator();
        separator.setPreferredSize(new Dimension(0, 1));
        panel.add(separator);
        progressBar.setStringPainted(true);
        progressBar.setPreferredSize(new Dimension(350, 20));
        panel.add(progressBar);

        lblProgress.setHorizontalAlignment(SwingConstants.CENTER);
        lblProgress.setFont(new Font("Tahoma", Font.PLAIN, 14));
        panel.add(lblProgress);
    }
    {
        JPanel panel_Step5 = new JPanel();
        contentPanel.add(panel_Step5, "card_step5");
        panel_Step5.setLayout(new BorderLayout(0, 0));

        JLabel lblTitle = new JLabel("STEP 5 - Results");
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));
        panel_Step5.add(lblTitle, BorderLayout.NORTH);

        JScrollPane scrollPane = new JScrollPane();
        panel_Step5.add(scrollPane, BorderLayout.CENTER);

        scrollPane.setViewportView(panelResults);
        panelResults.setLayout(new MigLayout("gapy 10, gapx 20",
                "[120px,center][150px,center,grow][150px,center,grow]", "[25px][]"));

    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton prevButton = new JButton("Previous");
            prevButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    previousButton();
                }
            });
            prevButton.setActionCommand("Previous");
            buttonPane.add(prevButton);
        }
        {
            JButton okButton = new JButton("Next");
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    nextButton();
                }
            });
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    cancelButton();
                }
            });
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }
    }
    this.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosed(WindowEvent e) {
            closeWindow();
        }
    });
    updateDatabases(null);
}

From source file:org.rdv.DockingDataPanelManager.java

/**
 * Creates the menu where the theme can be changed.
 *
 * @return the theme menu//from  ww  w  . j a  v  a 2s. co  m
 */
private JMenu createThemesMenu() {
    JMenu themesMenu = new JMenu("Themes");

    // don't get the title bar window thing

    final JCheckBoxMenuItem titleBarStyleItem = new JCheckBoxMenuItem("Title Bar Style Theme");
    titleBarStyleItem.setSelected(titleBarTheme_);
    titleBarStyleItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (!titleBarTheme_)
                properties_.addSuperObject(titleBarStyleProperties);
            else {
                // TODO this does not work to remove title bars from windows 
                properties_.removeSuperObject(titleBarStyleProperties);
            }
            titleBarTheme_ = !titleBarTheme_;
        }
    });

    themesMenu.add(titleBarStyleItem);
    themesMenu.add(new JSeparator());

    DockingWindowsTheme[] themes = { new DefaultDockingTheme(), new LookAndFeelDockingTheme(),
            new BlueHighlightDockingTheme(), new SlimFlatDockingTheme(), new GradientDockingTheme(),
            new ShapedGradientDockingTheme(), new SoftBlueIceDockingTheme(), new ClassicDockingTheme() };

    ButtonGroup group = new ButtonGroup();

    for (int i = 0; i < themes.length; i++) {
        final DockingWindowsTheme theme = themes[i];

        JRadioButtonMenuItem item = new JRadioButtonMenuItem(theme.getName());
        item.setSelected(themes[i].getClass() == currentTheme_.getClass());

        group.add(item);

        themesMenu.add(item).addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                // Clear the modified properties values
                properties_.getMap().clear(true);

                setTheme(theme);
            }
        });
    }
    return themesMenu;
}

From source file:org.revager.gui.findings_list.FindingsListFrame.java

public FindingsListFrame(boolean fullscreen) {
    super();//  w  w  w  .  j av  a 2  s  .c  o m

    this.fullscreen = fullscreen;
    this.nativeFullscrSupported = gd.isFullScreenSupported();

    /*
     * Because of some problems do not use the native fullscreen
     * functionality
     */
    if (UI.getInstance().getPlatform() == UI.Platform.WINDOWS
            || UI.getInstance().getPlatform() == UI.Platform.MAC) {
        nativeFullscrSupported = false;
    }

    UI.getInstance().getProtocolClockWorker().addPropertyChangeListener(evt -> {
        Object value = evt.getNewValue();
        if (value instanceof Integer) {
            updateClock((int) value);
            updateCurrentTime();
        }
    });

    setTitle(translate("List of Findings"));
    setStatusMessage(translate("List of findings successfully loaded."), false);

    getContentPane().setLayout(new BorderLayout());
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

    /*
     * Format bottom panel in org tab
     */
    bottomOrgPanel.setBackground(UI.TABLE_ALT_COLOR);
    bottomOrgPanel.setBorder(new EmptyBorder(20, 0, 30, 0));

    GUITools.addComponent(tabPanelOrg, gbl, attPanel, 0, 0, 1, 1, 1.0, 1.0, 0, 0, 20, 0,
            GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(tabPanelOrg, gbl, new JSeparator(), 0, 1, 1, 1, 1.0, 0.0, 0, 0, 0, 0,
            GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(tabPanelOrg, gbl, bottomOrgPanel, 0, 2, 1, 1, 1.0, 0.0, 0, 0, 0, 0,
            GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

    createToolBar();

    setLocationToCenter();

    if (fullscreen) {
        setUndecorated(true);

        if (!nativeFullscrSupported) {
            setMinimumSize(Toolkit.getDefaultToolkit().getScreenSize());
            setPreferredSize(Toolkit.getDefaultToolkit().getScreenSize());
            setSize(Toolkit.getDefaultToolkit().getScreenSize());

            setLocation(0, 0);

            setResizable(false);
            setAlwaysOnTop(true);
        }

        toFront();

        // Dimension screenSize =
        // Toolkit.getDefaultToolkit().getScreenSize();
        // setPreferredSize(screenSize);
    } else {
        setMinimumSize(new Dimension(900, 710));
        setPreferredSize(new Dimension(900, 710));

        pack();
    }

    setExtendedState(Frame.MAXIMIZED_BOTH);

    createHints();

    addWindowListener(new WindowListener() {
        @Override
        public void windowActivated(WindowEvent e) {
        }

        @Override
        public void windowClosed(WindowEvent e) {
        }

        @Override
        public void windowClosing(WindowEvent e) {
            if (StringUtils.isBlank(protCommTxtArea.getText())) {
                currentProt.setComments("");
            }
            GUITools.executeSwingWorker(new ImageEditorWriteWorker(currentProt));
            setVisible(false);
        }

        @Override
        public void windowDeactivated(WindowEvent e) {
        }

        @Override
        public void windowDeiconified(WindowEvent e) {
        }

        @Override
        public void windowIconified(WindowEvent e) {
            if (isFullscreen()) {
                setExtendedState(MAXIMIZED_BOTH);
            }
        }

        @Override
        public void windowOpened(WindowEvent e) {
        }
    });

    GUITools.executeSwingWorker(updateWorker);
}

From source file:org.rimudb.editor.RimuDBEditor.java

/**
 * DataObjectEditor//  ww  w  . j a  va  2  s  .com
 */
public RimuDBEditor() {
    super(TITLE);

    log.debug(System.getProperties());
    logMemory();

    // Create a preferences object
    preferences = new RimuDBPreferences(this.getClass().getName());

    // Use the system l&f
    try {
        String plaf = UIManager.getSystemLookAndFeelClassName();
        UIManager.setLookAndFeel(plaf);
    } catch (Exception e) {
    }

    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            if (getDescriptorEditor().hasChanged()) {
                log.debug("windowClosing() Save changes to table descriptor?");
                int option = JOptionPane.showConfirmDialog(RimuDBEditor.this,
                        "Save changes to Table Descriptor?", "RimuDB Editor", JOptionPane.YES_NO_CANCEL_OPTION);
                // Cancel the close operation
                if (option == JOptionPane.CANCEL_OPTION) {
                    // setVisible(true);
                    return;
                }
                // Save the file
                if (option == JOptionPane.YES_OPTION) {
                    log.debug("windowClosing() saving data");
                    getDescriptorFileContoller().save();
                }
            }
            log.debug("System.exit(0)");
            System.exit(0);
        }
    });

    setIconImage(loadIcon("/images/rimudb_logo.gif").getImage());

    descriptorFileController = new DescriptorFileController(this);

    setJMenuBar(buildJMenuBar());
    JToolBar toolbar = createToolbar();

    editor = new DescriptorEditor(this);

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(toolbar, BorderLayout.NORTH);
    panel.add(new JSeparator());
    panel.add(editor, BorderLayout.CENTER);

    setContentPane(panel);

    pack();

    editor.requestPackageFocus();

    // Center in the screen
    setLocationRelativeTo(null);

    startDriverCheck();
}

From source file:org.thelq.stackexchange.dbimport.gui.GUI.java

/**
 * Update the list of locations//from   www.  j ava2 s. co m
 */
protected void updateLocations() {
    locationsBuilder.getPanel().removeAll();
    for (final DumpContainer curContainer : controller.getDumpContainers()) {
        //Initialize components
        if (curContainer.getGuiHeader() == null) {
            String longLocation = Utils.getLongLocation(curContainer);
            JLabel headerLabel = new JLabel(longLocation);
            headerLabel.setToolTipText(longLocation);
            headerLabel.setIcon(UIManager.getIcon("Tree.collapsedIcon"));
            JPopupMenu popupMenu = new JPopupMenu();
            JMenuItem deleteItem = new JMenuItem("Delete");
            deleteItem.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    log.info("Removing " + curContainer.getType() + " " + curContainer.getLocation());
                    controller.getDumpContainers().remove(curContainer);
                    updateLocations();
                }
            });
            popupMenu.add(deleteItem);
            headerLabel.setComponentPopupMenu(popupMenu);
            curContainer.setGuiHeader(headerLabel);
            //Handlers
            headerLabel.addMouseListener(new MouseAdapter() {
                boolean visible = true;

                @Override
                public void mouseClicked(MouseEvent e) {
                    //Update labels
                    visible = !visible;
                    for (DumpEntry curEntry : curContainer.getEntries()) {
                        curEntry.getGuiName().setVisible(visible);
                        curEntry.getGuiSize().setVisible(visible);
                        curEntry.getGuiLog().setVisible(visible);
                        if (curEntry.getGuiSeparator() != null)
                            curEntry.getGuiSeparator().setVisible(visible);
                    }

                    //Change icon
                    if (visible)
                        curContainer.getGuiHeader().setIcon(UIManager.getIcon("Tree.expandedIcon"));
                    else
                        curContainer.getGuiHeader().setIcon(UIManager.getIcon("Tree.collapsedIcon"));
                    locationsPane.revalidate();
                }
            });
        }
        if (curContainer.getGuiTablePrefix() == null) {
            JTextField headerPrefix = new JTextField(6);
            curContainer.setGuiTablePrefix(headerPrefix);
            headerPrefix.setText(Utils.genTablePrefix(curContainer.getName()));
            if (StringUtils.isBlank(headerPrefix.getText()))
                log.warn("Unable to generate a table prefix for {}", curContainer.getLocation());
        }

        //Start adding to panel
        locationsBuilder.leadingColumnOffset(0);
        locationsBuilder.append(curContainer.getGuiHeader(), 7);
        locationsBuilder.append(curContainer.getGuiTablePrefix());
        locationsBuilder.nextLine();
        locationsBuilder.leadingColumnOffset(2);

        Iterator<DumpEntry> entriesItr = curContainer.getEntries().iterator();
        while (entriesItr.hasNext()) {
            DumpEntry curEntry = entriesItr.next();
            if (curEntry.getGuiName() == null)
                curEntry.setGuiName(new JLabel(curEntry.getName()));
            locationsBuilder.append(curEntry.getGuiName());
            if (curEntry.getGuiSize() == null)
                curEntry.setGuiSize(new JLabel(sizeInMegabytes(curEntry.getSizeBytes())));
            locationsBuilder.append(curEntry.getGuiSize());
            if (curEntry.getGuiLog() == null)
                curEntry.setGuiLog(new JLabel("Waiting..."));
            locationsBuilder.append(curEntry.getGuiLog(), 3);
            locationsBuilder.nextLine();
            if (entriesItr.hasNext()) {
                if (curEntry.getGuiSeparator() == null)
                    curEntry.setGuiSeparator(new JSeparator());
                locationsBuilder.append(curEntry.getGuiSeparator(), 7);
                locationsBuilder.nextLine();
            }
        }
    }

    locationsPane.validate();
}

From source file:org.tinymediamanager.ui.movies.MovieExtendedSearchPanel.java

/**
 * Instantiates a new movie extended search
 * /*from  www  . ja  v a  2 s  . c om*/
 * @param model
 *          the model
 */
public MovieExtendedSearchPanel(MovieSelectionModel model) {
    super();
    setOpaque(false);
    shadowAlpha = 100;
    arcs = new Dimension(10, 10);

    this.movieSelectionModel = model;
    Map<MovieSearchOptions, Object> savedSearchOptions = MovieModuleManager.MOVIE_SETTINGS.getUiFilters();

    // add a dummy mouse listener to prevent clicking through
    addMouseListener(new MouseAdapter() {
    });

    listCheckListener = new ListCheckListener() {
        @Override
        public void removeCheck(ListEvent event) {
            actionFilter.actionPerformed(new ActionEvent(event.getSource(), 1, "checked"));
        }

        @Override
        public void addCheck(ListEvent event) {
            actionFilter.actionPerformed(new ActionEvent(event.getSource(), 1, "checked"));
        }
    };

    setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
            FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC,
            ColumnSpec.decode("default:grow"), FormSpecs.UNRELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.UNRELATED_GAP_ROWSPEC, }));

    JLabel lblFilterBy = new JLabel(BUNDLE.getString("movieextendedsearch.filterby")); //$NON-NLS-1$
    setComponentFont(lblFilterBy);
    add(lblFilterBy, "2, 2, 3, 1");

    cbFilterNewMovies = new JCheckBox("");
    cbFilterNewMovies.setUI(CHECKBOX_UI); // $hide$
    cbFilterNewMovies.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.NEW_MOVIES));
    cbFilterNewMovies.setAction(actionFilter);
    add(cbFilterNewMovies, "2, 4");

    lblNewMovies = new JLabel(BUNDLE.getString("movieextendedsearch.newmovies")); //$NON-NLS-1$
    setComponentFont(lblNewMovies);
    add(lblNewMovies, "4, 4, right, default");

    cbFilterDuplicates = new JCheckBox("");
    cbFilterDuplicates.setUI(CHECKBOX_UI); // $hide$
    cbFilterDuplicates.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.DUPLICATES));
    cbFilterDuplicates.setAction(actionFilter);
    add(cbFilterDuplicates, "2, 5");

    JLabel lblShowDuplicates = new JLabel(BUNDLE.getString("movieextendedsearch.duplicates")); //$NON-NLS-1$
    setComponentFont(lblShowDuplicates);
    add(lblShowDuplicates, "4, 5, right, default");

    cbFilterWatched = new JCheckBox("");
    cbFilterWatched.setUI(CHECKBOX_UI); // $hide$
    cbFilterWatched.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.WATCHED));
    cbFilterWatched.setAction(actionFilter);
    add(cbFilterWatched, "2, 6");

    JLabel lblWatchedFlag = new JLabel(BUNDLE.getString("movieextendedsearch.watched")); //$NON-NLS-1$
    setComponentFont(lblWatchedFlag);
    add(lblWatchedFlag, "4, 6, right, default");

    cbWatched = new SmallComboBox(WatchedFlag.values());
    setComponentFont(cbWatched);
    cbWatched.setAction(actionFilter);
    add(cbWatched, "6, 6, fill, default");

    cbFilterGenre = new JCheckBox("");
    cbFilterGenre.setUI(CHECKBOX_UI); // $hide$
    cbFilterGenre.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.GENRE));
    cbFilterGenre.setAction(actionFilter);
    add(cbFilterGenre, "2, 7");

    JLabel lblGenre = new JLabel(BUNDLE.getString("movieextendedsearch.genre")); //$NON-NLS-1$
    setComponentFont(lblGenre);
    add(lblGenre, "4, 7, right, default");

    cbGenre = new SmallComboBox(MediaGenres.values());
    setComponentFont(cbGenre);
    cbGenre.setAction(actionFilter);
    add(cbGenre, "6, 7, fill, default");

    cbFilterCertification = new JCheckBox("");
    cbFilterCertification.setUI(CHECKBOX_UI); // $hide$
    cbFilterCertification.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.CERTIFICATION));
    cbFilterCertification.setAction(actionFilter);
    add(cbFilterCertification, "2, 8");

    lblCertification = new JLabel(BUNDLE.getString("metatag.certification")); //$NON-NLS-1$
    setComponentFont(lblCertification);
    add(lblCertification, "4, 8, right, default");

    cbCertification = new SmallComboBox();
    setComponentFont(cbCertification);
    cbCertification.setAction(actionFilter);
    add(cbCertification, "6, 8, fill, default");

    cbFilterYear = new JCheckBox("");
    cbFilterYear.setUI(CHECKBOX_UI); // $hide$
    cbFilterYear.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.YEAR));
    cbFilterYear.setAction(actionFilter);
    add(cbFilterYear, "2, 9");

    lblYear = new JLabel(BUNDLE.getString("metatag.year")); //$NON-NLS-1$
    setComponentFont(lblYear);
    add(lblYear, "4, 9, right, default");

    int year = Calendar.getInstance().get(Calendar.YEAR);
    spYear = new JSpinner();
    setComponentFont(spYear);
    spYear.setUI(new SmallSpinnerUI());// $hide$
    spYear.setModel(new SpinnerNumberModel(year, 0, 3000, 1));
    spYear.setEditor(new JSpinner.NumberEditor(spYear, "#"));
    spYear.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            actionFilter.actionPerformed(null);
        }
    });
    add(spYear, "6, 9");

    cbFilterCast = new JCheckBox("");
    cbFilterCast.setUI(CHECKBOX_UI); // $hide$
    cbFilterCast.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.CAST));
    cbFilterCast.setAction(actionFilter);
    add(cbFilterCast, "2, 10");

    JLabel lblCastMember = new JLabel(BUNDLE.getString("movieextendedsearch.cast")); //$NON-NLS-1$
    setComponentFont(lblCastMember);
    add(lblCastMember, "4, 10, right, default");

    tfCastMember = new JTextField();
    setComponentFont(tfCastMember);
    tfCastMember.setBorder(new SmallTextFieldBorder());
    add(tfCastMember, "6, 10, fill, default");
    tfCastMember.setColumns(10);
    tfCastMember.getDocument().addDocumentListener(new DocumentListener() {
        public void changedUpdate(DocumentEvent e) {
            actionFilter.actionPerformed(null);
        }

        public void insertUpdate(DocumentEvent e) {
            actionFilter.actionPerformed(null);
        }

        public void removeUpdate(DocumentEvent e) {
            actionFilter.actionPerformed(null);
        }
    });

    cbFilterTag = new JCheckBox("");
    cbFilterTag.setUI(CHECKBOX_UI); // $hide$
    cbFilterTag.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.TAG));
    cbFilterTag.setAction(actionFilter);
    add(cbFilterTag, "2, 11");

    JLabel lblTag = new JLabel(BUNDLE.getString("movieextendedsearch.tag")); //$NON-NLS-1$
    setComponentFont(lblTag);
    add(lblTag, "4, 11, right, default");

    cbTag = new SmallCheckComboBox();
    cbTag.setTextFor(CheckComboBox.NONE, BUNDLE.getString("movieextendedsearch.tags.selected.none")); //$NON-NLS-1$
    cbTag.setTextFor(CheckComboBox.MULTIPLE, BUNDLE.getString("movieextendedsearch.tags.selected.multiple")); //$NON-NLS-1$
    cbTag.setTextFor(CheckComboBox.ALL, BUNDLE.getString("movieextendedsearch.tags.selected.all")); //$NON-NLS-1$
    cbTag.getModel().addListCheckListener(listCheckListener);
    add(cbTag, "6, 11, fill, default");

    cbFilterMovieset = new JCheckBox("");
    cbFilterMovieset.setUI(CHECKBOX_UI); // $hide$
    cbFilterMovieset.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.MOVIESET));
    cbFilterMovieset.setAction(actionFilter);
    add(cbFilterMovieset, "2, 12");

    JLabel lblMoviesInMovieset = new JLabel(BUNDLE.getString("movieextendedsearch.movieset")); //$NON-NLS-1$
    setComponentFont(lblMoviesInMovieset);
    add(lblMoviesInMovieset, "4, 12, right, default");

    cbMovieset = new SmallComboBox(MovieInMovieSet.values());
    setComponentFont(cbMovieset);
    cbMovieset.setAction(actionFilter);
    add(cbMovieset, "6, 12, fill, default");

    cbFilterVideoFormat = new JCheckBox("");
    cbFilterVideoFormat.setUI(CHECKBOX_UI); // $hide$
    cbFilterVideoFormat.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.VIDEO_FORMAT));
    cbFilterVideoFormat.setAction(actionFilter);
    add(cbFilterVideoFormat, "2, 13");

    JLabel lblVideoFormat = new JLabel(BUNDLE.getString("metatag.resolution")); //$NON-NLS-1$
    setComponentFont(lblVideoFormat);
    add(lblVideoFormat, "4, 13, right, default");

    cbVideoFormat = new SmallComboBox(getVideoFormats());
    setComponentFont(cbVideoFormat);
    cbVideoFormat.setAction(actionFilter);
    add(cbVideoFormat, "6, 13, fill, default");

    cbFilterVideoCodec = new JCheckBox("");
    cbFilterVideoCodec.setUI(CHECKBOX_UI); // $hide$
    cbFilterVideoCodec.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.VIDEO_CODEC));
    cbFilterVideoCodec.setAction(actionFilter);
    add(cbFilterVideoCodec, "2, 14");

    JLabel lblVideoCodec = new JLabel(BUNDLE.getString("metatag.videocodec")); //$NON-NLS-1$
    setComponentFont(lblVideoCodec);
    add(lblVideoCodec, "4, 14, right, default");

    cbVideoCodec = new SmallComboBox();
    setComponentFont(cbVideoCodec);
    cbVideoCodec.setAction(actionFilter);
    add(cbVideoCodec, "6, 14, fill, default");

    cbFilterVideo3D = new JCheckBox("");
    cbFilterVideo3D.setUI(CHECKBOX_UI); // $hide$
    cbFilterVideo3D.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.VIDEO_3D));
    cbFilterVideo3D.addActionListener(actionFilter);
    add(cbFilterVideo3D, "2, 15");

    JLabel lblVideo3D = new JLabel(BUNDLE.getString("metatag.3d")); //$NON-NLS-1$
    setComponentFont(lblVideo3D);
    add(lblVideo3D, "4, 15, right, default");

    cbFilterAudioCodec = new JCheckBox("");
    cbFilterAudioCodec.setUI(CHECKBOX_UI); // $hide$
    cbFilterAudioCodec.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.AUDIO_CODEC));
    cbFilterAudioCodec.setAction(actionFilter);
    add(cbFilterAudioCodec, "2, 16");

    JLabel lblAudioCodec = new JLabel(BUNDLE.getString("metatag.audiocodec")); //$NON-NLS-1$
    setComponentFont(lblAudioCodec);
    add(lblAudioCodec, "4, 16, right, default");

    cbAudioCodec = new SmallComboBox();
    setComponentFont(cbAudioCodec);
    cbAudioCodec.setAction(actionFilter);
    add(cbAudioCodec, "6, 16, fill, default");

    cbFilterDatasource = new JCheckBox("");
    cbFilterDatasource.setUI(CHECKBOX_UI); // $hide$
    cbFilterDatasource.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.DATASOURCE));
    cbFilterDatasource.setAction(actionFilter);
    add(cbFilterDatasource, "2, 17");

    JLabel lblDatasource = new JLabel(BUNDLE.getString("metatag.datasource")); //$NON-NLS-1$
    setComponentFont(lblDatasource);
    add(lblDatasource, "4, 17, right, default");

    cbDatasource = new SmallCheckComboBox();
    cbDatasource.setTextFor(CheckComboBox.NONE, BUNDLE.getString("checkcombobox.selected.none")); //$NON-NLS-1$
    cbDatasource.setTextFor(CheckComboBox.MULTIPLE, BUNDLE.getString("checkcombobox.selected.multiple")); //$NON-NLS-1$
    cbDatasource.setTextFor(CheckComboBox.ALL, BUNDLE.getString("checkcombobox.selected.all")); //$NON-NLS-1$
    cbDatasource.getModel().addListCheckListener(listCheckListener);
    add(cbDatasource, "6, 17, fill, default");

    cbFilterMediaSource = new JCheckBox("");
    cbFilterMediaSource.setUI(CHECKBOX_UI); // $hide$
    cbFilterMediaSource.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.MEDIA_SOURCE));
    cbFilterMediaSource.addActionListener(actionFilter);
    add(cbFilterMediaSource, "2, 18");

    JLabel lblMediaSource = new JLabel(BUNDLE.getString("metatag.source")); //$NON-NLS-1$
    setComponentFont(lblMediaSource);
    add(lblMediaSource, "4, 18, right, default");

    cbMediaSource = new SmallComboBox(MediaSource.values());
    setComponentFont(cbMediaSource);
    cbMediaSource.setAction(actionFilter);
    add(cbMediaSource, "6, 18, fill, default");

    cbFilterMissingMetadata = new JCheckBox("");
    cbFilterMissingMetadata.setUI(CHECKBOX_UI); // $hide$
    cbFilterMissingMetadata.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.MISSING_METADATA));
    cbFilterMissingMetadata.setAction(actionFilter);
    add(cbFilterMissingMetadata, "2, 19");

    JLabel lblMissingMetadata = new JLabel(BUNDLE.getString("movieextendedsearch.missingmetadata")); //$NON-NLS-1$
    setComponentFont(lblMissingMetadata);
    add(lblMissingMetadata, "4, 19, right, default");

    cbFilterMissingArtwork = new JCheckBox("");
    cbFilterMissingArtwork.setUI(CHECKBOX_UI); // $hide$
    cbFilterMissingArtwork.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.MISSING_ARTWORK));
    cbFilterMissingArtwork.setAction(actionFilter);
    add(cbFilterMissingArtwork, "2, 20");

    JLabel lblMissingArtwork = new JLabel(BUNDLE.getString("movieextendedsearch.missingartwork")); //$NON-NLS-1$
    setComponentFont(lblMissingArtwork);
    add(lblMissingArtwork, "4, 20, right, default");

    cbFilterMissingSubtitles = new JCheckBox("");
    cbFilterMissingSubtitles.setUI(CHECKBOX_UI); // $hide$
    cbFilterMissingSubtitles.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.MISSING_SUBTITLES));
    cbFilterMissingSubtitles.setAction(actionFilter);
    add(cbFilterMissingSubtitles, "2, 21");

    JLabel lblMissingSubtitles = new JLabel(BUNDLE.getString("movieextendedsearch.missingsubtitles")); //$NON-NLS-1$
    setComponentFont(lblMissingSubtitles);
    add(lblMissingSubtitles, "4, 21, right, default");

    cbFilterOffline = new JCheckBox("");
    cbFilterOffline.setUI(CHECKBOX_UI); // $hide$
    cbFilterOffline.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.OFFLINE));
    cbFilterOffline.setAction(actionFilter);
    add(cbFilterOffline, "2, 22");

    lblOffline = new JLabel(BUNDLE.getString("movieextendedsearch.offline")); //$NON-NLS-1$
    setComponentFont(lblOffline);
    add(lblOffline, "4, 22, right, default");

    cbOffline = new SmallComboBox(OfflineMovie.values());
    cbOffline.setAction(actionFilter);
    add(cbOffline, "6, 22, fill, default");

    JSeparator separator = new JSeparator();
    add(separator, "2, 24, 5, 1");

    JLabel lblSortBy = new JLabel(BUNDLE.getString("movieextendedsearch.sortby")); //$NON-NLS-1$
    setComponentFont(lblSortBy);
    add(lblSortBy, "2, 26, 3, 1");

    cbSortColumn = new SmallComboBox(SortColumn.values());
    setComponentFont(cbSortColumn);
    cbSortColumn.setAction(actionSort);
    add(cbSortColumn, "2, 28, 3, 1, fill, default");

    cbSortOrder = new SmallComboBox(SortOrder.values());
    setComponentFont(cbSortOrder);
    cbSortOrder.setAction(actionSort);
    add(cbSortOrder, "6, 28, fill, default");

    PropertyChangeListener propertyChangeListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getSource() instanceof MovieList && "tag".equals(evt.getPropertyName())) {
                buildAndInstallTagsArray();
            }
            if (evt.getSource() instanceof MovieList && "videoCodec".equals(evt.getPropertyName())) {
                buildAndInstallCodecArray();
            }
            if (evt.getSource() instanceof MovieList && "audioCodec".equals(evt.getPropertyName())) {
                buildAndInstallCodecArray();
            }
            if (evt.getSource() instanceof MovieSettings && "movieDataSource".equals(evt.getPropertyName())) {
                buildAndInstallDatasourceArray();
            }
            if (evt.getSource() instanceof MovieList && "certification".equals(evt.getPropertyName())) {
                buildAndInstallCertificationArray();
            }
        }
    };
    movieList.addPropertyChangeListener(propertyChangeListener);
    MovieModuleManager.MOVIE_SETTINGS.addPropertyChangeListener(propertyChangeListener);
    buildAndInstallTagsArray();
    buildAndInstallCodecArray();
    buildAndInstallDatasourceArray();
    buildAndInstallCertificationArray();
}

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

/**
 * Instantiates a new movie image settings panel.
 *//*from   ww w.ja  v  a  2 s .co m*/
public MovieImageSettingsPanel() {
    // data init
    List<String> enabledArtworkProviders = settings.getMovieArtworkScrapers();
    int selectedIndex = -1;
    int counter = 0;
    for (MediaScraper scraper : MovieList.getInstance().getAvailableArtworkScrapers()) {
        ArtworkScraper artworkScraper = new ArtworkScraper(scraper);
        if (enabledArtworkProviders.contains(artworkScraper.getScraperId())) {
            artworkScraper.active = true;
            if (selectedIndex < 0) {
                selectedIndex = counter;
            }
        }
        scrapers.add(artworkScraper);
        counter++;
    }

    // init UI
    setLayout(new FormLayout(
            new ColumnSpec[] { 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, }));

    JPanel panelMovieImages = new JPanel();
    panelMovieImages.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.poster"), TitledBorder.LEADING, //$NON-NLS-1$
            TitledBorder.TOP, null, null));
    add(panelMovieImages, "2, 2, default, fill");
    panelMovieImages.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC,
            FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
            FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("100dlu:grow"),
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, }));

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

    panelScraperDetails = new ScrollablePanel();
    scrollPaneScraperDetails.setViewportView(panelScraperDetails);
    panelScraperDetails
            .setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("default:grow"), }, new RowSpec[] {
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_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, fill, top");
    }
    panelScraperOptions = new JPanel();
    panelScraperOptions.setLayout(new FlowLayout(FlowLayout.LEFT));
    panelScraperDetails.add(panelScraperOptions, "1, 3, fill, top");

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

    tableScraper = new JTable();
    tableScraper.setRowHeight(29);
    scrollPaneScraper.setViewportView(tableScraper);

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

    JLabel lblImageTmdbPosterSize = new JLabel(BUNDLE.getString("image.poster.size"));
    panelMovieImages.add(lblImageTmdbPosterSize, "2, 5");

    cbImagePosterSize = new JComboBox(PosterSizes.values());
    panelMovieImages.add(cbImagePosterSize, "4, 5");

    JLabel lblImageTmdbFanartSize = new JLabel(BUNDLE.getString("image.fanart.size"));
    panelMovieImages.add(lblImageTmdbFanartSize, "2, 7");

    cbImageFanartSize = new JComboBox(FanartSizes.values());
    panelMovieImages.add(cbImageFanartSize, "4, 7");

    separator = new JSeparator();
    panelMovieImages.add(separator, "2, 9, 5, 1");

    panelFileNaming = new JPanel();
    panelMovieImages.add(panelFileNaming, "2, 11, 5, 1, fill, fill");
    panelFileNaming.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                    FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                    FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                    ColumnSpec.decode("default:grow"), },
            new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, }));

    JLabel lblPosterFilename = new JLabel(BUNDLE.getString("image.poster.naming"));
    panelFileNaming.add(lblPosterFilename, "1, 1");

    cbMoviePosterFilename7 = new JCheckBox("<dynamic>.ext");
    panelFileNaming.add(cbMoviePosterFilename7, "3, 1");

    cbMoviePosterFilename4 = new JCheckBox("poster.ext");
    panelFileNaming.add(cbMoviePosterFilename4, "5, 1");

    cbMoviePosterFilename2 = new JCheckBox("movie.ext");
    panelFileNaming.add(cbMoviePosterFilename2, "7, 1");

    cbMoviePosterFilename8 = new JCheckBox("<dynamic>-poster.ext");
    panelFileNaming.add(cbMoviePosterFilename8, "9, 1");

    cbMoviePosterFilename6 = new JCheckBox("folder.ext");
    panelFileNaming.add(cbMoviePosterFilename6, "11, 1");

    JLabel lblFanartFileNaming = new JLabel(BUNDLE.getString("image.fanart.naming"));
    panelFileNaming.add(lblFanartFileNaming, "1, 3");

    cbMovieFanartFilename1 = new JCheckBox("<dynamic>-fanart.ext");
    panelFileNaming.add(cbMovieFanartFilename1, "3, 3");

    cbMovieFanartFilename3 = new JCheckBox("<dynamic>.fanart.ext");
    panelFileNaming.add(cbMovieFanartFilename3, "5, 3");

    cbMovieFanartFilename2 = new JCheckBox("fanart.ext");
    panelFileNaming.add(cbMovieFanartFilename2, "7, 3");

    tpFileNamingHint = new JTextPane();
    panelFileNaming.add(tpFileNamingHint, "1, 5, 11, 1, fill, fill");
    tpFileNamingHint.setText(BUNDLE.getString("Settings.naming.info")); //$NON-NLS-1$
    tpFileNamingHint.setBackground(UIManager.getColor("Panel.background"));
    TmmFontHelper.changeFont(tpFileNamingHint, 0.833);

    panelExtraArtwork = new JPanel();
    panelExtraArtwork.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.extraartwork"),
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panelExtraArtwork, "2, 4, default, fill");
    panelExtraArtwork.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC,
            ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
            FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC,
            ColumnSpec.decode("default:grow"), 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,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, }));

    chckbxBanner = new JCheckBox(BUNDLE.getString("mediafiletype.banner"));
    panelExtraArtwork.add(chckbxBanner, "2, 2");

    chckbxClearArt = new JCheckBox(BUNDLE.getString("mediafiletype.clearart"));
    panelExtraArtwork.add(chckbxClearArt, "4, 2");

    chckbxThumb = new JCheckBox(BUNDLE.getString("mediafiletype.thumb"));
    panelExtraArtwork.add(chckbxThumb, "6, 2");

    chckbxLogo = new JCheckBox(BUNDLE.getString("mediafiletype.logo"));
    panelExtraArtwork.add(chckbxLogo, "8, 2");

    chckbxDiscArt = new JCheckBox(BUNDLE.getString("mediafiletype.discart"));
    panelExtraArtwork.add(chckbxDiscArt, "10, 2");

    separator = new JSeparator();
    panelExtraArtwork.add(separator, "2, 4, 9, 1");

    chckbxEnableExtrathumbs = new JCheckBox(BUNDLE.getString("Settings.enable.extrathumbs"));
    panelExtraArtwork.add(chckbxEnableExtrathumbs, "2, 6, 3, 1");

    chckbxResizeExtrathumbsTo = new JCheckBox(BUNDLE.getString("Settings.resize.extrathumbs"));
    panelExtraArtwork.add(chckbxResizeExtrathumbsTo, "6, 6, 3, 1");

    spExtrathumbWidth = new JSpinner();
    panelExtraArtwork.add(spExtrathumbWidth, "10, 6");
    spExtrathumbWidth.setPreferredSize(new Dimension(49, 20));

    lblDownload = new JLabel(BUNDLE.getString("Settings.amount.autodownload"));
    panelExtraArtwork.add(lblDownload, "2, 8, 7, 1, right, default");

    spDownloadCountExtrathumbs = new JSpinner();
    panelExtraArtwork.add(spDownloadCountExtrathumbs, "10, 8");
    spDownloadCountExtrathumbs.setPreferredSize(new Dimension(49, 20));

    chckbxEnableExtrafanart = new JCheckBox(BUNDLE.getString("Settings.enable.extrafanart"));
    panelExtraArtwork.add(chckbxEnableExtrafanart, "2, 10, 9, 1");

    lblDownloadCount = new JLabel(BUNDLE.getString("Settings.amount.autodownload"));
    panelExtraArtwork.add(lblDownloadCount, "2, 12, 7, 1, right, default");

    spDownloadCountExtrafanart = new JSpinner();
    panelExtraArtwork.add(spDownloadCountExtrafanart, "10, 12");
    spDownloadCountExtrafanart.setPreferredSize(new Dimension(49, 20));

    separator = new JSeparator();
    panelExtraArtwork.add(separator, "2, 14, 9, 1");

    cbActorImages = new JCheckBox(BUNDLE.getString("Settings.actor.download"));
    panelExtraArtwork.add(cbActorImages, "2, 16, 9, 1");

    separator = new JSeparator();
    panelExtraArtwork.add(separator, "2, 18, 9, 1");

    chckbxMovieSetArtwork = new JCheckBox(BUNDLE.getString("Settings.movieset.store.movie")); //$NON-NLS-1$
    panelExtraArtwork.add(chckbxMovieSetArtwork, "2, 20, 9, 1");

    chckbxStoreMoviesetArtwork = new JCheckBox(BUNDLE.getString("Settings.movieset.store")); //$NON-NLS-1$
    panelExtraArtwork.add(chckbxStoreMoviesetArtwork, "2, 22, 9, 1");

    lblFoldername = new JLabel(BUNDLE.getString("Settings.movieset.foldername")); //$NON-NLS-1$
    panelExtraArtwork.add(lblFoldername, "2, 24, 3, 1, right, default");

    tfMovieSetArtworkFolder = new JTextField();
    panelExtraArtwork.add(tfMovieSetArtworkFolder, "6, 24, 3, 1");
    tfMovieSetArtworkFolder.setColumns(10);

    btnSelectFolder = new JButton(BUNDLE.getString("Settings.movieset.buttonselect")); //$NON-NLS-1$
    panelExtraArtwork.add(btnSelectFolder, "10, 24");
    btnSelectFolder.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            Path file = TmmUIHelper.selectDirectory(BUNDLE.getString("Settings.movieset.folderchooser")); //$NON-NLS-1$
            if (file != null && Files.isDirectory(file)) {
                tfMovieSetArtworkFolder.setText(file.toAbsolutePath().toString());
            }
        }
    });

    initDataBindings();

    // poster filenames
    List<MoviePosterNaming> moviePosterFilenames = settings.getMoviePosterFilenames();
    if (moviePosterFilenames.contains(MoviePosterNaming.MOVIE_JPG)) {
        cbMoviePosterFilename2.setSelected(true);
    }
    if (moviePosterFilenames.contains(MoviePosterNaming.POSTER_JPG)) {
        cbMoviePosterFilename4.setSelected(true);
    }
    if (moviePosterFilenames.contains(MoviePosterNaming.FOLDER_JPG)) {
        cbMoviePosterFilename6.setSelected(true);
    }
    if (moviePosterFilenames.contains(MoviePosterNaming.FILENAME_JPG)) {
        cbMoviePosterFilename7.setSelected(true);
    }
    if (moviePosterFilenames.contains(MoviePosterNaming.FILENAME_POSTER_JPG)) {
        cbMoviePosterFilename8.setSelected(true);
    }

    // fanart filenames
    List<MovieFanartNaming> movieFanartFilenames = settings.getMovieFanartFilenames();
    if (movieFanartFilenames.contains(MovieFanartNaming.FILENAME_FANART_JPG)) {
        cbMovieFanartFilename1.setSelected(true);
    }
    if (movieFanartFilenames.contains(MovieFanartNaming.FANART_JPG)) {
        cbMovieFanartFilename2.setSelected(true);
    }
    if (movieFanartFilenames.contains(MovieFanartNaming.FILENAME_FANART2_JPG)) {
        cbMovieFanartFilename3.setSelected(true);
    }

    // listen to changes of the checkboxes
    ItemListener listener = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            checkChanges();
        }
    };
    cbMovieFanartFilename2.addItemListener(listener);
    cbMovieFanartFilename3.addItemListener(listener);

    cbMovieFanartFilename1.addItemListener(listener);
    cbMoviePosterFilename2.addItemListener(listener);
    cbMoviePosterFilename4.addItemListener(listener);
    cbMoviePosterFilename7.addItemListener(listener);
    cbMoviePosterFilename8.addItemListener(listener);
    cbMoviePosterFilename6.addItemListener(listener);

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

    tableScraper.getModel().addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent arg0) {
            // click on the checkbox
            if (arg0.getColumn() == 0) {
                int row = arg0.getFirstRow();
                ArtworkScraper changedScraper = scrapers.get(row);
                if (changedScraper.active) {
                    settings.addMovieArtworkScraper(changedScraper.getScraperId());
                } else {
                    settings.removeMovieArtworkScraper(changedScraper.getScraperId());
                }
            }
        }
    });

    // 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 artwork scraper
    if (selectedIndex < 0) {
        selectedIndex = 0;
    }
    if (counter > 0) {
        tableScraper.getSelectionModel().setSelectionInterval(selectedIndex, selectedIndex);
    }
}

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

/**
 * Instantiates a new movie scraper settings panel.
 *//*from  w  w  w . j a v  a 2s  . c  o  m*/
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);
    }
}