Example usage for javax.swing JButton setActionCommand

List of usage examples for javax.swing JButton setActionCommand

Introduction

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

Prototype

public void setActionCommand(String actionCommand) 

Source Link

Document

Sets the action command for this button.

Usage

From source file:org.openmicroscopy.shoola.env.ui.ActivityComponent.java

/**
 * Creates a button.// w  w w .  j ava  2  s . c om
 * 
 * @param text The text of the button.
 * @param actionID The action command id.
 * @param l The action listener.
 * @return See above.
 */
JButton createButton(String text, int actionID, ActionListener l) {
    JButton b = UIUtilities.createHyperLinkButton(text);
    b.setActionCommand("" + actionID);
    b.addActionListener(l);
    return b;
}

From source file:org.openmicroscopy.shoola.util.ui.MessengerDialog.java

/**
 * Formats the specified button.//from w ww  .  j av a 2s  .  c  o  m
 * 
 * @param b         The button to format.
 * @param mnemonic   The key-code that indicates a mnemonic key.
 * @param tooltip   The button's tooltip.
 * @param actionID   The action id associated to the passed button.
 */
private void formatButton(JButton b, int mnemonic, String tooltip, int actionID) {
    b.setMnemonic(mnemonic);
    b.setOpaque(false);
    b.setToolTipText(tooltip);
    b.addActionListener(this);
    b.setActionCommand("" + actionID);
}

From source file:org.openmicroscopy.shoola.util.ui.omeeditpane.OMEWikiComponent.java

/** Installs the default actions.  */
private void installDefaultAction() {
    columns = COLUMNS;// w w  w  . jav a 2 s.  co m
    wrapWord = true;
    toolBarActions = new ArrayList<JButton>();
    IconManager icons = IconManager.getInstance();
    JButton b = new JButton(icons.getIcon(IconManager.HYPERLINK));
    b.addActionListener(this);
    b.setActionCommand("" + HYPERLINK);
    b.setToolTipText(OMEWikiConstants.HYPERLINK_TOOLTIP);
    toolBarActions.add(b);
    /*
    b = new JButton(icons.getIcon(IconManager.IMAGE));
    b.setToolTipText(OMEWikiConstants.IMAGE_TOOLTIP);
    b.addActionListener(this);
    b.setActionCommand(""+IMAGE);
    toolBarActions.add(b);
    b = new JButton(icons.getIcon(IconManager.FILE_EDITOR));
    b.setToolTipText(OMEWikiConstants.PROTOCOL_TOOLTIP);
    b.addActionListener(this);
    b.setActionCommand(""+PROTOCOL);
    //UIUtilities.unifiedButtonLookAndFeel(b);
     *
     */
    toolBarActions.add(b);
}

From source file:org.openpnp.gui.AboutDialog.java

public AboutDialog(Frame frame) {
    super(frame, true);
    setTitle("About OpenPnP");
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setBounds(100, 100, 347, 360);//w w w .j av a 2 s .c  o m
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
    JLabel lblOpenpnp = new JLabel("OpenPnP");
    lblOpenpnp.setAlignmentX(Component.CENTER_ALIGNMENT);
    lblOpenpnp.setFont(new Font("Lucida Grande", Font.BOLD, 32));
    contentPanel.add(lblOpenpnp);
    JLabel lblCopyright = new JLabel("Copyright  2011 - 2016 Jason von Nieda");
    lblCopyright.setFont(new Font("Lucida Grande", Font.PLAIN, 10));
    lblCopyright.setAlignmentX(Component.CENTER_ALIGNMENT);
    contentPanel.add(lblCopyright);
    JLabel lblVersion = new JLabel("Version: " + Main.getVersion());
    lblVersion.setFont(new Font("Lucida Grande", Font.PLAIN, 10));
    lblVersion.setAlignmentX(Component.CENTER_ALIGNMENT);
    contentPanel.add(lblVersion);

    textPane = new JTextPane();
    textPane.setEditable(false);
    contentPanel.add(new JScrollPane(textPane));
    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 arg0) {
            setVisible(false);
        }
    });
    okButton.setActionCommand("OK");
    buttonPane.add(okButton);
    getRootPane().setDefaultButton(okButton);

    try {
        String s = FileUtils.readFileToString(new File("CHANGES.md"));
        textPane.setText(s);
        textPane.setCaretPosition(0);
    } catch (Exception e) {

    }
}

From source file:org.orbisgis.core.ui.plugins.views.geocatalog.Catalog.java

private JButton getTagManagementButton(ImageIcon icon, String actionCommand) {
    JButton ret = new JButton(icon);
    ret.addActionListener(new ActionListener() {

        @Override//from   ww w  .  jav a 2  s. c o  m
        public void actionPerformed(ActionEvent e) {
            if (AC_BTN_ADD_TAG.equals(e.getActionCommand())) {
                AskValue av = new AskValue(
                        I18N.getString("orbisgis.org.orbisgis.core.ui.plugins.views.geocatalog.newTag"),
                        I18N.getString("orbisgis.org.orbisgis.core.ui.message.askValue.sql"),
                        I18N.getString("orbisgis.org.orbisgis.core.ui.message.askValue.error"));
                if (UIFactory.showDialog(av)) {
                    String tagText = av.getValue();
                    addTag(tagText);
                }
            } else if (AC_BTN_DEL_TAG.equals(e.getActionCommand())) {
                tagSources.remove(lstTags.getSelectedValue());
                refreshTagModel();
            }
        }
    });
    ret.setActionCommand(actionCommand);
    ret.setMargin(new Insets(0, 0, 0, 0));
    return ret;
}

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

public LicenseDialog(String libName, String libHomepage, String licenseName, String licenseFilename) {
    setSize(680, 480);//from   w w  w. j  a va 2  s  .  c o m
    setTitle(libName);
    getContentPane().setLayout(new BorderLayout());
    {
        JPanel panel = new JPanel();
        getContentPane().add(panel, BorderLayout.NORTH);
        panel.setLayout(new MigLayout("", "[grow,trailing][grow]", "[20px][][]"));
        {
            JLabel lblSoft = new JLabel(libName);
            lblSoft.setFont(new Font("Tahoma", Font.BOLD, 16));
            panel.add(lblSoft, "center,cell 0 0 2 1");
        }
        {
            JLabel lblHomePage = new JLabel("Home page:");
            lblHomePage.setFont(new Font("Tahoma", Font.BOLD, 14));
            panel.add(lblHomePage, "cell 0 1");
        }
        {
            JLabel lblHome = SwingUtil.createLink(libHomepage, libHomepage);
            lblHome.setFont(new Font("Tahoma", Font.PLAIN, 14));
            panel.add(lblHome, "cell 1 1");
        }
        {
            JLabel lblNewLabel = new JLabel("License:");
            lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 14));
            panel.add(lblNewLabel, "cell 0 2");
        }
        {
            JLabel lblLicense = new JLabel(licenseName);
            lblLicense.setFont(new Font("Tahoma", Font.PLAIN, 14));
            panel.add(lblLicense, "cell 1 2");
        }
    }
    {
        JPanel panel = new JPanel();
        getContentPane().add(panel, BorderLayout.CENTER);
        panel.setLayout(new FlowLayout());
        panel.setBorder(new EmptyBorder(5, 5, 5, 5));
        JScrollPane scrollPane = new JScrollPane();
        scrollPane.setPreferredSize(new Dimension(600, 300));
        scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        panel.add(scrollPane);
        {
            JTextArea txtLicense = new JTextArea();
            txtLicense.setEditable(false);
            txtLicense.setFont(new Font("Monospaced", Font.PLAIN, 11));
            txtLicense.setWrapStyleWord(true);
            txtLicense.setLineWrap(true);
            try {
                InputStream is = Thread.currentThread().getContextClassLoader()
                        .getResourceAsStream("org/p_vcd/licenses/" + licenseFilename);
                String text = IOUtils.toString(is, "UTF-8");
                IOUtils.closeQuietly(is);
                txtLicense.setText(text);
                txtLicense.setCaretPosition(0);
            } catch (Exception e) {
                e.printStackTrace();
            }
            scrollPane.setViewportView(txtLicense);
        }
    }
    {
        JPanel panel = new JPanel();
        getContentPane().add(panel, BorderLayout.SOUTH);
        panel.setLayout(new FlowLayout(FlowLayout.CENTER));
        JButton okButton = new JButton("OK");
        okButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                LicenseDialog.this.dispose();
            }
        });
        okButton.setActionCommand("OK");
        panel.add(okButton);
        getRootPane().setDefaultButton(okButton);
    }
}

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

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

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

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

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

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

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

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

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

        scrollPane.setViewportView(lbl_refDbFiles);

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

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

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

        ButtonGroup queryButtonGroup = new ButtonGroup();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        ButtonGroup buttonGroup = new ButtonGroup();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

