Example usage for javax.swing UIManager getColor

List of usage examples for javax.swing UIManager getColor

Introduction

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

Prototype

public static Color getColor(Object key) 

Source Link

Document

Returns a color from the defaults.

Usage

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

/**
 * Instantiates a new movie image settings panel.
 *///from  ww  w . ja  v  a 2s  . com
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.MovieRenamerSettingsPanel.java

public MovieRenamerSettingsPanel() {
    setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("250dlu:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("fill:default"),
                    FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("fill:default:grow"),
                    FormSpecs.RELATED_GAP_ROWSPEC, }));
    // the panel renamer
    JPanel panelRenamer = new JPanel();
    panelRenamer.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.movie.renamer.title"), //$NON-NLS-1$
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panelRenamer, "2, 2, fill, fill");
    panelRenamer.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("75dlu:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC,
                    ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC,
                    ColumnSpec.decode("default:grow(3)"), FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_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.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, }));

    chckbxSpaceSubstitution = new JCheckBox(BUNDLE.getString("Settings.movie.renamer.spacesubstitution")); //$NON-NLS-1$
    chckbxSpaceSubstitution.addActionListener(actionCreateRenamerExample);

    tfMoviePath = new JTextField();
    tfMoviePath.getDocument().addDocumentListener(new DocumentListener() {
        @Override//ww w .  j a  v a  2  s . com
        public void removeUpdate(DocumentEvent arg0) {
            createRenamerExample();
        }

        @Override
        public void insertUpdate(DocumentEvent arg0) {
            createRenamerExample();
        }

        @Override
        public void changedUpdate(DocumentEvent arg0) {
            createRenamerExample();
        }
    });

    JLabel lblMoviePath = new JLabel(BUNDLE.getString("Settings.renamer.folder")); //$NON-NLS-1$
    panelRenamer.add(lblMoviePath, "2, 4, right, default");
    panelRenamer.add(tfMoviePath, "4, 4, fill, default");
    tfMoviePath.setColumns(10);
    panelRenamer.add(chckbxSpaceSubstitution, "8, 4");

    cbSeparator = new JComboBox(separators.toArray());
    panelRenamer.add(cbSeparator, "10, 4, fill, default");
    cbSeparator.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            checkChanges();
            createRenamerExample();
        }
    });

    lblDefault1T = new JLabel(BUNDLE.getString("Settings.default"));
    TmmFontHelper.changeFont(lblDefault1T, 0.833);
    panelRenamer.add(lblDefault1T, "2, 6, right, top");

    lblDefaultFolderPattern = new JLabel(MovieSettings.DEFAULT_RENAMER_FOLDER_PATTERN);
    TmmFontHelper.changeFont(lblDefaultFolderPattern, 0.833);
    panelRenamer.add(lblDefaultFolderPattern, "4, 6, default, top");

    chckbxMoviesetSingleMovie = new JCheckBox(BUNDLE.getString("Settings.renamer.moviesetsinglemovie")); //$NON-NLS-1$
    chckbxMoviesetSingleMovie.addActionListener(actionCreateRenamerExample);
    panelRenamer.add(chckbxMoviesetSingleMovie, "8, 6, 5, 1, fill, default");

    lblMMDWarning = new JLabel(BUNDLE.getString("Settings.renamer.folder.warning")); //$NON-NLS-1$
    panelRenamer.add(lblMMDWarning, "2, 8, 11, 1");

    JLabel lblMovieFilename = new JLabel(BUNDLE.getString("Settings.renamer.file")); //$NON-NLS-1$
    panelRenamer.add(lblMovieFilename, "2, 10, right, fill");

    tfMovieFilename = new JTextField();
    tfMovieFilename.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void removeUpdate(DocumentEvent arg0) {
            createRenamerExample();
        }

        @Override
        public void insertUpdate(DocumentEvent arg0) {
            createRenamerExample();
        }

        @Override
        public void changedUpdate(DocumentEvent arg0) {
            createRenamerExample();
        }
    });
    panelRenamer.add(tfMovieFilename, "4, 10, fill, default");
    tfMovieFilename.setColumns(10);
    lblMovieFilename.setLabelFor(tfMovieFilename);

    chckbxAsciiReplacement = new JCheckBox(BUNDLE.getString("Settings.renamer.asciireplacement")); //$NON-NLS-1$
    chckbxAsciiReplacement.addActionListener(actionCreateRenamerExample);
    panelRenamer.add(chckbxAsciiReplacement, "8, 10, 5, 1");

    lblDefault2T = new JLabel(BUNDLE.getString("Settings.default"));
    TmmFontHelper.changeFont(lblDefault2T, 0.833);
    panelRenamer.add(lblDefault2T, "2, 12, right, top");

    lblDefaultFilePattern = new JLabel(MovieSettings.DEFAULT_RENAMER_FILE_PATTERN);
    TmmFontHelper.changeFont(lblDefaultFilePattern, 0.833);
    panelRenamer.add(lblDefaultFilePattern, "4, 12, default, top");

    JTextPane txtpntAsciiHint = new JTextPane();
    txtpntAsciiHint.setOpaque(false);
    txtpntAsciiHint.setEditable(false);
    txtpntAsciiHint.setText(BUNDLE.getString("Settings.renamer.asciireplacement.hint")); //$NON-NLS-1$
    TmmFontHelper.changeFont(txtpntAsciiHint, 0.833);
    txtpntAsciiHint.setBackground(UIManager.getColor("Panel.background"));
    panelRenamer.add(txtpntAsciiHint, "8, 12, 5, 1, fill, fill");

    JTextPane txtrChooseAFolder = new JTextPane();
    txtrChooseAFolder.setOpaque(false);
    txtrChooseAFolder.setEditable(false);
    TmmFontHelper.changeFont(txtrChooseAFolder, 0.833);
    txtrChooseAFolder.setText(BUNDLE.getString("Settings.movie.renamer.example")); //$NON-NLS-1$
    txtrChooseAFolder.setBackground(UIManager.getColor("Panel.background"));
    panelRenamer.add(txtrChooseAFolder, "2, 14, 3, 3, fill, top");

    chckbxRemoveOtherNfos = new JCheckBox(BUNDLE.getString("Settings.renamer.removenfo")); //$NON-NLS-1$
    panelRenamer.add(chckbxRemoveOtherNfos, "8, 14, 5, 1");

    lblSubtitleLanguage = new JLabel(BUNDLE.getString("Settings.renamer.language")); //$NON-NLS-1$
    panelRenamer.add(lblSubtitleLanguage, "8, 16, right, default");

    cbSubtitleLanguage = new JComboBox(LanguageStyle.values());
    panelRenamer.add(cbSubtitleLanguage, "10, 16, 3, 1, fill, default");

    exampleEventList = GlazedLists.threadSafeList(new ObservableElementList<>(
            new BasicEventList<MovieRenamerExample>(), GlazedLists.beanConnector(MovieRenamerExample.class)));
    DefaultEventTableModel<MovieRenamerExample> exampleTableModel = new DefaultEventTableModel<>(
            GlazedListsSwing.swingThreadProxyList(exampleEventList), new MovieRenamerExampleTableFormat());

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

    JLabel lblExampleT = new JLabel(BUNDLE.getString("tmm.movie")); //$NON-NLS-1$
    panelExample.add(lblExampleT, "2, 2");

    cbMovieForPreview = new JComboBox();
    panelExample.add(cbMovieForPreview, "4, 2");

    lblExample = new JLabel("");
    panelExample.add(lblExample, "2, 4, 3, 1");
    TmmFontHelper.changeFont(lblExample, 0.916, Font.BOLD);
    tableExamples = new ZebraJTable(exampleTableModel);
    scrollPane = ZebraJTable.createStripedJScrollPane(tableExamples);
    scrollPane.setViewportView(tableExamples);
    panelExample.add(scrollPane, "2, 6, 3, 1, fill, fill");

    JTextPane txtpntTitle = new JTextPane();
    txtpntTitle.setOpaque(false);
    panelExample.add(txtpntTitle, "2, 8, 3, 1");
    TmmFontHelper.changeFont(txtpntTitle, 0.833);
    txtpntTitle.setBackground(UIManager.getColor("Panel.background"));
    txtpntTitle.setText(BUNDLE.getString("Settings.movie.renamer.optional")); //$NON-NLS-1$
    txtpntTitle.setEditable(false);
    cbMovieForPreview.addActionListener(actionCreateRenamerExample);

    initDataBindings();

    // space separator
    String replacement = settings.getMovieRenamerSpaceReplacement();
    int index = separators.indexOf(replacement);
    if (index >= 0) {
        cbSeparator.setSelectedIndex(index);
    }

    // language style
    cbSubtitleLanguage.setSelectedItem(settings.getMovieRenamerLanguageStyle());

    // examples
    exampleEventList.add(new MovieRenamerExample("$T"));
    exampleEventList.add(new MovieRenamerExample("$O"));
    exampleEventList.add(new MovieRenamerExample("$1"));
    exampleEventList.add(new MovieRenamerExample("$E"));
    exampleEventList.add(new MovieRenamerExample("$2"));
    exampleEventList.add(new MovieRenamerExample("$Y"));
    exampleEventList.add(new MovieRenamerExample("$M"));
    exampleEventList.add(new MovieRenamerExample("$N"));
    exampleEventList.add(new MovieRenamerExample("$I"));
    exampleEventList.add(new MovieRenamerExample("$C"));
    exampleEventList.add(new MovieRenamerExample("$D"));
    exampleEventList.add(new MovieRenamerExample("$G"));
    exampleEventList.add(new MovieRenamerExample("$L"));
    exampleEventList.add(new MovieRenamerExample("$R"));
    exampleEventList.add(new MovieRenamerExample("$A"));
    exampleEventList.add(new MovieRenamerExample("$V"));
    exampleEventList.add(new MovieRenamerExample("$F"));
    exampleEventList.add(new MovieRenamerExample("$S"));
    exampleEventList.add(new MovieRenamerExample("$#"));
    exampleEventList.add(new MovieRenamerExample("$3"));
    exampleEventList.add(new MovieRenamerExample("$U"));
}

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

