Example usage for com.jgoodies.forms.layout FormSpecs PARAGRAPH_GAP_ROWSPEC

List of usage examples for com.jgoodies.forms.layout FormSpecs PARAGRAPH_GAP_ROWSPEC

Introduction

In this page you can find the example usage for com.jgoodies.forms.layout FormSpecs PARAGRAPH_GAP_ROWSPEC.

Prototype

RowSpec PARAGRAPH_GAP_ROWSPEC

To view the source code for com.jgoodies.forms.layout FormSpecs PARAGRAPH_GAP_ROWSPEC.

Click Source Link

Document

Describes the logical vertical default gap between two paragraphs in the layout grid.

Usage

From source file:at.becast.youploader.gui.FrmAbout.java

License:Open Source License

/**
 * Create the dialog.//from  w ww . j a  v a  2 s.  c om
 */
public FrmAbout() {
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setResizable(false);
    setTitle(String.format(LANG.getString("About.title"), Main.APP_NAME));
    ResourceBundle bundle = ResourceBundle.getBundle("build");
    String rev = bundle.getString("git-sha-1");
    String build = bundle.getString("jenkins-build");
    this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/yp.png")));
    setBounds(100, 100, 500, 397);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new FormLayout(
            new ColumnSpec[] { ColumnSpec.decode("max(166dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC,
                    ColumnSpec.decode("210px:grow"), },
            new RowSpec[] { FormSpecs.UNRELATED_GAP_ROWSPEC, RowSpec.decode("20px"),
                    FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("20px"), FormSpecs.RELATED_GAP_ROWSPEC,
                    RowSpec.decode("20px"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("20px"),
                    FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("20px"), FormSpecs.RELATED_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("20px"), FormSpecs.PARAGRAPH_GAP_ROWSPEC,
                    RowSpec.decode("103px"), }));

    JLabel label = new JLabel("");
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setIcon(new ImageIcon(getClass().getResource("/yp.png")));
    contentPanel.add(label, "1, 2, 1, 9, left, fill");

    JLabel lblYouploader = new JLabel("YouPloader " + Main.VERSION);
    lblYouploader.setFont(new Font("Arial Black", Font.PLAIN, 11));
    contentPanel.add(lblYouploader, "3, 2, left, default");

    JLabel lblGenuineparts = new JLabel("  2016 genuineparts");
    lblGenuineparts.setFont(new Font("Arial Black", Font.PLAIN, 11));
    contentPanel.add(lblGenuineparts, "3, 4, left, default");

    JLabel lblRevision = new JLabel("Revision " + rev);
    lblRevision.setFont(new Font("Arial", Font.PLAIN, 13));
    contentPanel.add(lblRevision, "3, 6");

    JLabel lblBuild = new JLabel("Build " + build);
    lblBuild.setFont(new Font("Arial", Font.PLAIN, 13));
    contentPanel.add(lblBuild, "3, 8");

    JLabel lblHttpsgithubcombecastyouploader = new JLabel("https://github.com/becast/youploader");
    lblHttpsgithubcombecastyouploader.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            DesktopUtil.openBrowser("https://github.com/becast/youploader");
        }
    });
    lblHttpsgithubcombecastyouploader.setForeground(Color.BLUE);
    lblHttpsgithubcombecastyouploader.setFont(new Font("Arial", Font.PLAIN, 13));
    contentPanel.add(lblHttpsgithubcombecastyouploader, "3, 10");

    JLabel lblCredits = new JLabel("Credits:");
    contentPanel.add(lblCredits, "1, 14");

    JScrollPane scrollPane = new JScrollPane();
    contentPanel.add(scrollPane, "1, 16, 3, 3, fill, fill");

    JTextPane txtCredits = new JTextPane();
    txtCredits.setText(
            "Thanks to everyone who contributed!\r\n\r\nGerman Translation\r\nMeduax - https://github.com/Meduax - https://www.youtube.com/user/Meduax\r\n\r\nTesting:\r\nWePlaydThis\r\n@WePlaydThis\r\nhttps://www.youtube.com/user/WePlaydThis\r\n\r\nTheJessaChannel\r\n@TheJessaChannel\r\nhttps://www.youtube.com/user/TheJessaChannel\r\n\r\nThe kind people of /r/letsplay\r\n");
    txtCredits.setCaretPosition(0);
    txtCredits.setEditable(false);
    scrollPane.setViewportView(txtCredits);
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton okButton = new JButton("OK");
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    okButton();
                }
            });
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
    }
}