From source file:org.tinymediamanager.ui.dialogs.ImageChooserDialog.java

/**
 * Instantiates a new image chooser dialog.
 * //from   ww w.  ja va2 s .  c o m
 * @param ids
 *          the ids
 * @param type
 *          the type
 * @param artworkScrapers
 *          the artwork providers
 * @param imageLabel
 *          the image label
 * @param extraThumbs
 *          the extra thumbs
 * @param extraFanarts
 *          the extra fanarts
 * @param mediaType
 *          the media for for which artwork has to be chosen
 */
public ImageChooserDialog(final HashMap<String, Object> ids, ImageType type, List<MediaScraper> artworkScrapers,
        ImageLabel imageLabel, List<String> extraThumbs, List<String> extraFanarts, MediaType mediaType) {
    super("", "imageChooser");
    this.imageLabel = imageLabel;
    this.type = type;
    this.mediaType = mediaType;
    this.artworkScrapers = artworkScrapers;
    this.extraThumbs = extraThumbs;
    this.extraFanarts = extraFanarts;

    switch (type) {
    case FANART:
        setTitle(BUNDLE.getString("image.choose.fanart")); //$NON-NLS-1$
        break;

    case POSTER:
        setTitle(BUNDLE.getString("image.choose.poster")); //$NON-NLS-1$
        break;

    case BANNER:
        setTitle(BUNDLE.getString("image.choose.banner")); //$NON-NLS-1$
        break;

    case SEASON:
        Object season = ids.get("tvShowSeason");
        if (season != null) {
            setTitle(BUNDLE.getString("image.choose.season") + " - " + BUNDLE.getString("metatag.season") + " " //$NON-NLS-1$
                    + season);
        } else {
            setTitle(BUNDLE.getString("image.choose.season")); //$NON-NLS-1$
        }
        break;

    case CLEARART:
        setTitle(BUNDLE.getString("image.choose.clearart")); //$NON-NLS-1$
        break;

    case DISC:
        setTitle(BUNDLE.getString("image.choose.disc")); //$NON-NLS-1$
        break;

    case LOGO:
        setTitle(BUNDLE.getString("image.choose.logo")); //$NON-NLS-1$
        break;

    case CLEARLOGO:
        setTitle(BUNDLE.getString("image.choose.clearlogo")); //$NON-NLS-1$
        break;

    case THUMB:
        setTitle(BUNDLE.getString("image.choose.thumb")); //$NON-NLS-1$
        break;
    }

    setBounds(5, 5, 1000, 590);

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("258px:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                    FormFactory.LABEL_COMPONENT_GAP_COLSPEC, },
            new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("fill:266px:grow"),
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, }));
    {
        scrollPane = new JScrollPane();
        scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        contentPanel.add(scrollPane, "2, 2, 3, 1, fill, fill");
        {
            panelImages = new JPanel();
            scrollPane.setViewportView(panelImages);
            scrollPane.getVerticalScrollBar().setUnitIncrement(16);
            panelImages.setLayout(new WrapLayout(FlowLayout.LEFT));
        }
    }
    {
        tfImageUrl = new EnhancedTextField(BUNDLE.getString("image.inserturl")); //$NON-NLS-1$
        contentPanel.add(tfImageUrl, "2, 4, fill, default");
        tfImageUrl.setColumns(10);
        JButton btnAddImage = new JButton(BUNDLE.getString("image.downloadimage")); //$NON-NLS-1$
        btnAddImage.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (StringUtils.isNotBlank(tfImageUrl.getText())) {
                    downloadAndPreviewImage(tfImageUrl.getText());
                }
            }
        });
        contentPanel.add(btnAddImage, "4, 4");

    }
    {
        JPanel bottomPane = new JPanel();
        getContentPane().add(bottomPane, BorderLayout.SOUTH);
        bottomPane.setLayout(new FormLayout(
                new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                        FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                        FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                        FormFactory.RELATED_GAP_COLSPEC, },
                new RowSpec[] { FormFactory.NARROW_LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                        FormFactory.NARROW_LINE_GAP_ROWSPEC, RowSpec.decode("23px:grow"),
                        FormFactory.RELATED_GAP_ROWSPEC, }));
        {
            if (type == ImageType.FANART && extraFanarts != null && extraThumbs != null) {
                JPanel panelExtraButtons = new JPanel();
                bottomPane.add(panelExtraButtons, "2, 2, fill, bottom");
                panelExtraButtons.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0));
                {
                    if (mediaType == MediaType.MOVIE
                            && MovieModuleManager.MOVIE_SETTINGS.isImageExtraThumbs()) {
                        JLabel labelThumbs = new JLabel("Extrathumbs:");
                        panelExtraButtons.add(labelThumbs);
                        JButton btnMarkExtrathumbs = new JButton("");
                        btnMarkExtrathumbs.setMargin(new Insets(0, 0, 0, 0));
                        btnMarkExtrathumbs.setIcon(IconManager.CHECK_ALL);
                        btnMarkExtrathumbs.setToolTipText(BUNDLE.getString("image.extrathumbs.markall")); //$NON-NLS-1$
                        btnMarkExtrathumbs.addActionListener(new ActionListener() {

                            @Override
                            public void actionPerformed(ActionEvent arg0) {
                                for (JToggleButton button : buttons) {
                                    if (button
                                            .getClientProperty("MediaArtworkExtrathumb") instanceof JCheckBox) {
                                        JCheckBox chkbx = (JCheckBox) button
                                                .getClientProperty("MediaArtworkExtrathumb");
                                        chkbx.setSelected(true);
                                    }
                                }
                            }
                        });
                        panelExtraButtons.add(btnMarkExtrathumbs);
                        JButton btnUnMarkExtrathumbs = new JButton("");
                        btnUnMarkExtrathumbs.setMargin(new Insets(0, 0, 0, 0));
                        btnUnMarkExtrathumbs.setIcon(IconManager.UNCHECK_ALL);
                        btnUnMarkExtrathumbs.setToolTipText(BUNDLE.getString("image.extrathumbs.unmarkall")); //$NON-NLS-1$
                        btnUnMarkExtrathumbs.addActionListener(new ActionListener() {
                            @Override
                            public void actionPerformed(ActionEvent arg0) {
                                for (JToggleButton button : buttons) {
                                    if (button
                                            .getClientProperty("MediaArtworkExtrathumb") instanceof JCheckBox) {
                                        JCheckBox chkbx = (JCheckBox) button
                                                .getClientProperty("MediaArtworkExtrathumb");
                                        chkbx.setSelected(false);
                                    }
                                }
                            }
                        });
                        panelExtraButtons.add(btnUnMarkExtrathumbs);
                    }
                    if (mediaType == MediaType.MOVIE && MovieModuleManager.MOVIE_SETTINGS.isImageExtraThumbs()
                            && MovieModuleManager.MOVIE_SETTINGS.isImageExtraFanart())

                    {
                        JSeparator separator = new JSeparator(SwingConstants.VERTICAL);
                        separator.setPreferredSize(new Dimension(2, 16));
                        panelExtraButtons.add(separator);
                    }
                    if (mediaType == MediaType.MOVIE && MovieModuleManager.MOVIE_SETTINGS.isImageExtraFanart())

                    {
                        JLabel labelFanart = new JLabel("Extrafanart:");
                        panelExtraButtons.add(labelFanart);
                        JButton btnMarkExtrafanart = new JButton("");
                        btnMarkExtrafanart.setMargin(new Insets(0, 0, 0, 0));
                        btnMarkExtrafanart.setIcon(IconManager.CHECK_ALL);
                        btnMarkExtrafanart.setToolTipText(BUNDLE.getString("image.extrafanart.markall")); //$NON-NLS-1$
                        btnMarkExtrafanart.addActionListener(new ActionListener() {
                            @Override
                            public void actionPerformed(ActionEvent arg0) {
                                for (JToggleButton button : buttons) {
                                    if (button.getClientProperty(
                                            "MediaArtworkExtrafanart") instanceof JCheckBox) {
                                        JCheckBox chkbx = (JCheckBox) button
                                                .getClientProperty("MediaArtworkExtrafanart");
                                        chkbx.setSelected(true);
                                    }
                                }
                            }
                        });
                        panelExtraButtons.add(btnMarkExtrafanart);
                        JButton btnUnMarkExtrafanart = new JButton("");
                        btnUnMarkExtrafanart.setMargin(new Insets(0, 0, 0, 0));
                        btnUnMarkExtrafanart.setIcon(IconManager.UNCHECK_ALL);
                        btnUnMarkExtrafanart.setToolTipText(BUNDLE.getString("image.extrafanart.unmarkall")); //$NON-NLS-1$
                        btnUnMarkExtrafanart.addActionListener(new ActionListener() {
                            @Override
                            public void actionPerformed(ActionEvent arg0) {
                                for (JToggleButton button : buttons) {
                                    if (button.getClientProperty(
                                            "MediaArtworkExtrafanart") instanceof JCheckBox) {
                                        JCheckBox chkbx = (JCheckBox) button
                                                .getClientProperty("MediaArtworkExtrafanart");
                                        chkbx.setSelected(false);
                                    }
                                }
                            }
                        });
                        panelExtraButtons.add(btnUnMarkExtrafanart);
                    }
                }
            }
        }

        {
            progressBar = new JProgressBar();
            bottomPane.add(progressBar, "2, 4");
        }
        {
            lblProgressAction = new JLabel("");
            bottomPane.add(lblProgressAction, "4, 4");
        }
        {

            JPanel buttonPane = new JPanel();
            EqualsLayout layout = new EqualsLayout(5);
            buttonPane.setLayout(layout);
            layout.setMinWidth(100);
            bottomPane.add(buttonPane, "6, 4, fill, top");
            JButton okButton = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$
            okButton.setAction(actionOK);
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);

            getRootPane().setDefaultButton(okButton);

            JButton btnAddFile = new JButton(BUNDLE.getString("Button.addfile")); //$NON-NLS-1$
            btnAddFile.setAction(actionLocalFile);
            buttonPane.add(btnAddFile);

            JButton cancelButton = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$
            cancelButton.setAction(actionCancel);
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }

    }

    task = new DownloadTask(ids, this.artworkScrapers);
    task.execute();
}

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