/**
 * Instantiates a new movie settings panel.
 *///from   w w w.ja va2  s  .com
public MovieSettingsPanel() {
    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, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC,
                    RowSpec.decode("default:grow"), }));

    JPanel panelGeneral = new JPanel();
    panelGeneral.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.general"), TitledBorder.LEADING, //$NON-NLS-1$
            TitledBorder.TOP, null, null));
    add(panelGeneral, "2, 2, fill, fill");
    panelGeneral.setLayout(new FormLayout(
            new ColumnSpec[] { 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, 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.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.UNRELATED_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, }));

    JLabel lblVisiblecolumns = new JLabel(BUNDLE.getString("Settings.movie.visiblecolumns")); //$NON-NLS-1$
    panelGeneral.add(lblVisiblecolumns, "2, 2, right, default");

    chckbxYear = new JCheckBox(BUNDLE.getString("metatag.year")); //$NON-NLS-1$
    panelGeneral.add(chckbxYear, "4, 2");

    chckbxRating = new JCheckBox(BUNDLE.getString("metatag.rating")); //$NON-NLS-1$
    panelGeneral.add(chckbxRating, "6, 2");

    chckbxNfo = new JCheckBox(BUNDLE.getString("metatag.nfo")); //$NON-NLS-1$
    panelGeneral.add(chckbxNfo, "8, 2");

    chckbxMetadata = new JCheckBox(BUNDLE.getString("tmm.metadata")); //$NON-NLS-1$
    panelGeneral.add(chckbxMetadata, "10, 2");

    chckbxDateAdded = new JCheckBox(BUNDLE.getString("metatag.dateadded")); //$NON-NLS-1$
    panelGeneral.add(chckbxDateAdded, "12, 2");

    chckbxImages = new JCheckBox(BUNDLE.getString("metatag.images")); //$NON-NLS-1$
    panelGeneral.add(chckbxImages, "4, 4");

    chckbxTrailer = new JCheckBox(BUNDLE.getString("metatag.trailer")); //$NON-NLS-1$
    panelGeneral.add(chckbxTrailer, "6, 4");

    chckbxSubtitles = new JCheckBox(BUNDLE.getString("metatag.subtitles")); //$NON-NLS-1$
    panelGeneral.add(chckbxSubtitles, "8, 4");

    chckbxWatched = new JCheckBox(BUNDLE.getString("metatag.watched")); //$NON-NLS-1$
    panelGeneral.add(chckbxWatched, "10, 4");

    JLabel lblSaveUiFilter = new JLabel(BUNDLE.getString("Settings.movie.persistuifilter")); //$NON-NLS-1$
    panelGeneral.add(lblSaveUiFilter, "2, 6, right, default");

    chckbxSaveUiFilter = new JCheckBox("");
    panelGeneral.add(chckbxSaveUiFilter, "4, 6");

    JSeparator separator_4 = new JSeparator();
    panelGeneral.add(separator_4, "2, 8, 11, 1");

    JLabel lblImageCache = new JLabel(BUNDLE.getString("Settings.imagecacheimport"));
    panelGeneral.add(lblImageCache, "2, 10, right, default");

    chckbxImageCache = new JCheckBox(BUNDLE.getString("Settings.imagecacheimporthint")); //$NON-NLS-1$
    TmmFontHelper.changeFont(chckbxImageCache, 0.833);
    panelGeneral.add(chckbxImageCache, "4, 10, 7, 1");

    JLabel lblRuntimeFromMedia = new JLabel(BUNDLE.getString("Settings.runtimefrommediafile"));
    panelGeneral.add(lblRuntimeFromMedia, "2, 12, right, default");

    chckbxRuntimeFromMf = new JCheckBox("");
    panelGeneral.add(chckbxRuntimeFromMf, "4, 12");

    JSeparator separator = new JSeparator();
    panelGeneral.add(separator, "2, 14, 11, 1");

    final JLabel lblAutomaticRename = new JLabel(BUNDLE.getString("Settings.movie.automaticrename")); //$NON-NLS-1$
    panelGeneral.add(lblAutomaticRename, "2, 16, right, default");

    chckbxRename = new JCheckBox(BUNDLE.getString("Settings.movie.automaticrename.desc")); //$NON-NLS-1$
    panelGeneral.add(chckbxRename, "4, 16, 7, 1");

    JLabel lblTraktTv = new JLabel(BUNDLE.getString("Settings.trakt"));//$NON-NLS-1$
    panelGeneral.add(lblTraktTv, "2, 18");

    chckbxTraktTv = new JCheckBox("");
    panelGeneral.add(chckbxTraktTv, "4, 18");

    JButton btnClearTraktTvMovies = new JButton(BUNDLE.getString("Settings.trakt.clearmovies"));//$NON-NLS-1$
    btnClearTraktTvMovies.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            int confirm = JOptionPane.showOptionDialog(null,
                    BUNDLE.getString("Settings.trakt.clearmovies.hint"),
                    BUNDLE.getString("Settings.trakt.clearmovies"), JOptionPane.YES_NO_OPTION, //$NON-NLS-1$
                    JOptionPane.QUESTION_MESSAGE, null, null, null);
            if (confirm == JOptionPane.YES_OPTION) {
                TmmTask task = new ClearTraktTvTask(true, false);
                TmmTaskManager.getInstance().addUnnamedTask(task);
            }
        }
    });
    panelGeneral.add(btnClearTraktTvMovies, "6, 18, 3, 1, left, default");

    JPanel panelMovieDataSources = new JPanel();

    panelMovieDataSources.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.movie.datasource"), //$NON-NLS-1$
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panelMovieDataSources, "2, 4, 3, 1, fill, fill");
    panelMovieDataSources.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                    ColumnSpec.decode("150dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("150dlu:grow(2)"),
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("100px:grow"),
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, }));

    JLabel lblDataSource = new JLabel(BUNDLE.getString("Settings.source")); //$NON-NLS-1$
    panelMovieDataSources.add(lblDataSource, "2, 2, 5, 1");

    JLabel lblIngore = new JLabel(BUNDLE.getString("Settings.ignore")); //$NON-NLS-1$
    panelMovieDataSources.add(lblIngore, "12, 2");

    JScrollPane scrollPaneDataSources = new JScrollPane();
    panelMovieDataSources.add(scrollPaneDataSources, "2, 4, 5, 1, fill, fill");

    listDataSources = new JList<>();
    scrollPaneDataSources.setViewportView(listDataSources);

    JPanel panelMovieSourcesButtons = new JPanel();
    panelMovieDataSources.add(panelMovieSourcesButtons, "8, 4, fill, top");
    panelMovieSourcesButtons
            .setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, }, new RowSpec[] {
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, }));

    JButton btnAdd = new JButton(IconManager.LIST_ADD);
    btnAdd.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$
    btnAdd.setMargin(new Insets(2, 2, 2, 2));
    btnAdd.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            Path file = TmmUIHelper.selectDirectory(BUNDLE.getString("Settings.datasource.folderchooser")); //$NON-NLS-1$
            if (file != null && Files.isDirectory(file)) {
                settings.addMovieDataSources(file.toAbsolutePath().toString());
            }
        }
    });

    panelMovieSourcesButtons.add(btnAdd, "1, 1, fill, top");

    JButton btnRemove = new JButton(IconManager.LIST_REMOVE);
    btnRemove.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$
    btnRemove.setMargin(new Insets(2, 2, 2, 2));
    btnRemove.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            int row = listDataSources.getSelectedIndex();
            if (row != -1) { // nothing selected
                String path = MovieModuleManager.MOVIE_SETTINGS.getMovieDataSource().get(row);
                String[] choices = { BUNDLE.getString("Button.continue"), BUNDLE.getString("Button.abort") }; //$NON-NLS-1$
                int decision = JOptionPane.showOptionDialog(null,
                        String.format(BUNDLE.getString("Settings.movie.datasource.remove.info"), path),
                        BUNDLE.getString("Settings.datasource.remove"), JOptionPane.YES_NO_OPTION,
                        JOptionPane.PLAIN_MESSAGE, null, choices, BUNDLE.getString("Button.abort")); //$NON-NLS-1$
                if (decision == 0) {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    MovieModuleManager.MOVIE_SETTINGS.removeMovieDataSources(path);
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
            }
        }
    });
    panelMovieSourcesButtons.add(btnRemove, "1, 3, fill, top");

    JScrollPane scrollPaneIgnore = new JScrollPane();
    panelMovieDataSources.add(scrollPaneIgnore, "12, 4, fill, fill");

    listIgnore = new JList<>();
    scrollPaneIgnore.setViewportView(listIgnore);

    JPanel panelIgnoreButtons = new JPanel();
    panelMovieDataSources.add(panelIgnoreButtons, "14, 4, fill, fill");
    panelIgnoreButtons.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, }, new RowSpec[] {
            FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, }));

    JButton btnAddIgnore = new JButton(IconManager.LIST_ADD);
    btnAddIgnore.setToolTipText(BUNDLE.getString("Settings.addignore")); //$NON-NLS-1$
    btnAddIgnore.setMargin(new Insets(2, 2, 2, 2));
    btnAddIgnore.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Path file = TmmUIHelper.selectDirectory(BUNDLE.getString("Settings.ignore")); //$NON-NLS-1$
            if (file != null && Files.isDirectory(file)) {
                settings.addMovieSkipFolder(file.toAbsolutePath().toString());
            }
        }
    });
    panelIgnoreButtons.add(btnAddIgnore, "1, 1");

    JButton btnRemoveIgnore = new JButton(IconManager.LIST_REMOVE);
    btnRemoveIgnore.setToolTipText(BUNDLE.getString("Settings.removeignore")); //$NON-NLS-1$
    btnRemoveIgnore.setMargin(new Insets(2, 2, 2, 2));
    btnRemoveIgnore.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            int row = listIgnore.getSelectedIndex();
            if (row != -1) { // nothing selected
                String ingore = settings.getMovieSkipFolders().get(row);
                settings.removeMovieSkipFolder(ingore);
            }
        }
    });
    panelIgnoreButtons.add(btnRemoveIgnore, "1, 3");

    JPanel panel = new JPanel();
    panelMovieDataSources.add(panel, "2, 8, 13, 1, fill, fill");
    panel.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                    FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("20dlu"),
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                    FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, },
            new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, }));

    JLabel lblNfoFormat = new JLabel(BUNDLE.getString("Settings.nfoFormat"));
    panel.add(lblNfoFormat, "1, 1, right, default");

    cbNfoFormat = new JComboBox(MovieConnectors.values());
    panel.add(cbNfoFormat, "3, 1, fill, default");

    JLabel lblNfoFileNaming = new JLabel(BUNDLE.getString("Settings.nofFileNaming")); //$NON-NLS-1$
    panel.add(lblNfoFileNaming, "7, 1, right, default");

    cbMovieNfoFilename1 = new JCheckBox(BUNDLE.getString("Settings.moviefilename") + ".nfo"); //$NON-NLS-1$
    panel.add(cbMovieNfoFilename1, "9, 1");

    cbMovieNfoFilename2 = new JCheckBox("movie.nfo");
    panel.add(cbMovieNfoFilename2, "9, 2");
    cbMovieNfoFilename2.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            checkChanges();
        }
    });

    cbMovieNfoFilename3 = new JCheckBox(BUNDLE.getString("Settings.nfo.discstyle")); //$NON-NLS-1$
    panel.add(cbMovieNfoFilename3, "9, 3");
    cbMovieNfoFilename3.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            checkChanges();
        }
    });

    final JLabel lblCertificationStyle = new JLabel(BUNDLE.getString("Settings.certificationformat")); //$NON-NLS-1$
    panel.add(lblCertificationStyle, "1, 5, right, default");

    cbCertificationStyle = new JComboBox();
    panel.add(cbCertificationStyle, "3, 5, 7, 1, fill, default");

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

    JTextPane txtpntBadWordsHint = new JTextPane();
    txtpntBadWordsHint.setBackground(UIManager.getColor("Panel.background"));
    txtpntBadWordsHint.setText(BUNDLE.getString("Settings.movie.badwords.hint")); //$NON-NLS-1$
    TmmFontHelper.changeFont(txtpntBadWordsHint, 0.833);
    panelBadWords.add(txtpntBadWordsHint, "2, 2, 3, 1, fill, default");

    JScrollPane scpBadWords = new JScrollPane();
    panelBadWords.add(scpBadWords, "2, 4, fill, fill");

    listBadWords = new JList<>();
    scpBadWords.setViewportView(listBadWords);

    JButton btnRemoveBadWord = new JButton(IconManager.LIST_REMOVE);
    btnRemoveBadWord.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$
    btnRemoveBadWord.setMargin(new Insets(2, 2, 2, 2));
    btnRemoveBadWord.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            int row = listBadWords.getSelectedIndex();
            if (row != -1) {
                String badWord = MovieModuleManager.MOVIE_SETTINGS.getBadWords().get(row);
                MovieModuleManager.MOVIE_SETTINGS.removeBadWord(badWord);
            }
        }
    });
    panelBadWords.add(btnRemoveBadWord, "4, 4, default, bottom");

    tfAddBadword = new JTextField();
    tfAddBadword.setColumns(10);
    panelBadWords.add(tfAddBadword, "2, 6, fill, default");

    JButton btnAddBadWord = new JButton(IconManager.LIST_ADD);
    btnAddBadWord.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$
    btnAddBadWord.setMargin(new Insets(2, 2, 2, 2));
    btnAddBadWord.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (StringUtils.isNotEmpty(tfAddBadword.getText())) {
                MovieModuleManager.MOVIE_SETTINGS.addBadWord(tfAddBadword.getText());
                tfAddBadword.setText("");
            }
        }
    });
    panelBadWords.add(btnAddBadWord, "4, 6");

    initDataBindings();

    {
        // NFO filenames
        List<MovieNfoNaming> movieNfoFilenames = settings.getMovieNfoFilenames();
        if (movieNfoFilenames.contains(MovieNfoNaming.FILENAME_NFO)) {
            cbMovieNfoFilename1.setSelected(true);
        }
        if (movieNfoFilenames.contains(MovieNfoNaming.MOVIE_NFO)) {
            cbMovieNfoFilename2.setSelected(true);
        }
        if (movieNfoFilenames.contains(MovieNfoNaming.DISC_NFO)) {
            cbMovieNfoFilename3.setSelected(true);
        }

        if (!Globals.isDonator()) {
            chckbxTraktTv.setSelected(false);
            chckbxTraktTv.setEnabled(false);
            btnClearTraktTvMovies.setEnabled(false);
        }

        // set default certification style
        cbNfoFormat.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                if (cbNfoFormat.getSelectedItem() == MovieConnectors.MP) {
                    for (int i = 0; i < cbCertificationStyle.getItemCount(); i++) {
                        CertificationStyleWrapper wrapper = cbCertificationStyle.getItemAt(i);
                        if (wrapper.style == CertificationStyle.TECHNICAL) {
                            cbCertificationStyle.setSelectedItem(wrapper);
                            break;
                        }
                    }
                } else if (cbNfoFormat.getSelectedItem() == MovieConnectors.XBMC
                        || cbNfoFormat.getSelectedItem() == MovieConnectors.KODI) {
                    for (int i = 0; i < cbCertificationStyle.getItemCount(); i++) {
                        CertificationStyleWrapper wrapper = cbCertificationStyle.getItemAt(i);
                        if (wrapper.style == CertificationStyle.LARGE) {
                            cbCertificationStyle.setSelectedItem(wrapper);
                            break;
                        }
                    }
                }
            }
        });

        // certification examples
        for (CertificationStyle style : CertificationStyle.values()) {
            CertificationStyleWrapper wrapper = new CertificationStyleWrapper();
            wrapper.style = style;
            cbCertificationStyle.addItem(wrapper);
            if (style == settings.getMovieCertificationStyle()) {
                cbCertificationStyle.setSelectedItem(wrapper);
            }
        }

        cbCertificationStyle.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                checkChanges();
            }
        });

        // item listener
        cbMovieNfoFilename1.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                checkChanges();
            }
        });
    }

}