From source file:at.becast.youploader.gui.FrmMain.java

License:Open Source License

public void initMainTab() {
    cmbCategory = new JComboBox<Categories>();
    cmbCategory.setModel(new DefaultComboBoxModel<Categories>(Categories.values()));
    SideBar sideBar = new SideBar(SideBar.SideBarMode.TOP_LEVEL, true, 300, true);
    ss1 = new SidebarSection(sideBar, LANG.getString("frmMain.Sidebar.Settings"), new EditPanel(this),
            new ImageIcon(getClass().getResource("/pencil.png")));
    ss2 = new SidebarSection(sideBar, LANG.getString("frmMain.Sidebar.Playlists"), new PlaylistPanel(this),
            new ImageIcon(getClass().getResource("/layers.png")));
    ss3 = new SidebarSection(sideBar, LANG.getString("frmMain.Sidebar.Monetisation"), new MonetPanel(),
            new ImageIcon(getClass().getResource("/money.png")));
    sideBar.addSection(ss1, false);//from ww  w . ja v  a 2s. com
    sideBar.addSection(ss2);
    sideBar.addSection(ss3);
    JPanel mainTab = new JPanel();
    JPanel panel = new JPanel();
    GroupLayout mainTabLayout = new GroupLayout(mainTab);
    mainTabLayout.setHorizontalGroup(mainTabLayout.createParallelGroup(Alignment.TRAILING)
            .addGroup(mainTabLayout.createSequentialGroup()
                    .addComponent(panel, GroupLayout.DEFAULT_SIZE, 465, Short.MAX_VALUE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(sideBar, GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE)));
    mainTabLayout.setVerticalGroup(mainTabLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(panel, GroupLayout.DEFAULT_SIZE, 492, Short.MAX_VALUE)
            .addGroup(mainTabLayout.createSequentialGroup()
                    .addComponent(sideBar, GroupLayout.DEFAULT_SIZE, 469, Short.MAX_VALUE).addContainerGap()));
    panel.setLayout(new FormLayout(
            new ColumnSpec[] { ColumnSpec.decode("2px"), FormSpecs.RELATED_GAP_COLSPEC,
                    ColumnSpec.decode("20px:grow"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                    ColumnSpec.decode("23px"), ColumnSpec.decode("33px"), FormSpecs.UNRELATED_GAP_COLSPEC,
                    ColumnSpec.decode("61px"), FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                    ColumnSpec.decode("24px"), ColumnSpec.decode("28px"), ColumnSpec.decode("40px"),
                    ColumnSpec.decode("36px"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("28px"),
                    FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("58px"), },
            new RowSpec[] { RowSpec.decode("2px"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("14px"),
                    RowSpec.decode("25px"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("14px"),
                    RowSpec.decode("25px"), FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("14px"),
                    RowSpec.decode("25px"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    RowSpec.decode("64dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    RowSpec.decode("max(64dlu;default)"), FormSpecs.RELATED_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, RowSpec.decode("25px"), FormSpecs.PARAGRAPH_GAP_ROWSPEC,
                    RowSpec.decode("24px"), RowSpec.decode("23px"), }));

    lbltitlelenght = new JLabel("(0/100)");
    panel.add(lbltitlelenght, "14, 6, 3, 1, right, top");

    txtTitle = new JTextField();
    contextMenu.add(txtTitle);
    panel.add(txtTitle, "3, 7, 14, 1, fill, fill");
    txtTitle.setColumns(10);
    txtTitle.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            calcNotifies();
        }
    });

    JLabel lblCategory = new JLabel(LANG.getString("frmMain.Category"));
    panel.add(lblCategory, "3, 9, 4, 1, left, bottom");
    panel.add(cmbCategory, "3, 10, 14, 1, fill, fill");

    JLabel lblDescription = new JLabel(LANG.getString("frmMain.Description"));
    panel.add(lblDescription, "3, 12, 4, 1, left, bottom");

    lblDesclenght = new JLabel("(0/5000)");
    panel.add(lblDesclenght, "14, 12, 3, 1, right, bottom");

    JScrollPane DescriptionScrollPane = new JScrollPane();
    panel.add(DescriptionScrollPane, "3, 13, 14, 1, fill, fill");

    txtDescription = new JTextArea();
    contextMenu.add(txtDescription);
    txtDescription.setFont(new Font("SansSerif", Font.PLAIN, 13));
    DescriptionScrollPane.setViewportView(txtDescription);
    txtDescription.setWrapStyleWord(true);
    txtDescription.setLineWrap(true);
    txtDescription.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            calcNotifies();
        }
    });

    JLabel lblTags = new JLabel(LANG.getString("frmMain.Tags"));
    panel.add(lblTags, "3, 15, 4, 1, left, bottom");

    lblTagslenght = new JLabel("(0/500)");
    panel.add(lblTagslenght, "14, 15, 3, 1, right, top");

    JScrollPane TagScrollPane = new JScrollPane();
    panel.add(TagScrollPane, "3, 16, 14, 1, fill, fill");

    txtTags = new JTextArea();
    contextMenu.add(txtTags);
    txtTags.setFont(new Font("SansSerif", Font.PLAIN, 13));
    TagScrollPane.setViewportView(txtTags);
    txtTags.setWrapStyleWord(true);
    txtTags.setLineWrap(true);
    txtTags.setBorder(BorderFactory.createEtchedBorder());
    txtTags.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            calcNotifies();
        }
    });

    JLabel lblAccount = new JLabel(LANG.getString("frmMain.Account"));
    panel.add(lblAccount, "3, 18, 4, 1, left, bottom");
    cmbAccount = new JComboBox<AccountType>();
    panel.add(getCmbAccount(), "3, 19, 14, 1, fill, fill");
    cmbAccount.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            changeUser();
        }
    });
    btnAddToQueue = new JButton(LANG.getString("frmMain.addtoQueue"));
    btnAddToQueue.setEnabled(false);
    panel.add(btnAddToQueue, "3, 21, 6, 1, fill, fill");
    btnAddToQueue.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            queueButton();
        }
    });
    JLabel lblSelectVideo = new JLabel();
    panel.add(lblSelectVideo, "3, 3, 4, 1, left, bottom");

    lblSelectVideo.setText(LANG.getString("frmMain.selectVideoFile"));
    cmbFile = new JComboBox<String>();
    cmbFile.setDropTarget(new DropTarget() {
        private static final long serialVersionUID = 8809983794742040683L;

        public synchronized void drop(DropTargetDropEvent evt) {
            try {
                evt.acceptDrop(DnDConstants.ACTION_COPY);
                @SuppressWarnings("unchecked")
                List<File> droppedFiles = (List<File>) evt.getTransferable()
                        .getTransferData(DataFlavor.javaFileListFlavor);
                for (File file : droppedFiles) {
                    cmbFile.removeAllItems();
                    cmbFile.addItem(file.getAbsolutePath());
                }
            } catch (Exception ex) {
                LOG.error("Error dropping video file", ex);
            }
        }
    });
    panel.add(cmbFile, "3, 4, 14, 1, fill, fill");
    JButton btnSelectMovie = new JButton();
    btnSelectMovie.setToolTipText("Select Video File");
    panel.add(btnSelectMovie, "18, 4, center, top");
    btnSelectMovie.setIcon(new ImageIcon(getClass().getResource("/film_add.png")));

    JLabel lblTitle = new JLabel(LANG.getString("frmMain.Title"));
    panel.add(lblTitle, "3, 6, 4, 1, left, bottom");

    JButton btnReset = new JButton(LANG.getString("frmMain.Reset"));
    btnReset.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            resetEdit();
        }
    });
    panel.add(btnReset, "11, 21, 6, 1, fill, fill");
    btnSelectMovie.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            EditPanel edit = (EditPanel) ss1.contentPane;
            NativeJFileChooser chooser;
            if (edit.getTxtStartDir() != null && !edit.getTxtStartDir().equals("")) {
                chooser = new NativeJFileChooser(edit.getTxtStartDir().getText().trim());
            } else {
                chooser = new NativeJFileChooser();
            }
            int returnVal = chooser.showOpenDialog((Component) self);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                cmbFile.removeAllItems();
                cmbFile.addItem(chooser.getSelectedFile().getAbsolutePath().toString());
            }
        }
    });
    mainTab.setLayout(mainTabLayout);
    mainTab.revalidate();
    mainTab.repaint();
    TabbedPane.addTab(LANG.getString("frmMain.Tabs.VideoSettings"), mainTab);
}