/**
 * Create the dialog./*from   w w  w. j a  v a  2  s  .  c  o m*/
 * 
 * @param movie
 *          the movie
 * @param inQueue
 *          the in queue
 */
public MovieEditorDialog(Movie movie, boolean inQueue) {
    super(BUNDLE.getString("movie.edit"), "movieEditor"); //$NON-NLS-1$
    setBounds(5, 5, 950, 650);

    movieToEdit = movie;
    ids = MediaIdTable.convertIdMapToEventList(movieToEdit.getIds());
    for (MediaFile mf : movie.getMediaFiles()) {
        mediaFiles.add(new MediaFile(mf));
    }

    getContentPane().setLayout(new BorderLayout());
    {
        JPanel panelPath = new JPanel();
        getContentPane().add(panelPath, BorderLayout.NORTH);
        panelPath.setLayout(new FormLayout(
                new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                        FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC,
                        FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, },
                new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("15px"),
                        FormFactory.RELATED_GAP_ROWSPEC, }));

        JLabel lblMoviePathT = new JLabel(BUNDLE.getString("metatag.path")); //$NON-NLS-1$
        panelPath.add(lblMoviePathT, "2, 2, left, top");

        lblMoviePath = new JLabel("");
        TmmFontHelper.changeFont(lblMoviePath, 1.166, Font.BOLD);
        panelPath.add(lblMoviePath, "5, 2, left, top");
    }

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.NORTH);
    getContentPane().add(tabbedPane, BorderLayout.CENTER);

    /**
     * DetailsPanel 1
     */
    {
        details1Panel.setBorder(new EmptyBorder(5, 5, 5, 5));
        details1Panel.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC,
                ColumnSpec.decode("max(40dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC,
                FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("7dlu:grow"),
                FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                ColumnSpec.decode("25dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("24dlu"),
                FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("7dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC,
                FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("100dlu:grow(2)"),
                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.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                        FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("50px:grow"),
                        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,
                        RowSpec.decode("15dlu"), 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,
                        RowSpec.decode("fill:50dlu:grow"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC,
                        FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC,
                        FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC,
                        RowSpec.decode("50px"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC,
                        RowSpec.decode("fill:default:grow"), }));

        {
            JLabel lblTitle = new JLabel(BUNDLE.getString("metatag.title")); //$NON-NLS-1$
            details1Panel.add(lblTitle, "2, 4, right, default");
        }
        {
            tfTitle = new JTextField();
            details1Panel.add(tfTitle, "4, 4, 15, 1, fill, default");
            tfTitle.setColumns(10);
        }
        {
            // JLabel lblPoster = new JLabel("");
            lblPoster = new ImageLabel();
            lblPoster.setAlternativeText(BUNDLE.getString("image.notfound.poster")); //$NON-NLS-1$
            lblPoster.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(), ImageType.POSTER,
                            movieList.getDefaultArtworkScrapers(), lblPoster, null, null, MediaType.MOVIE);
                    dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                    dialog.setVisible(true);
                }
            });
            lblPoster.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            details1Panel.add(lblPoster, "22, 4, 3, 23, fill, fill");
        }
        {
            JLabel lblOriginalTitle = new JLabel(BUNDLE.getString("metatag.originaltitle")); //$NON-NLS-1$
            details1Panel.add(lblOriginalTitle, "2, 6, right, default");
        }
        {
            tfOriginalTitle = new JTextField();
            details1Panel.add(tfOriginalTitle, "4, 6, 15, 1, fill, top");
            tfOriginalTitle.setColumns(10);
        }
        {
            JLabel lblSorttitle = new JLabel(BUNDLE.getString("metatag.sorttitle")); //$NON-NLS-1$
            details1Panel.add(lblSorttitle, "2, 8, right, default");
        }
        {
            tfSorttitle = new JTextField();
            details1Panel.add(tfSorttitle, "4, 8, 15, 1, fill, default");
            tfSorttitle.setColumns(10);
        }
        {
            JLabel lblTagline = new JLabel(BUNDLE.getString("metatag.tagline")); //$NON-NLS-1$
            details1Panel.add(lblTagline, "2, 10, right, top");
        }
        {
            JScrollPane scrollPaneTagline = new JScrollPane();
            tpTagline = new JTextPane();
            scrollPaneTagline.setViewportView(tpTagline);
            details1Panel.add(scrollPaneTagline, "4, 10, 15, 1, fill, fill");
        }
        {
            JLabel lblYear = new JLabel(BUNDLE.getString("metatag.year")); //$NON-NLS-1$
            details1Panel.add(lblYear, "2, 12, right, default");
        }
        {
            spYear = new YearSpinner();
            details1Panel.add(spYear, "4, 12, fill, top");
        }
        {
            JLabel lblRuntime = new JLabel(BUNDLE.getString("metatag.runtime")); //$NON-NLS-1$
            details1Panel.add(lblRuntime, "8, 12, right, default");
        }
        {
            spRuntime = new JSpinner();
            details1Panel.add(spRuntime, "10, 12, fill, default");
        }
        {
            JLabel lblMin = new JLabel(BUNDLE.getString("metatag.minutes")); //$NON-NLS-1$
            details1Panel.add(lblMin, "12, 12");
        }
        {
            JLabel lblRating = new JLabel(BUNDLE.getString("metatag.rating")); //$NON-NLS-1$
            details1Panel.add(lblRating, "16, 12, right, default");
        }
        {
            spRating = new JSpinner();
            details1Panel.add(spRating, "18, 12");
        }

        spRating.setModel(new SpinnerNumberModel(movie.getRating(), 0.0, 10.0, 0.1));
        {
            JLabel lblReleaseDate = new JLabel(BUNDLE.getString("metatag.releasedate")); //$NON-NLS-1$
            details1Panel.add(lblReleaseDate, "2, 14, right, default");
        }
        {
            dpReleaseDate = new DatePicker(movie.getReleaseDate());
            details1Panel.add(dpReleaseDate, "4, 14");
        }
        {
            JLabel lblCertification = new JLabel(BUNDLE.getString("metatag.certification")); //$NON-NLS-1$
            details1Panel.add(lblCertification, "8, 14, right, default");
        }
        cbCertification = new JComboBox();
        details1Panel.add(cbCertification, "10, 14, 3, 1, fill, default");
        {
            JLabel lblTop = new JLabel(BUNDLE.getString("metatag.top250")); //$NON-NLS-1$
            details1Panel.add(lblTop, "16, 14, right, default");
        }
        {
            spTop250 = new JSpinner();
            details1Panel.add(spTop250, "18, 14");
        }
        spTop250.setValue(movie.getTop250());
        {
            JLabel lblIds = new JLabel("Ids");
            details1Panel.add(lblIds, "2, 16, right, bottom");
        }
        {
            JScrollPane scrollPaneIds = new JScrollPane();
            details1Panel.add(scrollPaneIds, "4, 16, 9, 5, fill, fill");
            {
                tableIds = new MediaIdTable(ids, ScraperType.MOVIE);
                scrollPaneIds.setViewportView(tableIds);
            }
        }
        {
            JButton btnAddId = new JButton("");
            btnAddId.setAction(new AddIdAction());
            btnAddId.setIcon(IconManager.LIST_ADD);
            btnAddId.setMargin(new Insets(2, 2, 2, 2));
            details1Panel.add(btnAddId, "2, 18, right, top");
        }
        {
            JButton btnRemoveId = new JButton("");
            btnRemoveId.setAction(new RemoveIdAction());
            btnRemoveId.setIcon(IconManager.LIST_REMOVE);
            btnRemoveId.setMargin(new Insets(2, 2, 2, 2));
            details1Panel.add(btnRemoveId, "2, 20, right, top");
        }
        {
            JLabel lblSpokenLanguages = new JLabel(BUNDLE.getString("metatag.spokenlanguages")); //$NON-NLS-1$
            details1Panel.add(lblSpokenLanguages, "2, 22, right, default");
        }
        {
            tfSpokenLanguages = new JTextField();
            details1Panel.add(tfSpokenLanguages, "4, 22, fill, default");
            tfSpokenLanguages.setColumns(10);
        }
        {
            JLabel lblCountry = new JLabel(BUNDLE.getString("metatag.country")); //$NON-NLS-1$
            details1Panel.add(lblCountry, "8, 22, right, default");
        }
        {
            tfCountry = new JTextField();
            details1Panel.add(tfCountry, "10, 22, 3, 1, fill, default");
            tfCountry.setColumns(10);
        }
        {
            JLabel lblMovieSet = new JLabel(BUNDLE.getString("metatag.movieset")); //$NON-NLS-1$
            details1Panel.add(lblMovieSet, "2, 24, right, default");
        }
        {
            cbMovieSet = new JComboBox();
            cbMovieSet.addItem("");
            details1Panel.add(cbMovieSet, "4, 24, 9, 1, fill, default");
        }
        {
            JLabel lblDateAdded = new JLabel(BUNDLE.getString("metatag.dateadded")); //$NON-NLS-1$
            details1Panel.add(lblDateAdded, "2, 26, right, default");
        }
        {
            spDateAdded = new JSpinner(new SpinnerDateModel());
            // JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(spDateAdded,
            // "dd.MM.yyyy HH:mm:ss");
            // spDateAdded.setEditor(timeEditor);
            details1Panel.add(spDateAdded, "4, 26");
        }
        spDateAdded.setValue(movie.getDateAdded());
        JLabel lblWatched = new JLabel(BUNDLE.getString("metatag.watched")); //$NON-NLS-1$
        details1Panel.add(lblWatched, "8, 26, right, default");
        {
            cbWatched = new JCheckBox("");
            details1Panel.add(cbWatched, "10, 26");
        }
        cbWatched.setSelected(movie.isWatched());
        lblWatched.setLabelFor(cbWatched);
        {
            JLabel lblSourceT = new JLabel(BUNDLE.getString("metatag.source")); //$NON-NLS-1$
            details1Panel.add(lblSourceT, "2, 28, right, default");
        }
        {
            cbSource = new JComboBox(MediaSource.values());
            details1Panel.add(cbSource, "4, 28, fill, default");
        }
        cbSource.setSelectedItem(movie.getMediaSource());
        {
            final JLabel lblEditionT = new JLabel(BUNDLE.getString("metatag.edition")); //$NON-NLS-1$
            details1Panel.add(lblEditionT, "8, 28, right, default");
        }
        {
            cbEdition = new JComboBox(MovieEdition.values());
            details1Panel.add(cbEdition, "10, 28, 3, 1, fill, default");
        }
        {
            JLabel lblVideod = new JLabel(BUNDLE.getString("metatag.3d")); //$NON-NLS-1$
            details1Panel.add(lblVideod, "16, 28, right, default");
        }
        {
            chckbxVideo3D = new JCheckBox("");
            details1Panel.add(chckbxVideo3D, "18, 28");
        }
        chckbxVideo3D.setSelected(movie.isVideoIn3D());
        {
            JLabel lblPlot = new JLabel(BUNDLE.getString("metatag.plot")); //$NON-NLS-1$
            details1Panel.add(lblPlot, "2, 30, right, top");
        }
        {
            JScrollPane scrollPanePlot = new JScrollPane();
            details1Panel.add(scrollPanePlot, "4, 30, 15, 1, fill, fill");
            {
                tpPlot = new JTextPane();
                scrollPanePlot.setViewportView(tpPlot);
            }
        }
        {
            lblFanart = new ImageLabel();
            lblFanart.setAlternativeText(BUNDLE.getString("image.notfound.fanart")); //$NON-NLS-1$
            lblFanart.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            lblFanart.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(), ImageType.FANART,
                            movieList.getDefaultArtworkScrapers(), lblFanart, extrathumbs, extrafanarts,
                            MediaType.MOVIE);
                    dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                    dialog.setVisible(true);
                }
            });
            details1Panel.add(lblFanart, "22, 30, 3, 5, fill, fill");
        }
        lblFanart.setImagePath(movie.getArtworkFilename(MediaFileType.FANART));
        {
            JLabel lblDirector = new JLabel(BUNDLE.getString("metatag.director")); //$NON-NLS-1$
            details1Panel.add(lblDirector, "2, 32, right, default");
        }
        {
            tfDirector = new JTextField();
            details1Panel.add(tfDirector, "4, 32, 15, 1, fill, top");
            tfDirector.setColumns(10);
        }
        {
            JLabel lblWriter = new JLabel(BUNDLE.getString("metatag.writer")); //$NON-NLS-1$
            details1Panel.add(lblWriter, "2, 34, right, default");
        }
        {
            tfWriter = new JTextField();
            details1Panel.add(tfWriter, "4, 34, 15, 1, fill, top");
            tfWriter.setColumns(10);
        }
        {
            JLabel lblCompany = new JLabel(BUNDLE.getString("metatag.production")); //$NON-NLS-1$
            details1Panel.add(lblCompany, "2, 36, right, top");
        }
        {
            JScrollPane scrollPaneProduction = new JScrollPane();
            details1Panel.add(scrollPaneProduction, "4, 36, 15, 1, fill, fill");
            tfProductionCompanies = new JTextPane();
            scrollPaneProduction.setViewportView(tfProductionCompanies);
        }
        tabbedPane.addTab(BUNDLE.getString("metatag.details"), details1Panel); //$NON-NLS-1$
    }

    /**
     * DetailsPanel 2
     */
    {
        tabbedPane.addTab(BUNDLE.getString("metatag.details2"), details2Panel); //$NON-NLS-1$
        details2Panel.setBorder(new EmptyBorder(5, 5, 5, 5));
        details2Panel.setLayout(new FormLayout(
                new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(40dlu;default)"),
                        FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("50px:grow"),
                        FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                        FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px: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("fill:default"),
                        FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                        FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                        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("default:grow"),
                        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("default:grow"),
                        FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                        FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow(2)"), }));
        {
            JLabel lblActors = new JLabel(BUNDLE.getString("metatag.actors")); //$NON-NLS-1$
            details2Panel.add(lblActors, "2, 2, right, default");
        }
        {
            JScrollPane scrollPane = new JScrollPane();
            details2Panel.add(scrollPane, "4, 2, 1, 11");
            tableActors = new JTable();
            tableActors.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
            scrollPane.setViewportView(tableActors);
        }
        {
            JLabel lblProducers = new JLabel(BUNDLE.getString("metatag.producers")); //$NON-NLS-1$
            details2Panel.add(lblProducers, "6, 2, right, default");
        }
        {
            JScrollPane scrollPane = new JScrollPane();
            details2Panel.add(scrollPane, "8, 2, 1, 11");
            tableProducers = new JTable();
            tableProducers.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
            scrollPane.setViewportView(tableProducers);
        }
        {
            JButton btnAddActor = new JButton(BUNDLE.getString("cast.actor.add")); //$NON-NLS-1$
            btnAddActor.setMargin(new Insets(2, 2, 2, 2));
            btnAddActor.setAction(new AddActorAction());
            btnAddActor.setIcon(IconManager.LIST_ADD);
            details2Panel.add(btnAddActor, "2, 4, right, top");
        }
        {
            JButton btnAddProducer = new JButton((String) null);
            btnAddProducer.setMargin(new Insets(2, 2, 2, 2));
            btnAddProducer.setAction(new AddProducerAction());
            btnAddProducer.setIcon(IconManager.LIST_ADD);
            details2Panel.add(btnAddProducer, "6, 4, right, top");
        }
        {
            JButton btnRemoveActor = new JButton(BUNDLE.getString("cast.actor.remove")); //$NON-NLS-1$
            btnRemoveActor.setMargin(new Insets(2, 2, 2, 2));
            btnRemoveActor.setAction(new RemoveActorAction());
            btnRemoveActor.setIcon(IconManager.LIST_REMOVE);
            details2Panel.add(btnRemoveActor, "2,6, right, top");
        }
        {
            JButton btnRemoveProducer = new JButton((String) null);
            btnRemoveProducer.setMargin(new Insets(2, 2, 2, 2));
            btnRemoveProducer.setAction(new RemoveProducerAction());
            btnRemoveProducer.setIcon(IconManager.LIST_REMOVE);
            details2Panel.add(btnRemoveProducer, "6, 6, right, top");
        }
        {
            JButton btnMoveActorUp = new JButton((String) null);
            btnMoveActorUp.setMargin(new Insets(2, 2, 2, 2));
            btnMoveActorUp.setAction(new MoveActorUpAction());
            btnMoveActorUp.setIcon(IconManager.ARROW_UP);
            details2Panel.add(btnMoveActorUp, "2, 8, right, top");
        }
        {
            JButton btnMoveProducerUp = new JButton((String) null);
            btnMoveProducerUp.setMargin(new Insets(2, 2, 2, 2));
            btnMoveProducerUp.setAction(new MoveProducerUpAction());
            btnMoveProducerUp.setIcon(IconManager.ARROW_UP);
            details2Panel.add(btnMoveProducerUp, "6, 8, right, top");
        }
        {
            JButton btnMoveActorDown = new JButton((String) null);
            btnMoveActorDown.setMargin(new Insets(2, 2, 2, 2));
            btnMoveActorDown.setAction(new MoveActorDownAction());
            btnMoveActorDown.setIcon(IconManager.ARROW_DOWN);
            details2Panel.add(btnMoveActorDown, "2, 10, right, top");
        }
        {
            JButton btnMoveProducerDown = new JButton((String) null);
            btnMoveProducerDown.setMargin(new Insets(2, 2, 2, 2));
            btnMoveProducerDown.setAction(new MoveProducerDownAction());
            btnMoveProducerDown.setIcon(IconManager.ARROW_DOWN);
            details2Panel.add(btnMoveProducerDown, "6, 10, right, top");
        }
        {
            JLabel lblGenres = new JLabel(BUNDLE.getString("metatag.genre")); //$NON-NLS-1$
            details2Panel.add(lblGenres, "2, 14, right, default");
        }
        {
            JScrollPane scrollPaneGenres = new JScrollPane();
            details2Panel.add(scrollPaneGenres, "4, 14, 1, 5");
            {
                listGenres = new JList();
                scrollPaneGenres.setViewportView(listGenres);
            }
        }
        {
            JLabel lblTags = new JLabel(BUNDLE.getString("metatag.tags")); //$NON-NLS-1$
            details2Panel.add(lblTags, "6, 14, right, default");
        }
        {
            JScrollPane scrollPaneTags = new JScrollPane();
            details2Panel.add(scrollPaneTags, "8, 14, 1, 5");
            listTags = new JList();
            scrollPaneTags.setViewportView(listTags);
        }
        {
            JButton btnAddGenre = new JButton("");
            btnAddGenre.setAction(new AddGenreAction());
            btnAddGenre.setIcon(IconManager.LIST_ADD);
            btnAddGenre.setMargin(new Insets(2, 2, 2, 2));
            details2Panel.add(btnAddGenre, "2, 16, right, top");
        }
        {
            JButton btnAddTag = new JButton("");
            btnAddTag.setAction(new AddTagAction());
            btnAddTag.setIcon(IconManager.LIST_ADD);
            btnAddTag.setMargin(new Insets(2, 2, 2, 2));
            details2Panel.add(btnAddTag, "6, 16, right, top");
        }

        {
            JButton btnRemoveGenre = new JButton("");
            btnRemoveGenre.setAction(new RemoveGenreAction());
            btnRemoveGenre.setMargin(new Insets(2, 2, 2, 2));
            btnRemoveGenre.setIcon(IconManager.LIST_REMOVE);
            details2Panel.add(btnRemoveGenre, "2, 18, right, top");
        }
        {
            JButton btnRemoveTag = new JButton("");
            btnRemoveTag.setAction(new RemoveTagAction());
            btnRemoveTag.setIcon(IconManager.LIST_REMOVE);
            btnRemoveTag.setMargin(new Insets(2, 2, 2, 2));
            details2Panel.add(btnRemoveTag, "6, 18, right, top");
        }
        {
            cbGenres = new AutocompleteComboBox(MediaGenres.values());
            details2Panel.add(cbGenres, "4, 20");
        }
        {
            cbTags = new AutocompleteComboBox(movieList.getTagsInMovies());
            details2Panel.add(cbTags, "8, 20");
        }

        {
            JLabel lblTrailer = new JLabel(BUNDLE.getString("metatag.trailer")); //$NON-NLS-1$
            details2Panel.add(lblTrailer, "2, 22, right, default");
        }
        {
            JScrollPane scrollPaneTrailer = new JScrollPane();
            details2Panel.add(scrollPaneTrailer, "4, 22, 5, 5");
            tableTrailer = new JTable();
            tableTrailer.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
            scrollPaneTrailer.setViewportView(tableTrailer);
        }
        {
            JButton btnAddTrailer = new JButton("");
            btnAddTrailer.setAction(new AddTrailerAction());
            btnAddTrailer.setIcon(IconManager.LIST_ADD);
            btnAddTrailer.setMargin(new Insets(2, 2, 2, 2));
            details2Panel.add(btnAddTrailer, "2, 24, right, top");
        }
        {
            JButton btnRemoveTrailer = new JButton("");
            btnRemoveTrailer.setAction(new RemoveTrailerAction());
            btnRemoveTrailer.setIcon(IconManager.LIST_REMOVE);
            btnRemoveTrailer.setMargin(new Insets(2, 2, 2, 2));
            details2Panel.add(btnRemoveTrailer, "2, 26, right, top");
        }
    }

    /**
     * extra artwork pane
     */
    {
        JPanel artworkPanel = new JPanel();
        tabbedPane.addTab(BUNDLE.getString("metatag.extraartwork"), null, artworkPanel, null); //$NON-NLS-1$
        artworkPanel.setLayout(new FormLayout(
                new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"),
                        FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"),
                        FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("150px:grow"),
                        FormSpecs.RELATED_GAP_COLSPEC, },
                new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                        FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("50px:grow(2)"),
                        FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                        RowSpec.decode("50px:grow(2)"), FormSpecs.RELATED_GAP_ROWSPEC,
                        FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                        RowSpec.decode("200px:grow(2)"), FormSpecs.RELATED_GAP_ROWSPEC,
                        RowSpec.decode("default:grow"), }));
        {
            JLabel lblLogoT = new JLabel(BUNDLE.getString("mediafiletype.logo")); //$NON-NLS-1$
            artworkPanel.add(lblLogoT, "2, 2");
        }
        {
            lblLogo = new ImageLabel();
            lblLogo.setAlternativeText(BUNDLE.getString("image.notfound.logo")); //$NON-NLS-1$
            lblLogo.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(), ImageType.LOGO,
                            movieList.getDefaultArtworkScrapers(), lblLogo, null, null, MediaType.MOVIE);
                    dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                    dialog.setVisible(true);
                }
            });
            lblLogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            artworkPanel.add(lblLogo, "2, 4, fill, fill");
        }
        {
            final JLabel lblClearlogoT = new JLabel(BUNDLE.getString("mediafiletype.clearlogo")); //$NON-NLS-1$
            artworkPanel.add(lblClearlogoT, "4, 2");
        }
        {
            lblClearlogo = new ImageLabel();
            lblClearlogo.setAlternativeText(BUNDLE.getString("image.notfound.clearlogo")); //$NON-NLS-1$
            lblClearlogo.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(),
                            ImageType.CLEARLOGO, movieList.getDefaultArtworkScrapers(), lblClearlogo, null,
                            null, MediaType.MOVIE);
                    dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                    dialog.setVisible(true);
                }
            });
            lblClearlogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            artworkPanel.add(lblClearlogo, "4, 4, fill, fill");
        }
        {
            JLabel lblBannerT = new JLabel(BUNDLE.getString("mediafiletype.banner")); //$NON-NLS-1$
            artworkPanel.add(lblBannerT, "2, 6");
        }
        {
            lblBanner = new ImageLabel();
            lblBanner.setAlternativeText(BUNDLE.getString("image.notfound.banner")); //$NON-NLS-1$
            lblBanner.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(), ImageType.BANNER,
                            movieList.getDefaultArtworkScrapers(), lblBanner, null, null, MediaType.MOVIE);
                    dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                    dialog.setVisible(true);
                }
            });
            lblBanner.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            artworkPanel.add(lblBanner, "2, 8, 3, 1, fill, fill");
        }

        {
            JLabel lblClearartT = new JLabel("ClearArt");
            artworkPanel.add(lblClearartT, "2, 10");
        }
        {
            lblClearart = new ImageLabel();
            lblClearart.setAlternativeText(BUNDLE.getString("image.notfound.clearart")); //$NON-NLS-1$
            lblClearart.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(), ImageType.CLEARART,
                            movieList.getDefaultArtworkScrapers(), lblClearart, null, null, MediaType.MOVIE);
                    dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                    dialog.setVisible(true);
                }
            });
            lblClearart.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            artworkPanel.add(lblClearart, "2, 12, fill, fill");
        }
        {
            JLabel lblThumbT = new JLabel("Thumb");
            artworkPanel.add(lblThumbT, "4, 10");
        }
        {
            lblThumb = new ImageLabel();
            lblThumb.setAlternativeText(BUNDLE.getString("image.notfound.thumb")); //$NON-NLS-1$
            lblThumb.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(), ImageType.THUMB,
                            movieList.getDefaultArtworkScrapers(), lblThumb, null, null, MediaType.MOVIE);
                    dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                    dialog.setVisible(true);
                }
            });
            lblThumb.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            artworkPanel.add(lblThumb, "4, 12, fill, fill");
        }
        {
            JLabel lblDiscT = new JLabel("Disc");
            artworkPanel.add(lblDiscT, "6, 10");
        }
        {
            lblDisc = new ImageLabel();
            lblDisc.setAlternativeText(BUNDLE.getString("image.notfound.disc")); //$NON-NLS-1$
            lblDisc.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(), ImageType.DISC,
                            movieList.getDefaultArtworkScrapers(), lblDisc, null, null, MediaType.MOVIE);
                    dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                    dialog.setVisible(true);
                }
            });
            lblDisc.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            artworkPanel.add(lblDisc, "6, 12, fill, fill");
        }
    }

    /**
     * Media Files
     */
    {
        mediaFilesPanel = new MediaFileEditorPanel(mediaFiles);
        tabbedPane.addTab(BUNDLE.getString("metatag.mediafiles"), null, mediaFilesPanel, null); //$NON-NLS-1$
    }

    /**
     * Button pane
     */
    {
        JPanel bottomPane = new JPanel();
        getContentPane().add(bottomPane, BorderLayout.SOUTH);
        bottomPane.setLayout(new FormLayout(
                new ColumnSpec[] { ColumnSpec.decode("371px:grow"), FormFactory.DEFAULT_COLSPEC,
                        FormFactory.RELATED_GAP_COLSPEC, },
                new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                        FormFactory.LINE_GAP_ROWSPEC, }));

        JPanel buttonPane = new JPanel();
        bottomPane.add(buttonPane, "2, 2, left, top");
        EqualsLayout layout = new EqualsLayout(5);
        layout.setMinWidth(100);
        buttonPane.setLayout(layout);
        {
            JButton okButton = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$
            buttonPane.add(okButton, "2, 1, fill, top");
            okButton.setAction(new ChangeMovieAction());
            okButton.setActionCommand("OK");
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$
            buttonPane.add(cancelButton, "4, 1, fill, top");
            cancelButton.setAction(new DiscardAction());
            cancelButton.setActionCommand("Cancel");
        }
        if (inQueue) {
            JButton btnAbort = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$
            btnAbort.setAction(new AbortQueueAction());
            buttonPane.add(btnAbort, "6, 1, fill, top");
        }

    }
    initDataBindings();

    {
        int year = 0;
        try {
            year = Integer.parseInt(movieToEdit.getYear());
        } catch (Exception ignored) {
        }

        SimpleDateFormat dateFormat = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.MEDIUM);

        for (Certification cert : Certification
                .getCertificationsforCountry(MovieModuleManager.MOVIE_SETTINGS.getCertificationCountry())) {
            cbCertification.addItem(cert);
        }

        tfTitle.setText(movieToEdit.getTitle());
        tfOriginalTitle.setText(movieToEdit.getOriginalTitle());
        tfSorttitle.setText(movieToEdit.getSortTitle());
        tpTagline.setText(movieToEdit.getTagline());
        tpPlot.setText(movieToEdit.getPlot());
        tpPlot.setCaretPosition(0);
        tfDirector.setText(movieToEdit.getDirector());
        tfWriter.setText(movieToEdit.getWriter());
        lblPoster.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.POSTER));
        tfProductionCompanies.setText(movieToEdit.getProductionCompany());
        spRuntime.setValue(movieToEdit.getRuntime());
        cbEdition.setSelectedItem(movieToEdit.getEdition());

        tfSpokenLanguages.setText(movieToEdit.getSpokenLanguages());
        tfCountry.setText(movieToEdit.getCountry());
        spYear.setValue(year);
        cbCertification.setSelectedItem(movieToEdit.getCertification());

        lblMoviePath.setText(movieToEdit.getPath());
        lblLogo.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.LOGO));
        lblClearlogo.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.CLEARLOGO));
        lblClearart.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.CLEARART));
        lblThumb.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.THUMB));
        lblDisc.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.DISCART));
        lblBanner.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.BANNER));

        for (MovieActor origCast : movieToEdit.getActors()) {
            MovieActor actor = new MovieActor();
            actor.setName(origCast.getName());
            actor.setCharacter(origCast.getCharacter());
            actor.setThumbUrl(origCast.getThumbUrl());
            cast.add(actor);
        }

        for (MovieProducer origProducer : movieToEdit.getProducers()) {
            MovieProducer producer = new MovieProducer();
            producer.setName(origProducer.getName());
            producer.setRole(origProducer.getRole());
            producer.setThumbUrl(origProducer.getThumbUrl());
            producers.add(producer);
        }

        for (MediaGenres genre : movieToEdit.getGenres()) {
            genres.add(genre);
        }

        for (MovieTrailer trailer : movieToEdit.getTrailer()) {
            trailers.add(trailer);
        }

        for (String tag : movieToEdit.getTags()) {
            if (StringUtils.isNotBlank(tag)) {
                tags.add(tag);
            }
        }

        extrathumbs.addAll(movieToEdit.getExtraThumbs());
        extrafanarts.addAll(movieToEdit.getExtraFanarts());
        for (MovieSet movieSet : movieList.getSortedMovieSetList()) {
            cbMovieSet.addItem(movieSet);
            if (movieToEdit.getMovieSet() == movieSet) {
                cbMovieSet.setSelectedItem(movieSet);
            }
        }
    }
    // adjust columnn titles - we have to do it this way - thx to windowbuilder pro
    tableActors.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.name")); //$NON-NLS-1$
    tableActors.getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.role")); //$NON-NLS-1$
    tableProducers.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.name")); //$NON-NLS-1$
    tableProducers.getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.role")); //$NON-NLS-1$

    tableTrailer.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.nfo")); //$NON-NLS-1$
    tableTrailer.getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.name")); //$NON-NLS-1$
    tableTrailer.getColumnModel().getColumn(2).setHeaderValue(BUNDLE.getString("metatag.source")); //$NON-NLS-1$
    tableTrailer.getColumnModel().getColumn(3).setHeaderValue(BUNDLE.getString("metatag.quality")); //$NON-NLS-1$
    tableTrailer.getColumnModel().getColumn(4).setHeaderValue(BUNDLE.getString("metatag.url")); //$NON-NLS-1$

    // adjust table columns
    tableTrailer.getColumnModel().getColumn(0).setMaxWidth(55);

    // implement listener to simulate button group
    tableTrailer.getModel().addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent arg0) {
            // click on the checkbox
            if (arg0.getColumn() == 0) {
                int row = arg0.getFirstRow();
                MovieTrailer changedTrailer = trailers.get(row);
                // if flag inNFO was changed, change all other trailers flags
                if (changedTrailer.getInNfo()) {
                    for (MovieTrailer trailer : trailers) {
                        if (trailer != changedTrailer) {
                            trailer.setInNfo(Boolean.FALSE);
                        }
                    }
                }
            }
        }
    });
}