From source file:org.tinymediamanager.ui.settings.FileTypesSettingsPanel.java

/**
 * Instantiates a new general settings panel.
 *///from  w  ww  . ja v a  2s. c  om
public FileTypesSettingsPanel() {
    setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:max(200px;min)"),
                    FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(200px;default)"),
                    FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(200px;default)"),
                    FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(200px;default)"), },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("top:default"),
                    FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("top:default"),
                    FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), }));

    panelVideoFiletypes = new JPanel();
    panelVideoFiletypes.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), //$NON-NLS-1$
            BUNDLE.getString("Settings.videofiletypes"), TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelVideoFiletypes.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC,
            ColumnSpec.decode("100px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
            FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, }));

    JScrollPane scrollPaneVideoFiletypes = new JScrollPane();
    panelVideoFiletypes.add(scrollPaneVideoFiletypes, "2, 2, 5, 1, fill, fill");

    listVideoFiletypes = new JList();
    scrollPaneVideoFiletypes.setViewportView(listVideoFiletypes);

    tfVideoFiletype = new JTextField();
    panelVideoFiletypes.add(tfVideoFiletype, "2, 4, fill, default");
    tfVideoFiletype.setColumns(10);

    JButton btnAddVideoFiletype = new JButton(IconManager.LIST_ADD);
    btnAddVideoFiletype.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$
    btnAddVideoFiletype.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (StringUtils.isNotEmpty(tfVideoFiletype.getText())) {
                Globals.settings.addVideoFileTypes(tfVideoFiletype.getText());
                tfVideoFiletype.setText("");
            }
        }
    });

    panelVideoFiletypes.add(btnAddVideoFiletype, "4, 4");
    add(panelVideoFiletypes, "2, 2, fill, fill");

    JButton btnRemoveVideoFiletype = new JButton(IconManager.LIST_REMOVE);
    btnRemoveVideoFiletype.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$
    btnRemoveVideoFiletype.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            int row = listVideoFiletypes.getSelectedIndex();
            if (row != -1) {
                String prefix = Globals.settings.getVideoFileType().get(row);
                Globals.settings.removeVideoFileType(prefix);
            }
        }
    });
    panelVideoFiletypes.add(btnRemoveVideoFiletype, "6, 4, default, bottom");

    panelSubtitleFiletypes = new JPanel();
    add(panelSubtitleFiletypes, "4, 2, fill, fill");
    panelSubtitleFiletypes.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), //$NON-NLS-1$
            BUNDLE.getString("Settings.extrafiletypes"), TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelSubtitleFiletypes.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC,
            ColumnSpec.decode("100px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
            FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, }));
    JScrollPane scrollPaneSubtitleFiletypes = new JScrollPane();
    panelSubtitleFiletypes.add(scrollPaneSubtitleFiletypes, "2, 2, 5, 1, fill, fill");

    listSubtitleFiletypes = new JList();
    scrollPaneSubtitleFiletypes.setViewportView(listSubtitleFiletypes);

    tfSubtitleFiletype = new JTextField();
    panelSubtitleFiletypes.add(tfSubtitleFiletype, "2, 4, fill, default");
    tfSubtitleFiletype.setColumns(10);

    JButton btnAddSubtitleFiletype = new JButton(IconManager.LIST_ADD);
    btnAddSubtitleFiletype.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$
    btnAddSubtitleFiletype.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (StringUtils.isNotEmpty(tfSubtitleFiletype.getText())) {
                Globals.settings.addSubtitleFileTypes(tfSubtitleFiletype.getText());
                tfSubtitleFiletype.setText("");
            }
        }
    });
    panelSubtitleFiletypes.add(btnAddSubtitleFiletype, "4, 4");

    JButton btnRemoveSubtitleFiletype = new JButton(IconManager.LIST_REMOVE);
    btnRemoveSubtitleFiletype.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$
    btnRemoveSubtitleFiletype.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            int row = listSubtitleFiletypes.getSelectedIndex();
            if (row != -1) {
                String prefix = Globals.settings.getSubtitleFileType().get(row);
                Globals.settings.removeSubtitleFileType(prefix);
            }
        }
    });
    panelSubtitleFiletypes.add(btnRemoveSubtitleFiletype, "6, 4, default, bottom");

    panelAudioFiletypes = new JPanel();
    add(panelAudioFiletypes, "6, 2, fill, fill");
    panelAudioFiletypes.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), //$NON-NLS-1$
            BUNDLE.getString("Settings.audiofiletypes"), TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelAudioFiletypes.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC,
            ColumnSpec.decode("100px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
            FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, }));
    JScrollPane scrollPaneAudioFiletypes = new JScrollPane();
    panelAudioFiletypes.add(scrollPaneAudioFiletypes, "2, 2, 5, 1, fill, fill");

    listAudioFiletypes = new JList();
    scrollPaneAudioFiletypes.setViewportView(listAudioFiletypes);

    tfAudioFiletype = new JTextField();
    panelAudioFiletypes.add(tfAudioFiletype, "2, 4, fill, default");
    tfAudioFiletype.setColumns(10);

    JButton btnAddAudioFiletype = new JButton(IconManager.LIST_ADD);
    btnAddAudioFiletype.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$
    btnAddAudioFiletype.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (StringUtils.isNotEmpty(tfAudioFiletype.getText())) {
                Globals.settings.addAudioFileTypes(tfAudioFiletype.getText());
                tfAudioFiletype.setText("");
            }
        }
    });
    panelAudioFiletypes.add(btnAddAudioFiletype, "4, 4");

    JButton btnRemoveAudioFiletype = new JButton(IconManager.LIST_REMOVE);
    btnRemoveAudioFiletype.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$
    btnRemoveAudioFiletype.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            int row = listAudioFiletypes.getSelectedIndex();
            if (row != -1) {
                String prefix = Globals.settings.getAudioFileType().get(row);
                Globals.settings.removeAudioFileType(prefix);
            }
        }
    });
    panelAudioFiletypes.add(btnRemoveAudioFiletype, "6, 4, default, bottom");

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

    JScrollPane scrollPaneSortPrefixes = new JScrollPane();
    panelSortOptions.add(scrollPaneSortPrefixes, "2, 2, 5, 1, fill, fill");

    listSortPrefixes = new JList();
    scrollPaneSortPrefixes.setViewportView(listSortPrefixes);

    tfSortPrefix = new JTextField();
    panelSortOptions.add(tfSortPrefix, "2, 4, fill, default");
    tfSortPrefix.setColumns(10);

    JButton btnAddSortPrefix = new JButton(IconManager.LIST_ADD);
    btnAddSortPrefix.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$
    btnAddSortPrefix.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (StringUtils.isNotEmpty(tfSortPrefix.getText())) {
                Globals.settings.addTitlePrefix(tfSortPrefix.getText());
                tfSortPrefix.setText("");
                MovieList.getInstance().invalidateTitleSortable();
                TvShowList.getInstance().invalidateTitleSortable();
            }
        }
    });
    panelSortOptions.add(btnAddSortPrefix, "4, 4");

    JButton btnRemoveSortPrefix = new JButton(IconManager.LIST_REMOVE);
    btnRemoveSortPrefix.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$
    btnRemoveSortPrefix.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            int row = listSortPrefixes.getSelectedIndex();
            if (row != -1) {
                String prefix = Globals.settings.getTitlePrefix().get(row);
                Globals.settings.removeTitlePrefix(prefix);
                MovieList.getInstance().invalidateTitleSortable();
                TvShowList.getInstance().invalidateTitleSortable();
            }
        }
    });
    panelSortOptions.add(btnRemoveSortPrefix, "6, 4, default, bottom");

    JTextPane tpSortingHints = new JTextPane();
    TmmFontHelper.changeFont(tpSortingHints, 0.833);
    tpSortingHints.setText(BUNDLE.getString("Settings.sorting.info")); //$NON-NLS-1$
    tpSortingHints.setBackground(UIManager.getColor("Panel.background"));
    panelSortOptions.add(tpSortingHints, "2, 6, 3, 1, fill, fill");

    initDataBindings();
}

