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

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

Introduction

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

Prototype

RowSpec UNRELATED_GAP_ROWSPEC

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

Click Source Link

Document

Describes a logical vertical gap between two unrelated components.

Note: In a future version this constant will likely be moved to a class LogicalSize or StyledSize .

Usage

From source file:AccountDialog.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Open Source Project license - unknown
    ResourceBundle bundle = ResourceBundle.getBundle("AccountDialog");
    JPanel dialogPane = new JPanel();
    JPanel contentPanel = new JPanel();
    JLabel labelIcon = new JLabel();
    JLabel labelUserName = new JLabel();
    fieldUserName = ComponentFactory.getTextField();
    JLabel labelPassword = new JLabel();
    fieldPassword = ComponentFactory.getPasswordField();
    JPanel buttonBar = new JPanel();
    btnOK = new JButton();
    btnCancel = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {/*  w w w  . j a  v  a 2s . c  o  m*/
        dialogPane.setBorder(Borders.DIALOG);
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {

            //---- labelIcon ----
            labelIcon.setIcon(new ImageIcon(
                    "C:\\develope\\freerapid\\src\\cz\\vity\\freerapid\\gui\\dialogs\\resources\\icons\\connection_password.gif"));

            //---- labelUserName ----
            labelUserName.setText(bundle.getString("labelUserName.text"));
            labelUserName.setLabelFor(fieldUserName);

            //---- labelPassword ----
            labelPassword.setText(bundle.getString("labelPassword.text"));
            labelPassword.setLabelFor(fieldPassword);

            PanelBuilder contentPanelBuilder = new PanelBuilder(new FormLayout(
                    new ColumnSpec[] { ColumnSpec.decode("max(pref;35dlu)"),
                            FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                            FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("min(pref;40dlu):grow"),
                            FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC },
                    new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC,
                            FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                            FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC,
                            FormSpecs.UNRELATED_GAP_ROWSPEC }),
                    contentPanel);

            contentPanelBuilder.add(labelIcon,
                    cc.xywh(1, 1, 2, 7, CellConstraints.FILL, CellConstraints.CENTER));
            contentPanelBuilder.add(labelUserName, cc.xy(3, 1));
            contentPanelBuilder.add(fieldUserName, cc.xywh(3, 3, 3, 1));
            contentPanelBuilder.add(labelPassword, cc.xy(3, 5));
            contentPanelBuilder.add(fieldPassword, cc.xywh(3, 7, 3, 1));
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);

        //======== buttonBar ========
        {
            buttonBar.setBorder(Borders.BUTTON_BAR_PAD);

            //---- btnOK ----
            btnOK.setText(bundle.getString("btnOK.text"));

            //---- btnCancel ----
            btnCancel.setText(bundle.getString("btnCancel.text"));

            PanelBuilder buttonBarBuilder = new PanelBuilder(new FormLayout(
                    new ColumnSpec[] { ColumnSpec.decode("55px:grow"), FormSpecs.BUTTON_COLSPEC,
                            FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.BUTTON_COLSPEC,
                            FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC },
                    RowSpec.decodeSpecs("default")), buttonBar);

            buttonBarBuilder.add(btnOK, cc.xy(2, 1));
            buttonBarBuilder.add(btnCancel, cc.xy(4, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:UserPreferencesDialog.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Open Source Project license - unknown
    ResourceBundle bundle = ResourceBundle.getBundle("UserPreferencesDialog");
    JPanel dialogPane = new JPanel();
    JPanel contentPanel = new JPanel();
    toolbar = new JButtonBar();
    panelCard = new JPanel();
    JPanel panelGeneral = new JPanel();
    JPanel panelGeneralSettings = new JPanel();
    checkShowIconInSystemTray = new JCheckBox();
    JPanel panelAlarm = new JPanel();
    JPanel panelWhenAlarmGoesOff = new JPanel();
    JPanel panelAlarmDefaults = new JPanel();
    JPanel panelPlugins = new JPanel();
    JTabbedPane pluginTabbedPane = new JTabbedPane();
    JPanel pluginPanelSettings = new JPanel();
    JScrollPane scrollPane1 = new JScrollPane();
    pluginTable = new JXTable();
    JXButtonPanel pluginsButtonPanel = new JXButtonPanel();
    JLabel labelPluginInfo = new JLabel();
    popmenuButton = ComponentFactory.getPopdownButton();
    btnPluginOptions = new JButton();
    JPanel pluginPanelUpdates = new JPanel();
    check4PluginUpdatesAutomatically = new JCheckBox();
    JLabel labelAfterDetectUpdate = new JLabel();
    comboHowToUpdate = new JComboBox();
    checkDownloadNotExistingPlugins = new JCheckBox();
    JLabel labelCheckForUpdateEvery = new JLabel();
    spinnerUpdateHour = new JSpinner();
    JLabel labelHours = new JLabel();
    JLabel labelUpdateFromServer = new JLabel();
    comboPluginServers = new JComboBox();
    btnResetDefaultPluginServer = new JButton();
    JLabel labelManualCheck = new JLabel();
    buttonBar = new JXButtonPanel();
    btnOK = new JButton();
    btnCancel = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setTitle(bundle.getString("this.title"));
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {//w ww . ja  v  a  2  s . com
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {
            contentPanel.setLayout(new BorderLayout());

            //======== toolbar ========
            {
                toolbar.setBorder(LineBorder.createBlackLineBorder());
                toolbar.setLayout(null);
            }
            contentPanel.add(toolbar, BorderLayout.NORTH);

            //======== panelCard ========
            {
                panelCard.setLayout(new CardLayout());

                //======== panelGeneral ========
                {
                    panelGeneral.setBorder(Borders.TABBED_DIALOG);

                    //======== panelGeneralSettings ========
                    {
                        panelGeneralSettings.setBorder(
                                new TitledBorder(null, bundle.getString("panelGeneralSettings.border"),
                                        TitledBorder.LEADING, TitledBorder.TOP));

                        //---- checkShowIconInSystemTray ----
                        checkShowIconInSystemTray.setText(bundle.getString("checkShowIconInSystemTray.text"));

                        PanelBuilder panelGeneralSettingsBuilder = new PanelBuilder(new FormLayout(
                                new ColumnSpec[] {
                                        new ColumnSpec(ColumnSpec.LEFT, Sizes.dluX(0), FormSpec.NO_GROW),
                                        FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC },
                                RowSpec.decodeSpecs("default")), panelGeneralSettings);

                        panelGeneralSettingsBuilder.add(checkShowIconInSystemTray, cc.xy(3, 1));
                    }

                    PanelBuilder panelGeneralBuilder = new PanelBuilder(
                            new FormLayout(ColumnSpec.decodeSpecs("default:grow"),
                                    new RowSpec[] { new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.NO_GROW),
                                            FormSpecs.RELATED_GAP_ROWSPEC,
                                            new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.NO_GROW) }),
                            panelGeneral);

                    panelGeneralBuilder.add(panelGeneralSettings, cc.xy(1, 1));
                }
                panelCard.add(panelGeneral, "CARD1");

                //======== panelAlarm ========
                {
                    panelAlarm.setBorder(Borders.TABBED_DIALOG);

                    //======== panelWhenAlarmGoesOff ========
                    {
                        panelWhenAlarmGoesOff.setBorder(
                                new TitledBorder(null, bundle.getString("panelWhenAlarmGoesOff.border"),
                                        TitledBorder.LEADING, TitledBorder.TOP));

                        PanelBuilder panelWhenAlarmGoesOffBuilder = new PanelBuilder(
                                new FormLayout(new ColumnSpec[] {
                                        new ColumnSpec(ColumnSpec.LEFT, Sizes.dluX(0), FormSpec.NO_GROW),
                                        FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                                        FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                                        new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                                        FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                                        FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                                        FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC },
                                        new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC,
                                                FormSpecs.NARROW_LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                                                FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                                                FormSpecs.DEFAULT_ROWSPEC }),
                                panelWhenAlarmGoesOff);
                        ((FormLayout) panelWhenAlarmGoesOff.getLayout())
                                .setColumnGroups(new int[][] { { 9, 11 } });

                    }

                    //======== panelAlarmDefaults ========
                    {
                        panelAlarmDefaults
                                .setBorder(new TitledBorder(null, bundle.getString("panelAlarmDefaults.border"),
                                        TitledBorder.LEADING, TitledBorder.TOP));

                        PanelBuilder panelAlarmDefaultsBuilder = new PanelBuilder(new FormLayout(
                                new ColumnSpec[] {
                                        new ColumnSpec(ColumnSpec.LEFT, Sizes.dluX(0), FormSpec.NO_GROW),
                                        FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                                        FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                                        FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC },
                                new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.NARROW_LINE_GAP_ROWSPEC,
                                        FormSpecs.DEFAULT_ROWSPEC, FormSpecs.NARROW_LINE_GAP_ROWSPEC,
                                        FormSpecs.DEFAULT_ROWSPEC, FormSpecs.NARROW_LINE_GAP_ROWSPEC,
                                        FormSpecs.DEFAULT_ROWSPEC }),
                                panelAlarmDefaults);

                    }

                    PanelBuilder panelAlarmBuilder = new PanelBuilder(new FormLayout(
                            ColumnSpec.decodeSpecs("default:grow"), new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC,
                                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC }),
                            panelAlarm);

                    panelAlarmBuilder.add(panelWhenAlarmGoesOff, cc.xy(1, 1));
                    panelAlarmBuilder.add(panelAlarmDefaults, cc.xy(1, 3));
                }
                panelCard.add(panelAlarm, "CARD2");

                //======== panelPlugins ========
                {
                    panelPlugins.setBorder(Borders.TABBED_DIALOG);

                    //======== pluginTabbedPane ========
                    {

                        //======== pluginPanelSettings ========
                        {
                            pluginPanelSettings.setBorder(
                                    new CompoundBorder(new EmptyBorder(4, 4, 4, 4), new EtchedBorder()));
                            pluginPanelSettings.setLayout(new BorderLayout());

                            //======== scrollPane1 ========
                            {
                                scrollPane1.setViewportView(pluginTable);
                            }
                            pluginPanelSettings.add(scrollPane1, BorderLayout.CENTER);

                            //======== pluginsButtonPanel ========
                            {
                                pluginsButtonPanel.setBorder(new EmptyBorder(4, 4, 4, 4));

                                //---- labelPluginInfo ----
                                labelPluginInfo.setText(bundle.getString("labelPluginInfo.text"));

                                //---- popmenuButton ----
                                popmenuButton.setText(bundle.getString("popmenuButton.text"));

                                //---- btnPluginOptions ----
                                btnPluginOptions.setText(bundle.getString("btnPluginOptions.text"));

                                PanelBuilder pluginsButtonPanelBuilder = new PanelBuilder(new FormLayout(
                                        new ColumnSpec[] { FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                                                FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                                                new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT,
                                                        FormSpec.DEFAULT_GROW),
                                                FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                                                FormSpecs.DEFAULT_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC,
                                                FormSpecs.DEFAULT_COLSPEC,
                                                FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                                                FormSpecs.UNRELATED_GAP_COLSPEC },
                                        RowSpec.decodeSpecs("default")), pluginsButtonPanel);

                                pluginsButtonPanelBuilder.add(labelPluginInfo, cc.xy(3, 1));
                                pluginsButtonPanelBuilder.add(popmenuButton, cc.xy(5, 1));
                                pluginsButtonPanelBuilder.add(btnPluginOptions, cc.xy(7, 1));
                            }
                            pluginPanelSettings.add(pluginsButtonPanel, BorderLayout.SOUTH);
                        }
                        pluginTabbedPane.addTab(bundle.getString("pluginPanelSettings.tab.title"),
                                pluginPanelSettings);

                        //======== pluginPanelUpdates ========
                        {
                            pluginPanelUpdates.setBorder(new CompoundBorder(new EmptyBorder(4, 4, 4, 4),
                                    new TitledBorder(bundle.getString("pluginPanelUpdates.border"))));

                            //---- check4PluginUpdatesAutomatically ----
                            check4PluginUpdatesAutomatically
                                    .setText(bundle.getString("check4PluginUpdatesAutomatically.text"));

                            //---- labelAfterDetectUpdate ----
                            labelAfterDetectUpdate.setText(bundle.getString("labelAfterDetectUpdate.text"));

                            //---- checkDownloadNotExistingPlugins ----
                            checkDownloadNotExistingPlugins
                                    .setText(bundle.getString("checkDownloadNotExistingPlugins.text"));

                            //---- labelCheckForUpdateEvery ----
                            labelCheckForUpdateEvery.setText(bundle.getString("labelCheckForUpdateEvery.text"));

                            //---- labelHours ----
                            labelHours.setText(bundle.getString("labelHours.text"));

                            //---- labelUpdateFromServer ----
                            labelUpdateFromServer.setText(bundle.getString("labelUpdateFromServer.text"));
                            labelUpdateFromServer.setLabelFor(comboPluginServers);

                            //---- comboPluginServers ----
                            comboPluginServers.setEditable(true);

                            //---- btnResetDefaultPluginServer ----
                            btnResetDefaultPluginServer
                                    .setText(bundle.getString("btnResetDefaultPluginServer.text"));

                            //---- labelManualCheck ----
                            labelManualCheck.setText(bundle.getString("labelManualCheck.text"));

                            PanelBuilder pluginPanelUpdatesBuilder = new PanelBuilder(new FormLayout(
                                    new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC,
                                            FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                                            new ColumnSpec(Sizes
                                                    .bounded(Sizes.MINIMUM, Sizes.dluX(30), Sizes.dluX(30))),
                                            FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                                            new ColumnSpec(ColumnSpec.FILL,
                                                    Sizes.bounded(Sizes.DEFAULT, Sizes.dluX(50),
                                                            Sizes.dluX(75)),
                                                    FormSpec.DEFAULT_GROW),
                                            FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                                            FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                                            FormSpecs.UNRELATED_GAP_COLSPEC },
                                    new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC,
                                            FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC,
                                            FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC,
                                            FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC,
                                            FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC,
                                            FormSpecs.UNRELATED_GAP_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC,
                                            FormSpecs.DEFAULT_ROWSPEC }),
                                    pluginPanelUpdates);

                            pluginPanelUpdatesBuilder.add(check4PluginUpdatesAutomatically,
                                    cc.xywh(1, 1, 5, 1));
                            pluginPanelUpdatesBuilder.add(labelAfterDetectUpdate,
                                    cc.xywh(1, 3, 3, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT));
                            pluginPanelUpdatesBuilder.add(comboHowToUpdate,
                                    cc.xywh(5, 3, 1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
                            pluginPanelUpdatesBuilder.add(checkDownloadNotExistingPlugins, cc.xywh(1, 5, 5, 1));
                            pluginPanelUpdatesBuilder.add(labelCheckForUpdateEvery,
                                    cc.xywh(1, 7, 1, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT));
                            pluginPanelUpdatesBuilder.add(spinnerUpdateHour, cc.xy(3, 7));
                            pluginPanelUpdatesBuilder.add(labelHours, cc.xy(5, 7));
                            pluginPanelUpdatesBuilder.add(labelUpdateFromServer,
                                    cc.xywh(1, 9, 1, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT));
                            pluginPanelUpdatesBuilder.add(comboPluginServers, cc.xywh(3, 9, 3, 1));
                            pluginPanelUpdatesBuilder.add(btnResetDefaultPluginServer, cc.xy(7, 9));
                            pluginPanelUpdatesBuilder.add(labelManualCheck, cc.xywh(1, 13, 7, 1));
                        }
                        pluginTabbedPane.addTab(bundle.getString("pluginPanelUpdates.tab.title"),
                                pluginPanelUpdates);

                    }

                    PanelBuilder panelPluginsBuilder = new PanelBuilder(
                            new FormLayout(ColumnSpec.decodeSpecs("default:grow"),
                                    new RowSpec[] {
                                            new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                                            FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("5px") }),
                            panelPlugins);

                    panelPluginsBuilder.add(pluginTabbedPane, cc.xy(1, 1));
                }
                panelCard.add(panelPlugins, "CARD6");
            }
            contentPanel.add(panelCard, BorderLayout.CENTER);
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);

        //======== buttonBar ========
        {
            buttonBar.setBorder(Borders.BUTTON_BAR_PAD);
            buttonBar.setCyclic(true);

            //---- btnOK ----
            btnOK.setText(bundle.getString("btnOK.text"));

            //---- btnCancel ----
            btnCancel.setText(bundle.getString("btnCancel.text"));

            PanelBuilder buttonBarBuilder = new PanelBuilder(new FormLayout(
                    new ColumnSpec[] { FormSpecs.GLUE_COLSPEC, ColumnSpec.decode("max(pref;42dlu)"),
                            FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.PREF_COLSPEC },
                    RowSpec.decodeSpecs("pref")), buttonBar);
            ((FormLayout) buttonBar.getLayout()).setColumnGroups(new int[][] { { 2, 4 } });

            buttonBarBuilder.add(btnOK, cc.xy(2, 1));
            buttonBarBuilder.add(btnCancel, cc.xy(4, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

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

License:Open Source License

/**
 * Create the dialog.//  w w  w . ja v  a 2 s . co  m
 */
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:org.tinymediamanager.ui.movies.dialogs.MovieSubtitleChooserDialog.java

License:Apache License

private void initComponents() {
    getContentPane().setLayout(new BorderLayout());

    final JPanel panelContent = new JPanel();
    getContentPane().add(panelContent, BorderLayout.CENTER);
    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,
                    ColumnSpec.decode("200dlu: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.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.UNRELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("120dlu:grow"),
                    FormSpecs.RELATED_GAP_ROWSPEC, }));

    final JLabel lblMovieTitle = new JLabel(movieToScrape.getTitle());
    TmmFontHelper.changeFont(lblMovieTitle, 1.33, Font.BOLD);
    panelContent.add(lblMovieTitle, "2, 2, 9, 1");

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

    final JLabel lblMediaFileName = new JLabel(fileToScrape.getFilename());
    panelContent.add(lblMediaFileName, "4, 4, 7, 1");

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

    final JLabel lblRuntime = new JLabel(fileToScrape.getDurationHHMMSS());
    panelContent.add(lblRuntime, "4, 6");

    final JLabel lblImdbIdT = new JLabel(BUNDLE.getString("metatag.imdb")); //$NON-NLS-1$
    panelContent.add(lblImdbIdT, "6, 6, right, default");

    final JLabel lblImdbId = new JLabel(movieToScrape.getImdbId());
    panelContent.add(lblImdbId, "8, 6");

    final JLabel lblScraperT = new JLabel(BUNDLE.getString("scraper")); //$NON-NLS-1$
    panelContent.add(lblScraperT, "2, 8, right, default");

    cbScraper = new MediaScraperCheckComboBox();
    panelContent.add(cbScraper, "4, 8, fill, default");

    tfSearchQuery = new JTextField(movieToScrape.getTitle());
    panelContent.add(tfSearchQuery, "6, 8, 3, 1, fill, default");
    tfSearchQuery.setColumns(10);//from   ww  w. ja  v a  2  s  .c o  m

    final JButton btnSearch = new JButton(BUNDLE.getString("Button.search")); //$NON-NLS-1$
    btnSearch.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            searchSubtitle(null, "", tfSearchQuery.getText());
        }
    });
    panelContent.add(btnSearch, "10, 8");

    final JLabel lblLanguageT = new JLabel(BUNDLE.getString("metatag.language")); //$NON-NLS-1$
    panelContent.add(lblLanguageT, "2, 10, right, default");

    cbLanguage = new JComboBox<>();
    cbLanguage.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            searchSubtitle(null, "", tfSearchQuery.getText());
        }
    });
    panelContent.add(cbLanguage, "4, 10, fill, default");

    final JScrollPane scrollPaneSubs = new JScrollPane();
    panelContent.add(scrollPaneSubs, "2, 12, 9, 1, fill, fill");

    tableSubs = new JTable(subtitleTableModel);
    tableSubs.setDefaultRenderer(ImageIcon.class, new Renderer());
    scrollPaneSubs.setViewportView(tableSubs);

    {
        JPanel panelBottom = new JPanel();
        getContentPane().add(panelBottom, BorderLayout.SOUTH);
        panelBottom.setLayout(new FormLayout(
                new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        ColumnSpec.decode("max(82dlu;default)"), FormFactory.RELATED_GAP_COLSPEC,
                        ColumnSpec.decode("default:grow"), FormFactory.DEFAULT_COLSPEC, },
                new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                        FormFactory.LINE_GAP_ROWSPEC }));

        progressBar = new JProgressBar();
        panelBottom.add(progressBar, "2, 2");

        lblProgressAction = new JLabel("");
        panelBottom.add(lblProgressAction, "4, 2");

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

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

            if (inQueue) {
                JButton btnAbortQueue = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$
                btnAbortQueue.setIcon(IconManager.PROCESS_STOP);
                btnAbortQueue.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        continueQueue = false;
                        setVisible(false);
                    }
                });
                panelButtons.add(btnAbortQueue);
            }
        }
    }
}

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

