Example usage for javax.swing JProgressBar JProgressBar

List of usage examples for javax.swing JProgressBar JProgressBar

Introduction

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

Prototype

public JProgressBar() 

Source Link

Document

Creates a horizontal progress bar that displays a border but no progress string.

Usage

From source file:org.tellervo.desktop.tridasv2.ui.ComponentViewerOld.java

private void initComponents() {
    JLabel label;/*from  w ww  .j  a  v  a  2  s . c  om*/

    setLayout(new BorderLayout());

    // create button panel
    JPanel topPanel = new JPanel();
    label = new JLabel("View as: ");
    btnTreeView = new JRadioButton("tree");
    btnTreeView.putClientProperty("cv.cardName", TREEPANEL);
    btnTableView = new JRadioButton("table");
    btnTableView.putClientProperty("cv.cardName", TABLEPANEL);

    ActionListener btnListener = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // show the right layout panel
            String v = (String) ((AbstractButton) e.getSource()).getClientProperty("cv.cardName");
            if (v != null)
                ((CardLayout) contentPanel.getLayout()).show(contentPanel, v);
        }
    };
    btnTableView.addActionListener(btnListener);
    btnTreeView.addActionListener(btnListener);

    // connect buttons
    ButtonGroup group = new ButtonGroup();
    group.add(btnTreeView);
    group.add(btnTableView);
    topPanel.setLayout(new MigLayout("", "[64px][55px][62px][63px][][]", "[23px]"));

    // add it all to a panel
    topPanel.add(label, "cell 0 0,alignx left,aligny center");
    topPanel.add(btnTreeView, "cell 1 0,alignx left,aligny center");
    topPanel.add(btnTableView, "cell 2 0,alignx left,aligny center");

    topPanel.setBorder(BorderFactory.createEmptyBorder(2, 8, 8, 8));

    add(topPanel, BorderLayout.NORTH);

    JButton btnOrder = new JButton("Order");
    btnOrder.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {

        }

    });
    topPanel.add(btnOrder, "cell 5 0");

    // create status bar
    JPanel status = new JPanel();
    status.setLayout(new BoxLayout(status, BoxLayout.X_AXIS));
    txtStatus = new JLabel("");
    pbStatus = new JProgressBar();
    pbStatus.setVisible(false);
    status.add(txtStatus);
    status.add(Box.createHorizontalStrut(8));
    status.add(pbStatus);
    status.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));

    add(status, BorderLayout.SOUTH);

    contentPanel = new JPanel(new CardLayout());
    add(contentPanel, BorderLayout.CENTER);

    tablePanel = new JPanel(new BorderLayout());
    setupTable();
    tablePanel.add(new JScrollPane(table), BorderLayout.CENTER);

    treePanel = new JPanel(new BorderLayout());
    setupTree();
    treePanel.add(new JScrollPane(tree), BorderLayout.CENTER);

    tree2Panel = new JPanel(new BorderLayout());

    createTree();
    //setupTreeGUI();

    contentPanel.add(tablePanel, TABLEPANEL);
    contentPanel.add(treePanel, TREEPANEL);
    contentPanel.add(tree2Panel, TREE2PANEL);
}

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

/**
 * Instantiates a new image chooser dialog.
 * //  w  w w  .  ja v a 2 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.MovieSubtitleChooserDialog.java

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 w  w  w  .  j  a  v a2  s . com

    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);
    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);
            }
        }
    }
}

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

/**
 * Instantiates a new movie set chooser panel.
 * /*from w w  w  . j  a  v a 2 s  . com*/
 * @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();

}

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

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 w w  w.  j  av a 2s .  c  om
        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);
            }
        }
    }
}

From source file:org.ut.biolab.medsavant.client.ontology.OntologyWizard.java