From source file:org.tinymediamanager.ui.tvshows.settings.TvShowRenamerSettingsPanel.java

public TvShowRenamerSettingsPanel() {
    setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                    FormFactory.RELATED_GAP_ROWSPEC, }));

    exampleEventList = GlazedLists.threadSafeList(new ObservableElementList<>(
            new BasicEventList<TvShowRenamerExample>(), GlazedLists.beanConnector(TvShowRenamerExample.class)));
    DefaultEventTableModel<TvShowRenamerExample> exampleTableModel = new DefaultEventTableModel<>(
            GlazedListsSwing.swingThreadProxyList(exampleEventList), new TvShowRenamerExampleTableFormat());

    // the panel renamer
    ActionListener renamerActionListener = new ActionListener() {
        @Override//from   w  w  w .  j ava2  s .  c o  m
        public void actionPerformed(ActionEvent arg0) {
            checkChanges();
            createRenamerExample();
        }
    };

    DocumentListener documentListener = new DocumentListener() {
        @Override
        public void removeUpdate(DocumentEvent arg0) {
            createRenamerExample();
        }

        @Override
        public void insertUpdate(DocumentEvent arg0) {
            createRenamerExample();
        }

        @Override
        public void changedUpdate(DocumentEvent arg0) {
            createRenamerExample();
        }
    };

    JPanel panelRenamer = new JPanel();
    panelRenamer.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.tvshow.renamer.title"), //$NON-NLS-1$
            TitledBorder.LEADING, TitledBorder.TOP, null, null));

    add(panelRenamer, "2, 2, fill, fill");
    panelRenamer.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.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_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,
                    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.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, }));
    {
        final JLabel lblDefault = new JLabel(BUNDLE.getString("Settings.default")); //$NON-NLS-1$
        TmmFontHelper.changeFont(lblDefault, 0.833);
        panelRenamer.add(lblDefault, "6, 2");
    }

    lblTvShowFolder = new JLabel(BUNDLE.getString("Settings.tvshowfoldername")); //$NON-NLS-1$
    panelRenamer.add(lblTvShowFolder, "2, 3, right, default");

    tfTvShowFolder = new JTextField();
    panelRenamer.add(tfTvShowFolder, "4, 3, fill, default");
    tfTvShowFolder.getDocument().addDocumentListener(documentListener);
    {
        final JLabel lblDefaultFolderName = new JLabel("$N ($Y)"); //$NON-NLS-1$
        TmmFontHelper.changeFont(lblDefaultFolderName, 0.833);
        panelRenamer.add(lblDefaultFolderName, "6, 3");
    }

    lblSeasonFolderName = new JLabel(BUNDLE.getString("Settings.tvshowseasonfoldername")); //$NON-NLS-1$
    panelRenamer.add(lblSeasonFolderName, "2, 5, right, default");

    tfSeasonFoldername = new JTextField();
    panelRenamer.add(tfSeasonFoldername, "4, 5, fill, default");
    tfSeasonFoldername.getDocument().addDocumentListener(documentListener);
    {
        final JLabel lblDefaultSeasonFoldername = new JLabel("Season $1"); //$NON-NLS-1$
        TmmFontHelper.changeFont(lblDefaultSeasonFoldername, 0.833);
        panelRenamer.add(lblDefaultSeasonFoldername, "6, 5");
    }

    lblEpisodeFileName = new JLabel(BUNDLE.getString("Settings.tvshowfilename"));//$NON-NLS-1$
    panelRenamer.add(lblEpisodeFileName, "2, 7, right, default");

    tfEpisodeFilename = new JTextField();
    panelRenamer.add(tfEpisodeFilename, "4, 7, fill, default");
    tfEpisodeFilename.getDocument().addDocumentListener(documentListener);

    chckbxAsciiReplacement = new JCheckBox(BUNDLE.getString("Settings.renamer.asciireplacement")); //$NON-NLS-1$
    chckbxAsciiReplacement.addActionListener(renamerActionListener);

    chckbxSpaceReplacement = new JHintCheckBox(BUNDLE.getString("Settings.movie.renamer.spacesubstitution")); //$NON-NLS-1$
    chckbxSpaceReplacement.setHintIcon(IconManager.HINT);
    chckbxSpaceReplacement.setToolTipText(BUNDLE.getString("Settings.tvshowspacereplacement.hint")); //$NON-NLS-1$
    chckbxSpaceReplacement.addActionListener(renamerActionListener);
    {
        final JLabel lblDefaultEpisodeFilename = new JLabel("$N - S$2E$E - $T"); //$NON-NLS-1$
        TmmFontHelper.changeFont(lblDefaultEpisodeFilename, 0.833);
        panelRenamer.add(lblDefaultEpisodeFilename, "6, 7");
    }
    panelRenamer.add(chckbxSpaceReplacement, "2, 11, right, default");

    cbSpaceReplacement = new JComboBox(spaceReplacement.toArray());
    panelRenamer.add(cbSpaceReplacement, "4, 11, fill, default");
    cbSpaceReplacement.addActionListener(renamerActionListener);
    panelRenamer.add(chckbxAsciiReplacement, "2, 13, 9, 1");

    txtpntAsciiHint = new JTextPane();
    txtpntAsciiHint.setText(BUNDLE.getString("Settings.renamer.asciireplacement.hint")); //$NON-NLS-1$
    TmmFontHelper.changeFont(txtpntAsciiHint, 0.833);
    txtpntAsciiHint.setBackground(UIManager.getColor("Panel.background"));
    panelRenamer.add(txtpntAsciiHint, "2, 15, 7, 1, fill, fill");

    JLabel lblLanguageStyle = new JLabel(BUNDLE.getString("Settings.renamer.language")); //$NON-NLS-1$
    panelRenamer.add(lblLanguageStyle, "2, 17, right, default");

    cbLanguageStyle = new JComboBox(LanguageStyle.values());
    panelRenamer.add(cbLanguageStyle, "4, 17, 3, 1, fill, default");

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

    JLabel lblExampleTvShowT = new JLabel(BUNDLE.getString("metatag.tvshow"));
    panelExample.add(lblExampleTvShowT, "2, 2, right, default");

    cbTvShowForPreview = new JComboBox();
    cbTvShowForPreview.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            buildAndInstallEpisodeArray();
            createRenamerExample();
        }
    });
    panelExample.add(cbTvShowForPreview, "4, 2");

    JLabel lblExampleEpisodeT = new JLabel(BUNDLE.getString("metatag.episode"));
    panelExample.add(lblExampleEpisodeT, "2, 4, right, default");

    cbEpisodeForPreview = new JComboBox();
    cbEpisodeForPreview.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            createRenamerExample();
        }
    });
    panelExample.add(cbEpisodeForPreview, "4, 4, fill, default");

    lblExample = new JLabel("");
    TmmFontHelper.changeFont(lblExample, Font.BOLD);
    panelExample.add(lblExample, "2, 6, 3, 1");

    tableExamples = new ZebraJTable(exampleTableModel);
    scrollPane = ZebraJTable.createStripedJScrollPane(tableExamples);
    scrollPane.setViewportView(tableExamples);
    panelExample.add(scrollPane, "2, 8, 3, 1, fill, fill");

    initDataBindings();

    String spaceReplacement = settings.getRenamerSpaceReplacement();
    int index = this.spaceReplacement.indexOf(spaceReplacement);
    if (index >= 0) {
        cbSpaceReplacement.setSelectedIndex(index);
    }

    // examples
    exampleEventList.add(new TvShowRenamerExample("$T"));
    exampleEventList.add(new TvShowRenamerExample("$1"));
    exampleEventList.add(new TvShowRenamerExample("$2"));
    exampleEventList.add(new TvShowRenamerExample("$3"));
    exampleEventList.add(new TvShowRenamerExample("$4"));
    exampleEventList.add(new TvShowRenamerExample("$E"));
    exampleEventList.add(new TvShowRenamerExample("$D"));
    exampleEventList.add(new TvShowRenamerExample("$Y"));
    exampleEventList.add(new TvShowRenamerExample("$N"));
    exampleEventList.add(new TvShowRenamerExample("$M"));
    exampleEventList.add(new TvShowRenamerExample("$R"));
    exampleEventList.add(new TvShowRenamerExample("$A"));
    exampleEventList.add(new TvShowRenamerExample("$V"));
    exampleEventList.add(new TvShowRenamerExample("$F"));
    exampleEventList.add(new TvShowRenamerExample("$S"));

}