License:Apache License

public MovieTrailerSettingsPanel() {
    // data init/*from   w  w w.java  2  s .c  o  m*/
    List<String> enabledTrailerProviders = settings.getMovieTrailerScrapers();
    int selectedIndex = -1;
    int counter = 0;
    for (MediaScraper scraper : MovieList.getInstance().getAvailableTrailerScrapers()) {
        TrailerScraper trailerScraper = new TrailerScraper(scraper);
        if (enabledTrailerProviders.contains(trailerScraper.getScraperId())) {
            trailerScraper.active = true;
            if (selectedIndex < 0) {
                selectedIndex = counter;
            }
        }
        scrapers.add(trailerScraper);
        counter++;
    }

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

    JPanel panelTrailerScrapers = new JPanel();
    panelTrailerScrapers.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
            BUNDLE.getString("scraper.trailer"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); // $NON-NLS-1$
    add(panelTrailerScrapers, "2, 2, fill, fill");
    panelTrailerScrapers.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC,
                    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.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.UNRELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, }));

    final JScrollPane scrollPaneScraperDetails = new JScrollPane();
    scrollPaneScraperDetails.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPaneScraperDetails.setBorder(null);
    panelTrailerScrapers.add(scrollPaneScraperDetails, "8, 1, 1, 2, fill, fill");

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

    JScrollPane scrollPaneScraper = new JScrollPane();
    panelTrailerScrapers.add(scrollPaneScraper, "2, 2, 5, 1, fill, fill");

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

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

    checkBox = new JCheckBox(BUNDLE.getString("Settings.trailer.preferred")); //$NON-NLS-1$
    panelTrailerScrapers.add(checkBox, "2, 6, 7, 1");

    JLabel lblTrailerSource = new JLabel(BUNDLE.getString("Settings.trailer.source")); //$NON-NLS-1$
    panelTrailerScrapers.add(lblTrailerSource, "4, 8, right, default");

    cbTrailerSource = new JComboBox<>();
    cbTrailerSource.setModel(new DefaultComboBoxModel<>(MovieTrailerSources.values()));
    panelTrailerScrapers.add(cbTrailerSource, "6, 8, fill, default");

    JLabel lblTrailerQuality = new JLabel(BUNDLE.getString("Settings.trailer.quality")); //$NON-NLS-1$
    panelTrailerScrapers.add(lblTrailerQuality, "4, 10, right, default");

    cbTrailerQuality = new JComboBox<>();
    cbTrailerQuality.setModel(new DefaultComboBoxModel<>(MovieTrailerQuality.values()));
    panelTrailerScrapers.add(cbTrailerQuality, "6, 10, fill, default");

    chckbxAutomaticTrailerDownload = new JCheckBox(BUNDLE.getString("Settings.trailer.automaticdownload")); //$NON-NLS-1$
    panelTrailerScrapers.add(chckbxAutomaticTrailerDownload, "2, 12, 7, 1");

    JLabel lblAutomaticTrailerDownloadHint = new JLabel(
            BUNDLE.getString("Settings.trailer.automaticdownload.hint")); //$NON-NLS-1$
    TmmFontHelper.changeFont(lblAutomaticTrailerDownloadHint, 0.833);
    panelTrailerScrapers.add(lblAutomaticTrailerDownloadHint, "4, 14, 5, 1");

    initDataBindings();

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

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

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

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