From source file:org.tinymediamanager.ui.movies.dialogs.MovieCreateOfflineDialog.java

License:Apache License

public MovieCreateOfflineDialog() {
    super(BUNDLE.getString("movie.createoffline"), "movieCreateOffline"); //$NON-NLS-1$
    setBounds(5, 5, 350, 230);/*from  ww w  . j  av a2s  .  co  m*/
    getContentPane().setLayout(new BorderLayout(0, 0));

    JPanel panelContent = new JPanel();
    getContentPane().add(panelContent, BorderLayout.NORTH);
    panelContent.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("100dlu:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, 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.PARAGRAPH_GAP_ROWSPEC, }));

    JLabel lblTitle = new JLabel(BUNDLE.getString("metatag.title")); //$NON-NLS-1$
    panelContent.add(lblTitle, "2, 2, right, default");

    final JTextField tfMovieName = new JTextField();
    panelContent.add(tfMovieName, "4, 2, fill, default");
    tfMovieName.setColumns(10);

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

    final JComboBox<MediaSource> cbMediaSource = new JComboBox();
    cbMediaSource.addItem(MediaSource.UNKNOWN);
    cbMediaSource.addItem(MediaSource.DVD);
    cbMediaSource.addItem(MediaSource.BLURAY);
    cbMediaSource.addItem(MediaSource.HDDVD);
    cbMediaSource.addItem(MediaSource.VHS);
    panelContent.add(cbMediaSource, "4, 4, fill, default");

    JLabel lblDatasource = new JLabel(BUNDLE.getString("metatag.datasource")); //$NON-NLS-1$
    panelContent.add(lblDatasource, "2, 6, right, default");

    final JComboBox<String> cbDatasource = new JComboBox();
    panelContent.add(cbDatasource, "4, 6, fill, default");

    JButton btnAdd = new JButton(IconManager.LIST_ADD);
    btnAdd.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String title = tfMovieName.getText();
            String datasource = (String) cbDatasource.getSelectedItem();
            MediaSource mediaSource = (MediaSource) cbMediaSource.getSelectedItem();
            if (StringUtils.isNoneBlank(title, datasource)) {
                movieList.addOfflineMovie(title, datasource, mediaSource);
            }
        }
    });
    panelContent.add(btnAdd, "6, 2, right, default");

    {
        JPanel panelBottom = new JPanel();
        getContentPane().add(panelBottom, BorderLayout.SOUTH);
        panelBottom.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, }));

        JPanel panelButtons = new JPanel();
        EqualsLayout layout = new EqualsLayout(5);
        layout.setMinWidth(100);
        panelButtons.setLayout(layout);
        panelBottom.add(panelButtons, "2, 2, right, fill");

        JButton btnClose = new JButton(BUNDLE.getString("Button.close")); //$NON-NLS-1$
        btnClose.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                setVisible(false);
            }
        });
        panelButtons.add(btnClose);
    }

    {
        // initializations
        for (String datasource : MovieModuleManager.MOVIE_SETTINGS.getMovieDataSource()) {
            cbDatasource.addItem(datasource);
        }
    }
}