From source file:org.tinymediamanager.ui.tvshows.settings.TvShowSettingsPanel.java

/**
 * Instantiates a new tv show settings panel.
 *///from  w w w.j a v  a2  s.c  om
public TvShowSettingsPanel() {
    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, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                    FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow(3)"), }));

    JPanel panelGeneral = new JPanel();
    panelGeneral.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.general"), TitledBorder.LEADING, //$NON-NLS-1$
            TitledBorder.TOP, null, null));
    add(panelGeneral, "2, 2, fill, fill");
    panelGeneral.setLayout(new FormLayout(
            new ColumnSpec[] { 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"),
                    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, }));

    lblImageCache = new JLabel(BUNDLE.getString("Settings.imagecacheimport"));
    panelGeneral.add(lblImageCache, "2, 2");

    chckbxImageCache = new JCheckBox("");
    panelGeneral.add(chckbxImageCache, "4, 2");

    lblImageCacheHint = new JLabel(BUNDLE.getString("Settings.imagecacheimporthint")); //$NON-NLS-1$
    panelGeneral.add(lblImageCacheHint, "6, 2, 3, 1");
    TmmFontHelper.changeFont(lblImageCacheHint, 0.833);

    final JSeparator separator = new JSeparator();
    panelGeneral.add(separator, "2, 4, 7, 1");

    JLabel lblTraktTv = new JLabel(BUNDLE.getString("Settings.trakt"));//$NON-NLS-1$
    panelGeneral.add(lblTraktTv, "2, 6");

    chckbxTraktTv = new JCheckBox("");
    panelGeneral.add(chckbxTraktTv, "4, 6");
    btnClearTraktTvShows = new JButton(BUNDLE.getString("Settings.trakt.cleartvshows"));//$NON-NLS-1$
    btnClearTraktTvShows.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            int confirm = JOptionPane.showOptionDialog(null,
                    BUNDLE.getString("Settings.trakt.cleartvshows.hint"),
                    BUNDLE.getString("Settings.trakt.cleartvshows"), JOptionPane.YES_NO_OPTION, //$NON-NLS-1$
                    JOptionPane.QUESTION_MESSAGE, null, null, null);
            if (confirm == JOptionPane.YES_OPTION) {
                TmmTask task = new ClearTraktTvTask(false, true);
                TmmTaskManager.getInstance().addUnnamedTask(task);
            }
        }
    });
    panelGeneral.add(btnClearTraktTvShows, "6, 6");

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

    JTextPane txtpntBadWordsHint = new JTextPane();
    txtpntBadWordsHint.setBackground(UIManager.getColor("Panel.background"));
    txtpntBadWordsHint.setText(BUNDLE.getString("Settings.tvshow.badwords.hint")); //$NON-NLS-1$
    TmmFontHelper.changeFont(txtpntBadWordsHint, 0.833);
    panelBadWords.add(txtpntBadWordsHint, "2, 2, 3, 1, fill, default");

    JScrollPane scpBadWords = new JScrollPane();
    panelBadWords.add(scpBadWords, "2, 4, fill, fill");

    listBadWords = new JList<>();
    scpBadWords.setViewportView(listBadWords);

    JButton btnRemoveBadWord = new JButton(IconManager.LIST_REMOVE);
    btnRemoveBadWord.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$
    btnRemoveBadWord.setMargin(new Insets(2, 2, 2, 2));
    btnRemoveBadWord.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            int row = listBadWords.getSelectedIndex();
            if (row != -1) {
                String badWord = TvShowModuleManager.SETTINGS.getBadWords().get(row);
                TvShowModuleManager.SETTINGS.removeBadWord(badWord);
            }
        }
    });
    panelBadWords.add(btnRemoveBadWord, "4, 4, default, bottom");

    tfAddBadword = new JTextField();
    tfAddBadword.setColumns(10);
    panelBadWords.add(tfAddBadword, "2, 6, fill, default");

    JButton btnAddBadWord = new JButton(IconManager.LIST_ADD);
    btnAddBadWord.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$
    btnAddBadWord.setMargin(new Insets(2, 2, 2, 2));
    btnAddBadWord.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (StringUtils.isNotEmpty(tfAddBadword.getText())) {
                TvShowModuleManager.SETTINGS.addBadWord(tfAddBadword.getText());
                tfAddBadword.setText("");
            }
        }
    });
    panelBadWords.add(btnAddBadWord, "4, 6");

    {
        JPanel panelTvShowDataSources = new JPanel();

        panelTvShowDataSources.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.tvshowdatasource"), //$NON-NLS-1$
                TitledBorder.LEADING, TitledBorder.TOP, null, null));
        add(panelTvShowDataSources, "2, 4, 3, 1, fill, top");
        panelTvShowDataSources.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC,
                FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("50dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC,
                FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC,
                FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow(2)"),
                FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, },
                new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                        FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("160px:grow"),
                        FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                        FormSpecs.RELATED_GAP_ROWSPEC, }));

        JLabel lblDataSource = new JLabel(BUNDLE.getString("Settings.source")); //$NON-NLS-1$
        panelTvShowDataSources.add(lblDataSource, "2, 2, 5, 1");

        JLabel lblSkipFolders = new JLabel(BUNDLE.getString("Settings.ignore"));//$NON-NLS-1$
        panelTvShowDataSources.add(lblSkipFolders, "12, 2, 3, 1");

        JScrollPane scrollPaneDatasource = new JScrollPane();
        panelTvShowDataSources.add(scrollPaneDatasource, "2, 4, 5, 1, fill, fill");

        listDatasources = new JList<>();
        scrollPaneDatasource.setViewportView(listDatasources);

        JPanel panelTvShowSourcesButtons = new JPanel();
        panelTvShowDataSources.add(panelTvShowSourcesButtons, "8, 4, default, top");
        panelTvShowSourcesButtons.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, },
                new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                        FormSpecs.DEFAULT_ROWSPEC, }));

        JButton btnAdd = new JButton(IconManager.LIST_ADD);
        btnAdd.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$
        btnAdd.setMargin(new Insets(2, 2, 2, 2));
        btnAdd.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                Path file = TmmUIHelper
                        .selectDirectory(BUNDLE.getString("Settings.tvshowdatasource.folderchooser")); //$NON-NLS-1$
                if (file != null && Files.isDirectory(file)) {
                    settings.addTvShowDataSources(file.toAbsolutePath().toString());
                }
            }
        });

        panelTvShowSourcesButtons.add(btnAdd, "1, 1, fill, top");

        JButton btnRemove = new JButton(IconManager.LIST_REMOVE);
        btnRemove.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$
        btnRemove.setMargin(new Insets(2, 2, 2, 2));
        btnRemove.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent arg0) {
                int row = listDatasources.getSelectedIndex();
                if (row != -1) { // nothing selected
                    String path = settings.getTvShowDataSource().get(row);
                    String[] choices = { BUNDLE.getString("Button.continue"), //$NON-NLS-1$
                            BUNDLE.getString("Button.abort") };
                    int decision = JOptionPane.showOptionDialog(null,
                            String.format(BUNDLE.getString("Settings.tvshowdatasource.remove.info"), path),
                            BUNDLE.getString("Settings.datasource.remove"), JOptionPane.YES_NO_OPTION,
                            JOptionPane.PLAIN_MESSAGE, null, choices, BUNDLE.getString("Button.abort")); //$NON-NLS-1$
                    if (decision == 0) {
                        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                        settings.removeTvShowDataSources(path);
                        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                    }
                }
            }
        });
        panelTvShowSourcesButtons.add(btnRemove, "1, 3, fill, top");

        JScrollPane scrollPane = new JScrollPane();
        panelTvShowDataSources.add(scrollPane, "12, 4, fill, fill");

        listExclude = new JList<>();
        scrollPane.setViewportView(listExclude);

        JPanel panelSkipFolderButtons = new JPanel();
        panelTvShowDataSources.add(panelSkipFolderButtons, "14, 4, fill, fill");
        panelSkipFolderButtons.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, },
                new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                        FormSpecs.DEFAULT_ROWSPEC, }));

        JButton btnAddSkipFolder = new JButton(IconManager.LIST_ADD);
        btnAddSkipFolder.setToolTipText(BUNDLE.getString("Settings.addignore")); //$NON-NLS-1$
        btnAddSkipFolder.setMargin(new Insets(2, 2, 2, 2));
        btnAddSkipFolder.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                Path file = TmmUIHelper.selectDirectory(BUNDLE.getString("Settings.ignore")); //$NON-NLS-1$
                if (file != null && Files.isDirectory(file)) {
                    settings.addTvShowSkipFolder(file.toAbsolutePath().toString());
                }
            }
        });
        panelSkipFolderButtons.add(btnAddSkipFolder, "1, 1");

        JButton btnRemoveSkipFolder = new JButton(IconManager.LIST_REMOVE);
        btnRemoveSkipFolder.setToolTipText(BUNDLE.getString("Settings.removeignore")); //$NON-NLS-1$
        btnRemoveSkipFolder.setMargin(new Insets(2, 2, 2, 2));
        btnRemoveSkipFolder.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                int row = listExclude.getSelectedIndex();
                if (row != -1) { // nothing selected
                    String ingore = settings.getTvShowSkipFolders().get(row);
                    settings.removeTvShowSkipFolder(ingore);
                }
            }
        });
        panelSkipFolderButtons.add(btnRemoveSkipFolder, "1, 3");

        JLabel lblDvdOrder = new JLabel(BUNDLE.getString("Settings.dvdorder")); //$NON-NLS-1$
        panelTvShowDataSources.add(lblDvdOrder, "2, 6, right, default");

        cbDvdOrder = new JCheckBox("");
        panelTvShowDataSources.add(cbDvdOrder, "4, 6");
    }

    initDataBindings();

    if (!Globals.isDonator()) {
        chckbxTraktTv.setSelected(false);
        chckbxTraktTv.setEnabled(false);
        btnClearTraktTvShows.setEnabled(false);
    }
}