private AbstractWizardPage getCreationPage() {

    //setup page//  w  ww.j a v  a 2  s.com
    return new DefaultWizardPage(PAGENAME_CREATE) {
        private JProgressBar progressBar;
        private JButton startButton;

        {
            addText("You are now ready to create this ontology.");

            progressBar = new JProgressBar();

            addComponent(progressBar);

            startButton = new JButton("Create Ontology");
            startButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    startButton.setEnabled(false);
                    fireButtonEvent(ButtonEvent.DISABLE_BUTTON, ButtonNames.BACK);
                    progressBar.setIndeterminate(true);
                    new MedSavantWorker<Void>("Ontologies") {
                        @Override
                        public Void doInBackground() throws Exception {
                            create();
                            return null;
                        }

                        @Override
                        protected void showProgress(double fraction) {
                        }

                        @Override
                        protected void showSuccess(Void result) {
                            ((CompletionWizardPage) getPageByTitle(PAGENAME_COMPLETE))
                                    .addText("Ontology " + name + " has been successfully created.");
                            setCurrentPage(PAGENAME_COMPLETE);
                        }

                        @Override
                        protected void showFailure(Throwable t) {
                            OntologyWizard.this.setVisible(false);
                            LOG.error("Error creating ontology.", t);
                            DialogUtils.displayException("Error",
                                    "There was an error while trying to create your ontology. ", t);
                        }
                    }.execute();
                }

            });

            addComponent(ViewUtil.alignRight(startButton));
        }

        @Override
        public void setupWizardButtons() {
            fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.FINISH);
            fireButtonEvent(ButtonEvent.SHOW_BUTTON, ButtonNames.BACK);
            fireButtonEvent(ButtonEvent.SHOW_BUTTON, ButtonNames.NEXT);
            fireButtonEvent(ButtonEvent.DISABLE_BUTTON, ButtonNames.NEXT);
        }
    };
}

From source file:org.ut.biolab.medsavant.client.region.RegionWizard.java

private AbstractWizardPage getCreationPage() {

    //setup page//w w  w .j  a va 2s . com
    return new DefaultWizardPage(PAGENAME_CREATE) {
        private JProgressBar progressBar;
        private JButton startButton;

        {
            addText("You are now ready to create this region list.");

            progressBar = new JProgressBar();

            addComponent(progressBar);

            startButton = new JButton("Create List");
            startButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    startButton.setEnabled(false);
                    fireButtonEvent(ButtonEvent.DISABLE_BUTTON, ButtonNames.BACK);
                    progressBar.setIndeterminate(true);
                    new MedSavantWorker<Void>("Region Lists") {
                        @Override
                        public Void doInBackground() throws Exception {
                            createList();
                            return null;
                        }

                        @Override
                        protected void showProgress(double fraction) {
                        }

                        @Override
                        protected void showSuccess(Void result) {
                            ((CompletionWizardPage) getPageByTitle(PAGENAME_COMPLETE))
                                    .addText("List " + listName + " has been successfully created.");
                            setCurrentPage(PAGENAME_COMPLETE);
                        }

                        @Override
                        protected void showFailure(Throwable t) {
                            RegionWizard.this.setVisible(false);
                            LOG.error("Error uploading list.", t);
                            DialogUtils.displayException("Error",
                                    "There was an error while trying to create your list. ", t);
                        }
                    }.execute();
                }
            });

            addComponent(ViewUtil.alignRight(startButton));
        }

        @Override
        public void setupWizardButtons() {
            fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.FINISH);
            fireButtonEvent(ButtonEvent.SHOW_BUTTON, ButtonNames.BACK);
            fireButtonEvent(ButtonEvent.SHOW_BUTTON, ButtonNames.NEXT);
            fireButtonEvent(ButtonEvent.DISABLE_BUTTON, ButtonNames.NEXT);
        }
    };
}

From source file:org.ut.biolab.medsavant.client.variant.ExportVCFWizard.java