From source file:org.tinymediamanager.ui.movies.dialogs.MovieDownloadSubtitleDialog.java

License:Apache License

public MovieDownloadSubtitleDialog(String title) {
    super(title, "downloadSubtitle");
    setMinimumSize(new Dimension(getWidth(), getHeight()));

    JPanel panelCenter = new JPanel();
    getContentPane().add(panelCenter, BorderLayout.CENTER);
    panelCenter.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("75dlu"),
                    FormSpecs.RELATED_GAP_ROWSPEC, }));

    JPanel panelScraper = new JPanel();
    panelCenter.add(panelScraper, "2, 2, default, fill");
    panelScraper.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.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.PARAGRAPH_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                    FormSpecs.RELATED_GAP_ROWSPEC, }));

    JLabel lblScraper = new JLabel(BUNDLE.getString("scraper")); //$NON-NLS-1$
    panelScraper.add(lblScraper, "2, 2, right, default");

    cbSubtitleScraper = new MediaScraperCheckComboBox();
    cbSubtitleScraper.setTextFor(CheckComboBox.NONE, BUNDLE.getString("scraper.selected.none")); //$NON-NLS-1$
    cbSubtitleScraper.setTextFor(CheckComboBox.MULTIPLE, BUNDLE.getString("scraper.selected.multiple")); //$NON-NLS-1$
    cbSubtitleScraper.setTextFor(CheckComboBox.ALL, BUNDLE.getString("scraper.selected.all")); //$NON-NLS-1$
    panelScraper.add(cbSubtitleScraper, "4, 2");

    JLabel lblLanguage = new JLabel(BUNDLE.getString("metatag.language")); //$NON-NLS-1$
    panelScraper.add(lblLanguage, "2, 4, right, default");

    cbLanguage = new JComboBox(MediaLanguages.values());
    panelScraper.add(cbLanguage, "4, 4");

    JTextArea taHint = new JTextArea();
    taHint.setLineWrap(true);//from www . ja  v a2 s . co m
    taHint.setWrapStyleWord(true);
    taHint.setText(BUNDLE.getString("movie.download.subtitles.hint")); //$NON-NLS-1$
    taHint.setOpaque(false);
    panelScraper.add(taHint, "2, 6, 3, 1, fill, fill");

    JPanel panelButtons = new JPanel();
    panelButtons.setLayout(new EqualsLayout(5));
    panelButtons.setBorder(new EmptyBorder(4, 4, 4, 4));
    getContentPane().add(panelButtons, BorderLayout.SOUTH);

    JButton btnStart = new JButton(BUNDLE.getString("scraper.start")); //$NON-NLS-1$
    btnStart.setIcon(IconManager.APPLY);
    btnStart.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            startDownload = true;
            setVisible(false);
        }
    });
    panelButtons.add(btnStart);

    JButton btnCancel = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$
    btnCancel.setIcon(IconManager.CANCEL);
    btnCancel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            startDownload = false;
            setVisible(false);
        }
    });
    panelButtons.add(btnCancel);

    // set data

    // scraper
    ListCheckModel model = cbSubtitleScraper.getModel();
    for (MediaScraper subtitleScraper : MovieList.getInstance().getAvailableSubtitleScrapers()) {
        model.addElement(subtitleScraper);

        if (MovieModuleManager.MOVIE_SETTINGS.getMovieSubtitleScrapers().contains(subtitleScraper.getId())) {
            model.addCheck(subtitleScraper);
        }
    }

    cbLanguage.setSelectedItem(MovieModuleManager.MOVIE_SETTINGS.getSubtitleScraperLanguage());
}