From source file:phex.gui.common.PhexColors.java

/**
 * Colors get usually update when a UI update is performed.
 *///from ww  w .  j a  va2s .co m
public static void updateColors() {
    Color activeCaptionBorderColor = UIManager.getColor("activeCaptionBorder");
    Color infoColor = UIManager.getColor("info");

    if ((SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_WINDOWS)
            && UIManager.getLookAndFeel().isNativeLookAndFeel()) {
        // in case this is native LAF we use our special orange color set
        // this is done because the standard ui colors we use for other LAF
        // just look so bad and ugly on Mac OSX.
        activatePhexColors();
    } else if (infoColor == null || activeCaptionBorderColor == null) {
        // to prevent errors on LAF with some missing UI Colors we use
        // the Phex color set on this LAF.
        // (occures on Linux with GTK LAF)
        activatePhexColors();
    } else {
        boxPanelBorderColor = GUIUtils.darkerColor(activeCaptionBorderColor, 0.8);
        boxPanelBackground = new Color(infoColor.getRGB());
        boxHeaderBackground = GUIUtils.darkerColor(activeCaptionBorderColor, 0.9);
        boxHeaderGradientFrom = new Color(activeCaptionBorderColor.getRGB());
        boxHeaderGradientTo = GUIUtils.brighterColor(infoColor, 0.8);
        linkLabelRolloverForeground = GUIUtils.darkerColor(activeCaptionBorderColor, 0.8);

        scopeProgressBarBackground = UIManager.getColor("window");
        scopeProgressBarForeground = UIManager.getColor("ProgressBar.foreground");

        finishedScopeProgressBarForeground = scopeProgressBarForeground;

        // give it a touch of red and saturation
        unverifiedScopeProgressBarForeground = new Color(0xf04656);

        // use a lighter color
        blockedScopeProgressBarForeground = GUIUtils.brighterColor(infoColor, 0.7);
    }
}