From source file:org.tinymediamanager.ui.panels.MediaFileEditorPanel.java

License:Apache License

public MediaFileEditorPanel(List<MediaFile> mediaFiles) {
    this.mediaFiles = ObservableCollections.observableList(new ArrayList<MediaFileContainer>());
    for (MediaFile mediaFile : mediaFiles) {
        MediaFileContainer container = new MediaFileContainer(mediaFile);
        this.mediaFiles.add(container);
    }/*from   ww w  .  ja v  a 2  s  . c  o  m*/

    setLayout(new FormLayout(
            new ColumnSpec[] { 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, }));
    {
        JSplitPane splitPane = new JSplitPane();
        add(splitPane, "2, 2, fill, fill");
        {
            JPanel panelMediaFiles = new JPanel();
            panelMediaFiles.setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("175dlu:grow"), },
                    new RowSpec[] { FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("default:grow"), }));
            JScrollPane scrollPaneMediaFiles = new JScrollPane();
            panelMediaFiles.add(scrollPaneMediaFiles, "1, 2, fill, fill");
            splitPane.setLeftComponent(panelMediaFiles);
            {
                tableMediaFiles = new JTable();
                scrollPaneMediaFiles.setViewportView(tableMediaFiles);
            }
        }
        {
            JPanel panelDetails = new JPanel();
            splitPane.setRightComponent(panelDetails);
            panelDetails.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC,
                    FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    ColumnSpec.decode("15dlu"), FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                    FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, },
                    new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("15dlu"),
                            FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                            FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                            FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                            FormSpecs.UNRELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                            FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                            FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                            FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                            FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                            FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                            FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                            FormSpecs.RELATED_GAP_ROWSPEC, }));
            {
                lblFilename = new JLabel("");
                panelDetails.add(lblFilename, "2, 2, 7, 1");
            }
            {
                JLabel lblCodec = new JLabel("Codec");
                panelDetails.add(lblCodec, "2, 4, right, default");
            }
            {
                tfCodec = new JTextField();
                panelDetails.add(tfCodec, "4, 4, fill, default");
                tfCodec.setColumns(10);
            }
            {
                JLabel lblContainerFormat = new JLabel("Container format");
                panelDetails.add(lblContainerFormat, "6, 4, right, default");
            }
            {
                tfContainerFormat = new JTextField();
                panelDetails.add(tfContainerFormat, "8, 4, fill, default");
                tfContainerFormat.setColumns(10);
            }
            {
                JLabel lblWidth = new JLabel("Width");
                panelDetails.add(lblWidth, "2, 6, right, default");
            }
            {
                tfWidth = new JTextField();
                tfWidth.setInputVerifier(new IntegerInputVerifier());
                panelDetails.add(tfWidth, "4, 6, fill, default");
                tfWidth.setColumns(10);
            }
            {
                JLabel lblHeight = new JLabel("Height");
                panelDetails.add(lblHeight, "6, 6, right, default");
            }
            {
                tfHeight = new JTextField();
                tfHeight.setInputVerifier(new IntegerInputVerifier());
                panelDetails.add(tfHeight, "8, 6, fill, default");
                tfHeight.setColumns(10);
            }
            {
                JLabel lblFrameRate = new JLabel(BUNDLE.getString("metatag.framerate"));
                panelDetails.add(lblFrameRate, "2, 8, right, default");

                tfFrameRate = new JTextField();
                tfFrameRate.setInputVerifier(new DoubleInputVerifier());
                panelDetails.add(tfFrameRate, "4, 8, fill, default");
                tfFrameRate.setColumns(10);
            }

            {
                cb3dFormat = new JComboBox<>();
                cb3dFormat.addItem("");
                cb3dFormat.addItem(MediaFile.VIDEO_3D);
                cb3dFormat.addItem(MediaFile.VIDEO_3D_SBS);
                cb3dFormat.addItem(MediaFile.VIDEO_3D_HSBS);
                cb3dFormat.addItem(MediaFile.VIDEO_3D_TAB);
                cb3dFormat.addItem(MediaFile.VIDEO_3D_HTAB);

                JLabel lbld = new JLabel("3D Format");
                panelDetails.add(lbld, "6, 8, right, default");

                panelDetails.add(cb3dFormat, "8, 8, fill, default");
            }
            {
                JLabel lblAudiostreams = new JLabel("AudioStreams");
                panelDetails.add(lblAudiostreams, "2, 10, right, default");
            }
            {
                JScrollPane scrollPane = new JScrollPane();
                panelDetails.add(scrollPane, "4, 10, 5, 5, fill, fill");
                {
                    tableAudioStreams = new JTable();
                    scrollPane.setViewportView(tableAudioStreams);
                }
            }
            {
                btnAddAudioStream = new JButton("");
                btnAddAudioStream.setAction(new AddAudioStreamAction());
                btnAddAudioStream.setMargin(new Insets(2, 2, 2, 2));
                btnAddAudioStream.setIcon(IconManager.LIST_ADD);
                panelDetails.add(btnAddAudioStream, "2, 12, right, top");
            }
            {
                btnRemoveAudioStream = new JButton("");
                btnRemoveAudioStream.setAction(new RemoveAudioStreamAction());
                btnRemoveAudioStream.setMargin(new Insets(2, 2, 2, 2));
                btnRemoveAudioStream.setIcon(IconManager.LIST_REMOVE);
                panelDetails.add(btnRemoveAudioStream, "2, 14, right, top");
            }
            {
                JLabel lblSubtitles = new JLabel("Subtitles");
                panelDetails.add(lblSubtitles, "2, 16, right, default");
            }
            {
                JScrollPane scrollPane = new JScrollPane();
                panelDetails.add(scrollPane, "4, 16, 5, 5, fill, fill");
                {
                    tableSubtitles = new JTable();
                    scrollPane.setViewportView(tableSubtitles);
                }
            }
            {
                btnAddSubtitle = new JButton("");
                btnAddSubtitle.setAction(new AddSubtitleAction());
                btnAddSubtitle.setMargin(new Insets(2, 2, 2, 2));
                btnAddSubtitle.setIcon(IconManager.LIST_ADD);
                panelDetails.add(btnAddSubtitle, "2, 18, right, top");
            }
            {
                btnRemoveSubtitle = new JButton("");
                btnRemoveSubtitle.setAction(new RemoveSubtitleAction());
                btnRemoveSubtitle.setMargin(new Insets(2, 2, 2, 2));
                btnRemoveSubtitle.setIcon(IconManager.LIST_REMOVE);
                panelDetails.add(btnRemoveSubtitle, "2, 20, right, top");
            }
        }
    }

    initDataBindings();

    // select first
    if (!this.mediaFiles.isEmpty()) {
        tableMediaFiles.getSelectionModel().setSelectionInterval(0, 0);
    }

    // add selection listener to disable editing when needed
    tableMediaFiles.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        private Set<MediaFileType> videoTypes = new HashSet<>(
                Arrays.asList(VIDEO, VIDEO_EXTRA, SAMPLE, TRAILER));

        @Override
        public void valueChanged(ListSelectionEvent arg0) {
            if (!arg0.getValueIsAdjusting()) {
                int selectedRow = tableMediaFiles.convertRowIndexToModel(tableMediaFiles.getSelectedRow());
                if (selectedRow > -1) {
                    MediaFile mf = MediaFileEditorPanel.this.mediaFiles.get(selectedRow).getMediaFile();
                    // codec should not be enabled for NFOs
                    tfCodec.setEnabled(!(mf.getType() == NFO));
                    // audio streams and subtitles should not be enabled for anything except VIDEOS/TRAILER/SAMPLES
                    btnAddAudioStream.setEnabled(videoTypes.contains(mf.getType()));
                    btnRemoveAudioStream.setEnabled(videoTypes.contains(mf.getType()));
                    btnAddSubtitle.setEnabled(videoTypes.contains(mf.getType()));
                    btnRemoveSubtitle.setEnabled(videoTypes.contains(mf.getType()));
                    // 3D is only available for video types
                    cb3dFormat.setEnabled(videoTypes.contains(mf.getType()));
                }
            }
        }
    });
}

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