From source file:org.tinymediamanager.ui.tvshows.dialogs.TvShowDownloadSubtitleDialog.java

License:Apache License

public TvShowDownloadSubtitleDialog(String title) {
    super(title, "downloadSubtitle");
    setMinimumSize(new Dimension(getWidth(), getHeight()));

    JPanel panelCenter = new JPanel();
    getContentPane().add(panelCenter, BorderLayout.CENTER);
    panelCenter.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("75dlu"),
                    FormSpecs.RELATED_GAP_ROWSPEC, }));

    JPanel panelScraper = new JPanel();
    panelCenter.add(panelScraper, "2, 2, default, fill");
    panelScraper.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.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.PARAGRAPH_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                    FormSpecs.RELATED_GAP_ROWSPEC, }));

    JLabel lblScraper = new JLabel(BUNDLE.getString("scraper")); //$NON-NLS-1$
    panelScraper.add(lblScraper, "2, 2, right, default");

    cbSubtitleScraper = new MediaScraperCheckComboBox();
    cbSubtitleScraper.setTextFor(CheckComboBox.NONE, BUNDLE.getString("scraper.selected.none")); //$NON-NLS-1$
    cbSubtitleScraper.setTextFor(CheckComboBox.MULTIPLE, BUNDLE.getString("scraper.selected.multiple")); //$NON-NLS-1$
    cbSubtitleScraper.setTextFor(CheckComboBox.ALL, BUNDLE.getString("scraper.selected.all")); //$NON-NLS-1$
    panelScraper.add(cbSubtitleScraper, "4, 2");

    JLabel lblLanguage = new JLabel(BUNDLE.getString("metatag.language")); //$NON-NLS-1$
    panelScraper.add(lblLanguage, "2, 4, right, default");

    cbLanguage = new JComboBox(MediaLanguages.values());
    panelScraper.add(cbLanguage, "4, 4");

    JTextArea taHint = new JTextArea();
    taHint.setLineWrap(true);/* w  ww  . j a v a2s .  c  o m*/
    taHint.setWrapStyleWord(true);
    taHint.setText(BUNDLE.getString("tvshow.download.subtitles.hint")); //$NON-NLS-1$
    taHint.setOpaque(false);
    panelScraper.add(taHint, "2, 6, 3, 1, fill, fill");

    JPanel panelButtons = new JPanel();
    panelButtons.setLayout(new EqualsLayout(5));
    panelButtons.setBorder(new EmptyBorder(4, 4, 4, 4));
    getContentPane().add(panelButtons, BorderLayout.SOUTH);

    JButton btnStart = new JButton(BUNDLE.getString("scraper.start")); //$NON-NLS-1$
    btnStart.setIcon(IconManager.APPLY);
    btnStart.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            startDownload = true;
            setVisible(false);
        }
    });
    panelButtons.add(btnStart);

    JButton btnCancel = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$
    btnCancel.setIcon(IconManager.CANCEL);
    btnCancel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            startDownload = false;
            setVisible(false);
        }
    });
    panelButtons.add(btnCancel);

    // set data

    // scraper
    ListCheckModel model = cbSubtitleScraper.getModel();
    for (MediaScraper subtitleScraper : TvShowList.getInstance().getAvailableSubtitleScrapers()) {
        model.addElement(subtitleScraper);

        if (TvShowModuleManager.SETTINGS.getTvShowSubtitleScrapers().contains(subtitleScraper.getId())) {
            model.addCheck(subtitleScraper);
        }
    }

    cbLanguage.setSelectedItem(TvShowModuleManager.SETTINGS.getSubtitleScraperLanguage());
}