From source file:phex.gui.tabs.download.DownloadOverviewPanel.java

private JPanel buildInfo2Panel() {
    JPanel subPanel = new JPanel();
    CellConstraints cc = new CellConstraints();

    String systemExtraCols = "";
    if (SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_MAC_OSX) {
        systemExtraCols = ", 4dlu, d";
    }/*w  w  w .j  ava  2 s  . c o m*/
    FormLayout layout = new FormLayout("d, 4dlu, 1dlu:grow" + systemExtraCols, // columns
            "p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p"); //rows
    PanelBuilder panelBuilder = new PanelBuilder(layout, subPanel);

    panelBuilder.addSeparator(Localizer.getString("DownloadOverview_Information"),
            cc.xywh(1, 1, layout.getColumnCount(), 1));

    JLabel label = new JLabel(Localizer.getString("DownloadOverview_FileName"));
    panelBuilder.add(label, cc.xy(1, 3));
    fileNameTxt = new JTextField();
    fileNameTxt.setEditable(false);
    fileNameTxt.setFont(UIManager.getFont("Label.font"));
    fileNameTxt.setForeground(UIManager.getColor("Label.foreground"));
    fileNameTxt.setBackground(UIManager.getColor("Label.background"));
    fileNameTxt.setMinimumSize(new Dimension(0, 0));
    panelBuilder.add(fileNameTxt, cc.xy(3, 3));

    label = new JLabel(Localizer.getString("DownloadOverview_IncompleteFile"));
    panelBuilder.add(label, cc.xy(1, 5));
    incompleteFileTxt = new JTextField();
    incompleteFileTxt.setEditable(false);
    incompleteFileTxt.setFont(UIManager.getFont("Label.font"));
    incompleteFileTxt.setForeground(UIManager.getColor("Label.foreground"));
    incompleteFileTxt.setBackground(UIManager.getColor("Label.background"));
    panelBuilder.add(incompleteFileTxt, cc.xy(3, 5));

    if (SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_MAC_OSX) {
        exploreFileBtn = new JButton();
        exploreFileBtn.setToolTipText(Localizer.getString("DownloadOverview_Explore"));
        exploreFileBtn.setMargin(GUIUtils.EMPTY_INSETS);
        exploreFileBtn.addActionListener(new ExploreActionListener());
        panelBuilder.add(exploreFileBtn, cc.xy(5, 5));
    }

    return subPanel;
}