private AbstractDialogPage getExportPage() {

    return new DefaultWizardPage("Export") {
        private final JLabel progressLabel;
        private final JProgressBar progress;
        private final JButton workButton;

        {/*from www  .  j a  va2  s  . c o  m*/
            progressLabel = new JLabel("Click \"Start\" to begin export.");
            addComponent(progressLabel);

            progress = new JProgressBar();
            progress.setValue(0);
            addComponent(progress);

            workButton = new JButton("Start");
            workButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {

                    fireButtonEvent(ButtonEvent.DISABLE_BUTTON, ButtonNames.BACK);
                    new MedSavantWorker<Void>("ExportVCF") {
                        @Override
                        protected Void doInBackground() throws Exception {
                            // Change text of progress label.
                            progressLabel.setText("Exporting to VCF...");
                            // Switch "Start" button to "Cancel".
                            workButton.removeActionListener(workButton.getActionListeners()[0]);
                            workButton.addActionListener(new ActionListener() {
                                @Override
                                public void actionPerformed(ActionEvent ae) {
                                    workButton.setEnabled(false);
                                    workButton.setText("Cancelling...");
                                    cancel(true);
                                }
                            });
                            workButton.setText("Cancel");

                            ExportVCF.exportVCF(variantFile, this,
                                    FilterController.getInstance().getAllFilterConditions());
                            return null;
                        }

                        @Override
                        protected void showProgress(double fraction) {
                            progress.setValue((int) Math.round(fraction * 100.0));
                        }

                        @Override
                        protected void showSuccess(Void ignored) {
                            progressLabel.setText("Export successful.");
                            workButton.setEnabled(false);
                            fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.NEXT);
                        }

                        @Override
                        protected void showFailure(Throwable ex) {
                            progress.setValue(0);
                            workButton.setEnabled(false);
                            fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.NEXT);
                            completionLabel.setText("Export was cancelled by the user.");
                            System.out.println("Exception " + ex.getClass() + ": " + ex.getMessage());
                        }
                    }.execute();
                }
            });
            addComponent(ViewUtil.alignRight(workButton));
        }

        @Override
        public void setupWizardButtons() {
            fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.FINISH);
            fireButtonEvent(ButtonEvent.DISABLE_BUTTON, ButtonNames.NEXT);
        }
    };
}

From source file:pcgen.gui2.dialog.ExportDialog.java

private ExportDialog(PCGenFrame parent) {
    super(parent, true);
    this.pcgenFrame = parent;
    this.characterBoxModel = new FacadeComboBoxModel<>(CharacterManager.getCharacters(),
            parent.getSelectedCharacterRef());
    this.characterBox = new JComboBox<>(characterBoxModel);
    this.partyBox = new JCheckBox("Entire Party");
    this.exportBox = new JComboBox<>(SheetFilter.values());
    this.fileList = new JList<>();
    this.progressBar = new JProgressBar();
    this.exportButton = new JButton("Export");
    this.closeButton = new JButton("Close");
    this.fileSearcher = new FileSearcher();
    initComponents();/*from   www .j a  v  a2  s .c  o m*/
    initLayout();
    fileSearcher.execute();

    Utility.installEscapeCloseOperation(this);
}

From source file:pcgen.gui2.dialog.PrintPreviewDialog.java

private PrintPreviewDialog(PCGenFrame frame) {
    super(frame, true);
    this.frame = frame;
    this.character = frame.getSelectedCharacterRef().get();
    this.previewPanelParent = new JPanel(new GridLayout(1, 1));
    this.sheetBox = new JComboBox<>();
    this.progressBar = new JProgressBar();
    this.pageBox = new JComboBox<>();
    this.zoomBox = new JComboBox<>();
    this.zoomInButton = new JButton();
    this.zoomOutButton = new JButton();
    this.printButton = new JButton();
    this.cancelButton = new JButton();
    initComponents();/* ww w.  ja  v  a 2s. c om*/
    initLayout();
    pack();
    new SheetLoader().execute();
}