From source file:org.tinymediamanager.ui.wizard.EntrancePanel.java

License:Apache License

private void initComponents() {
    setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("50dlu"),
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                    ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC,
                    ColumnSpec.decode("50dlu"), FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("50dlu"), FormSpecs.RELATED_GAP_ROWSPEC,
                    RowSpec.decode("50dlu"), RowSpec.decode("default:grow"),
                    FormSpecs.PARAGRAPH_GAP_ROWSPEC, }));

    final JTextPane tpGreetingHeader = new JTextPane();
    tpGreetingHeader.setEditable(false);
    tpGreetingHeader.setOpaque(false);//from   w  w  w. j  ava2 s. c o m
    tpGreetingHeader.setEditorKit(new HTMLEditorKit());
    tpGreetingHeader.setText(BUNDLE.getString("wizard.greeting.header")); //$NON-NLS-1$
    add(tpGreetingHeader, "2, 2, 7, 1, center, bottom");

    JLabel lblLogo = new JLabel("");
    lblLogo.setIcon(new Logo(96));
    add(lblLogo, "4, 5, default, top");

    JTextPane tpGreetingText = new JTextPane();
    tpGreetingText.setEditable(false);
    tpGreetingText.setText(BUNDLE.getString("wizard.greeting.text")); //$NON-NLS-1$
    tpGreetingText.setOpaque(false);
    add(tpGreetingText, "6, 5, fill, fill");
}