From source file:storybook.toolkit.swing.SwingUtil.java

public static Color getTableSelectionBackgroundColor() {
    return UIManager.getColor("Table.selectionBackground");
}

From source file:tvbrowser.TVBrowser.java

private static void updateLookAndFeel() {
    try {/*from  w  w w.jav a2  s.  c  om*/
        if (OperatingSystem.isWindows()) {
            UIManager.installLookAndFeel("Extended Windows", "com.jgoodies.looks.windows.WindowsLookAndFeel");
        }
        UIManager.installLookAndFeel("Plastic", "com.jgoodies.looks.plastic.PlasticLookAndFeel");
        UIManager.installLookAndFeel("Plastic 3D", "com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
        UIManager.installLookAndFeel("Plastic XP", "com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
        UIManager.installLookAndFeel("Skin", "com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
        /*
              Map<String, SkinInfo> substanceSkins = SubstanceLookAndFeel.getAllSkins();
              if (substanceSkins != null) {
                for (SkinInfo skin : substanceSkins.values()) {
                  String className = skin.getClassName();
                  UIManager.installLookAndFeel("Substance " + skin.getDisplayName(), StringUtils.replace(StringUtils.replace(className, "Skin", "LookAndFeel"), "skin.", "skin.Substance"));
                }
              }
        */
    } catch (Exception e1) {
        // ignore any exception for optional skins
        e1.printStackTrace();
    }

    if (Settings.propLookAndFeel.getString().equals("com.l2fprod.gui.plaf.skin.SkinLookAndFeel")) {
        String themepack = Settings.propSkinLFThemepack.getString();
        try {
            File themepackFile = new File(themepack);
            if (!themepackFile.exists()) {
                themepackFile = new File(Settings.getUserDirectoryName(), themepack);
            }

            if (!themepackFile.exists() && OperatingSystem.isMacOs()) {
                themepackFile = new File("/Library/Application Support/TV-Browser/", themepack);
            }

            SkinLookAndFeel.setSkin(SkinLookAndFeel.loadThemePack(themepackFile.getAbsolutePath()));
        } catch (Exception exc) {
            ErrorHandler.handle("Could not load themepack.\nSkinLF is disabled now", exc);
            Settings.propLookAndFeel.setString(Settings.propLookAndFeel.getDefault());
        }
    } else if (Settings.propLookAndFeel.getString().startsWith("com.jgoodies")) {
        com.jgoodies.looks.Options.setPopupDropShadowEnabled(Settings.propJGoodiesShadow.getBoolean());
        UIManager.put("jgoodies.popupDropShadowEnabled",
                Boolean.valueOf(Settings.propJGoodiesShadow.getBoolean()));
        try {
            LookUtils.setLookAndTheme(
                    (LookAndFeel) Class.forName(Settings.propLookAndFeel.getString()).newInstance(),
                    Class.forName(Settings.propJGoodiesTheme.getString()).newInstance());
        } catch (Throwable e) {
            ErrorHandler.handle("Could not load themepack.\nJGoodies is disabled now", e);
            Settings.propLookAndFeel.setString(Settings.propLookAndFeel.getDefault());
        }
    }

    if (curLookAndFeel == null || !curLookAndFeel.equals(Settings.propLookAndFeel.getString())) {
        try {
            curLookAndFeel = Settings.propLookAndFeel.getString();
            // check if LnF is still available
            boolean foundCurrent = lookAndFeelExists(curLookAndFeel);
            // reset look and feel?
            if (!foundCurrent) {
                if (JOptionPane.showConfirmDialog(null, mLocalizer.msg("lnfMissing",
                        "The look and feel '{0}' is no longer available,\nso the default look and feel will be used.\n\nDo you want to set the look and feel option to the default look and feel?",
                        curLookAndFeel), mLocalizer.msg("lnfMissing.title", "Look and feel missing"),
                        JOptionPane.WARNING_MESSAGE | JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                    Settings.propLookAndFeel.resetToDefault();
                    curLookAndFeel = Settings.propLookAndFeel.getString();
                    foundCurrent = true;
                }
            }
            if (foundCurrent) {
                UIThreadRunner.invokeAndWait(new Runnable() {

                    @Override
                    public void run() {
                        try {
                            UIManager.setLookAndFeel(curLookAndFeel);
                        } catch (Exception e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                        mLog.info("setting look and feel to " + curLookAndFeel);
                    }
                });
            }
        } catch (Exception exc) {
            String msg = mLocalizer.msg("error.1", "Unable to set look and feel.", exc);
            ErrorHandler.handle(msg, exc);
        }
    }

    // set colors for action pane at UIManager
    UIManager.put("TaskPane.foreGround", UIManager.get("Button.foreground"));

    if (UIManager.getColor("List.selectionBackground") == null) {
        UIManager.put("List.selectionBackground", UIManager.getColor("Tree.selectionBackground"));
    }
    if (UIManager.getColor("List.selectionForeground") == null) {
        UIManager.put("List.selectionForeground", UIManager.getColor("Tree.selectionForeground"));
    }
    if (UIManager.getColor("MenuItem.selectionForeground") == null) {
        UIManager.put("MenuItem.selectionForeground", UIManager.getColor("Tree.selectionForeground"));
    }
    if (UIManager.getColor("ComboBox.disabledForeground") == null) {
        UIManager.put("ComboBox.disabledForeground", Color.gray);
    }

    if (mainFrame != null) {
        SwingUtilities.updateComponentTreeUI(mainFrame);
        mainFrame.validate();
    }
    lookAndFeelInitialized = true;
}