License:Apache License

private void initComponents() {
    getContentPane().setLayout(new BorderLayout());

    final JPanel panelContent = new JPanel();
    getContentPane().add(panelContent, BorderLayout.CENTER);
    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,
                    FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, },
            new 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.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("120dlu:grow"),
                    FormSpecs.RELATED_GAP_ROWSPEC, }));

    final JLabel lblEpisodeTitle = new JLabel(episodeToScrape.getTitle());
    TmmFontHelper.changeFont(lblEpisodeTitle, 1.33, Font.BOLD);
    panelContent.add(lblEpisodeTitle, "2, 2, 9, 1");

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

    JLabel lblSeason = new JLabel(String.valueOf(episodeToScrape.getSeason()));
    panelContent.add(lblSeason, "4, 4");

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

    JLabel lblEpisode = new JLabel(String.valueOf(episodeToScrape.getEpisode()));
    panelContent.add(lblEpisode, "4, 6");

    final JLabel lblMediaFileNameT = new JLabel(BUNDLE.getString("metatag.filename")); //$NON-NLS-1$
    panelContent.add(lblMediaFileNameT, "2, 8, right, default");

    final JLabel lblMediaFileName = new JLabel(fileToScrape.getFilename());
    panelContent.add(lblMediaFileName, "4, 8, 7, 1");

    final JLabel lblScraperT = new JLabel(BUNDLE.getString("scraper")); //$NON-NLS-1$
    panelContent.add(lblScraperT, "2, 10, right, default");

    cbScraper = new MediaScraperCheckComboBox();
    panelContent.add(cbScraper, "4, 10, fill, default");

    final JLabel lblLanguageT = new JLabel(BUNDLE.getString("metatag.language")); //$NON-NLS-1$
    panelContent.add(lblLanguageT, "2, 12, right, default");

    cbLanguage = new JComboBox<>();
    panelContent.add(cbLanguage, "4, 12, fill, default");

    final JButton btnSearch = new JButton(BUNDLE.getString("Button.search")); //$NON-NLS-1$
    btnSearch.addActionListener(new ActionListener() {
        @Override//from www .j  ava 2  s .c o m
        public void actionPerformed(ActionEvent e) {
            searchSubtitle(fileToScrape.getFileAsPath().toFile(), episodeToScrape.getTvShow().getImdbId(),
                    episodeToScrape.getSeason(), episodeToScrape.getEpisode());
        }
    });
    panelContent.add(btnSearch, "8, 12");

    final JScrollPane scrollPaneSubs = new JScrollPane();
    panelContent.add(scrollPaneSubs, "2, 14, 9, 1, fill, fill");

    tableSubs = new JTable(subtitleTableModel);
    scrollPaneSubs.setViewportView(tableSubs);

    {
        JPanel panelBottom = new JPanel();
        getContentPane().add(panelBottom, BorderLayout.SOUTH);
        panelBottom.setLayout(new FormLayout(
                new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        ColumnSpec.decode("max(82dlu;default)"), FormFactory.RELATED_GAP_COLSPEC,
                        ColumnSpec.decode("default:grow"), FormFactory.DEFAULT_COLSPEC, },
                new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                        FormFactory.LINE_GAP_ROWSPEC }));

        progressBar = new JProgressBar();
        panelBottom.add(progressBar, "2, 2");

        lblProgressAction = new JLabel("");
        panelBottom.add(lblProgressAction, "4, 2");

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

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

            if (inQueue) {
                JButton btnAbortQueue = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$
                btnAbortQueue.setIcon(IconManager.PROCESS_STOP);
                btnAbortQueue.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        continueQueue = false;
                        setVisible(false);
                    }
                });
                panelButtons.add(btnAbortQueue);
            }
        }
    }
}