From source file:org.tinymediamanager.ui.moviesets.dialogs.MovieSetChooserDialog.java

/**
 * Instantiates a new movie set chooser panel.
 * //www .j  ava2s  .c om
 * @param movieSet
 *          the movie set
 */
public MovieSetChooserDialog(MovieSet movieSet, boolean inQueue) {
    super(BUNDLE.getString("movieset.search"), "movieSetChooser"); //$NON-NLS-1$
    setBounds(5, 5, 865, 578);

    movieSetToScrape = movieSet;

    getContentPane().setLayout(new BorderLayout(0, 0));

    JPanel panelHeader = new JPanel();
    getContentPane().add(panelHeader, BorderLayout.NORTH);
    panelHeader.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("114px:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px"), ColumnSpec.decode("2dlu"), },
            new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("25px"),
                    FormFactory.RELATED_GAP_ROWSPEC, }));
    {
        tfMovieSetName = new JTextField();
        panelHeader.add(tfMovieSetName, "2, 2, fill, fill");
        tfMovieSetName.setColumns(10);
    }
    {
        JButton btnSearch = new JButton("");
        btnSearch.setAction(actionSearch);
        panelHeader.add(btnSearch, "4, 2, fill, top");
    }
    {
        JSplitPane splitPane = new JSplitPane();
        splitPane.setContinuousLayout(true);
        splitPane.setResizeWeight(0.5);
        getContentPane().add(splitPane, BorderLayout.CENTER);
        {
            JPanel panelResults = new JPanel();
            panelResults.setLayout(new FormLayout(
                    new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("300px:grow"), },
                    new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("fill:403px:grow"), }));
            JScrollPane panelSearchResults = new JScrollPane();
            panelResults.add(panelSearchResults, "2, 2, fill, fill");
            splitPane.setLeftComponent(panelResults);
            {
                tableMovieSets = new JTable();
                panelSearchResults.setViewportView(tableMovieSets);
                tableMovieSets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                tableMovieSets.setBorder(new LineBorder(new Color(0, 0, 0)));
                ListSelectionModel rowSM = tableMovieSets.getSelectionModel();
                rowSM.addListSelectionListener(new ListSelectionListener() {
                    public void valueChanged(ListSelectionEvent e) {
                        // Ignore extra messages.
                        if (e.getValueIsAdjusting())
                            return;

                        ListSelectionModel lsm = (ListSelectionModel) e.getSource();
                        if (!lsm.isSelectionEmpty()) {
                            int selectedRow = lsm.getMinSelectionIndex();
                            selectedRow = tableMovieSets.convertRowIndexToModel(selectedRow);
                            try {
                                MovieSetChooserModel model = movieSetsFound.get(selectedRow);
                                if (model != MovieSetChooserModel.emptyResult && !model.isScraped()) {
                                    ScrapeTask task = new ScrapeTask(model);
                                    task.execute();

                                }
                            } catch (Exception ex) {
                                LOGGER.warn(ex.getMessage());
                            }
                        }
                    }
                });
            }
        }
        {
            JPanel panelSearchDetail = new JPanel();
            splitPane.setRightComponent(panelSearchDetail);
            panelSearchDetail.setLayout(new FormLayout(
                    new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:150px"),
                            FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(300px;default):grow"),
                            FormFactory.RELATED_GAP_COLSPEC, },
                    new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                            RowSpec.decode("250px"), FormFactory.PARAGRAPH_GAP_ROWSPEC,
                            RowSpec.decode("top:default:grow"), FormFactory.RELATED_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC }));
            {
                lblMovieSetName = new JTextArea("");
                lblMovieSetName.setLineWrap(true);
                lblMovieSetName.setOpaque(false);
                lblMovieSetName.setWrapStyleWord(true);
                TmmFontHelper.changeFont(lblMovieSetName, 1.166, Font.BOLD);
                panelSearchDetail.add(lblMovieSetName, "2, 1, 3, 1, fill, top");
            }
            {
                lblMovieSetPoster = new ImageLabel();
                lblMovieSetPoster.setAlternativeText(BUNDLE.getString("image.notfound.poster")); //$NON-NLS-1$
                panelSearchDetail.add(lblMovieSetPoster, "2, 3, fill, fill");
            }
            {
                JPanel panel = new JPanel();
                panelSearchDetail.add(panel, "4, 3, fill, fill");
                panel.setLayout(new FormLayout(
                        new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                                FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), },
                        new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, }));
            }
            {

                JScrollPane scrollPane = new JScrollPane();
                panelSearchDetail.add(scrollPane, "2, 5, 3, 1, fill, fill");
                {
                    tableMovies = new JTable();
                    scrollPane.setViewportView(tableMovies);
                }

            }
            {
                cbAssignMovies = new JCheckBox(BUNDLE.getString("movieset.movie.assign")); //$NON-NLS-1$
                cbAssignMovies.setSelected(true);
                panelSearchDetail.add(cbAssignMovies, "2, 7, 3, 1");
            }
        }
    }

    {
        JPanel bottomPane = new JPanel();
        getContentPane().add(bottomPane, BorderLayout.SOUTH);
        {
            bottomPane.setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("2dlu"),
                    ColumnSpec.decode("185px"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("18px:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, ColumnSpec.decode("2dlu"), },
                    new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                            FormFactory.LINE_GAP_ROWSPEC }));
            {
                progressBar = new JProgressBar();
                bottomPane.add(progressBar, "2, 2, fill, center");
            }
            {
                lblProgressAction = new JLabel("");
                bottomPane.add(lblProgressAction, "4, 2, fill, center");
            }
            {
                JPanel buttonPane = new JPanel();
                bottomPane.add(buttonPane, "6, 2, fill, fill");
                EqualsLayout layout = new EqualsLayout(5);
                buttonPane.setBorder(new EmptyBorder(4, 4, 4, 4));
                layout.setMinWidth(100);
                buttonPane.setLayout(layout);

                btnOk = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$
                btnOk.setActionCommand("Save");
                btnOk.setToolTipText(BUNDLE.getString("Button.ok")); //$NON-NLS-1$
                btnOk.setIcon(IconManager.APPLY);
                btnOk.addActionListener(this);
                buttonPane.add(btnOk);

                JButton btnCancel = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$
                btnCancel.setActionCommand("Cancel");
                btnCancel.setToolTipText(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$
                btnCancel.setIcon(IconManager.CANCEL);
                btnCancel.addActionListener(this);
                buttonPane.add(btnCancel);

                if (inQueue) {
                    JButton btnAbort = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$
                    btnAbort.setActionCommand("Abort");
                    btnAbort.setToolTipText(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$
                    btnAbort.setIcon(IconManager.PROCESS_STOP);
                    btnAbort.addActionListener(this);
                    buttonPane.add(btnAbort, "6, 1, fill, top");
                }
            }
        }
    }
    initDataBindings();

    // adjust table columns
    tableMovies.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    tableMovies.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);

    tableMovieSets.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("chooser.searchresult"));
    tfMovieSetName.setText(movieSet.getTitle());
    searchMovie();

}