Example usage for javax.swing SpinnerDateModel SpinnerDateModel

List of usage examples for javax.swing SpinnerDateModel SpinnerDateModel

Introduction

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

Prototype

public SpinnerDateModel() 

Source Link

Document

Constructs a SpinnerDateModel whose initial value is the current date, calendarField is equal to Calendar.DAY_OF_MONTH, and for which there are no start/end limits.

Usage

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

/**
 * Instantiates a new tv show editor dialog.
 * //ww w. j av  a 2 s.  c om
 * @param tvShow
 *          the tv show
 * @param inQueue
 *          the in queue
 */
public TvShowEditorDialog(TvShow tvShow, boolean inQueue) {
    super(BUNDLE.getString("tvshow.edit"), "tvShowEditor"); //$NON-NLS-1$
    setBounds(5, 5, 950, 700);

    tvShowToEdit = tvShow;
    ids = MediaIdTable.convertIdMapToEventList(tvShowToEdit.getIds());

    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 lblTvShowPathT = new JLabel(BUNDLE.getString("metatag.path")); //$NON-NLS-1$
        panelPath.add(lblTvShowPathT, "2, 2, left, top");

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

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.NORTH);
    tabbedPane.addTab(BUNDLE.getString("metatag.details"), details1Panel); //$NON-NLS-1$
    getContentPane().add(tabbedPane, BorderLayout.CENTER);

    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, ColumnSpec.decode("default:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("50px:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                    FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("50px:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                    ColumnSpec.decode("30dlu"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                    FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                    ColumnSpec.decode("250px:grow"), FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("15dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC,
                    RowSpec.decode("top:max(30dlu;default)"), FormSpecs.RELATED_GAP_ROWSPEC,
                    RowSpec.decode("20dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                    FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("fill:30px:grow(2)"), }));

    {
        JLabel lblTitle = new JLabel(BUNDLE.getString("metatag.title")); //$NON-NLS-1$
        details1Panel.add(lblTitle, "2, 2, right, default");
    }
    {
        tfTitle = new JTextField();
        details1Panel.add(tfTitle, "4, 2, 15, 1, fill, default");
        tfTitle.setColumns(10);
    }
    {
        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(tvShowToEdit.getIds(), ImageType.POSTER,
                        tvShowList.getAvailableArtworkScrapers(), lblPoster, null, null, MediaType.TV_SHOW);
                dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                dialog.setVisible(true);
            }
        });
        lblPoster.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        details1Panel.add(lblPoster, "22, 2, 3, 19, fill, fill");
    }
    {
        JLabel lblSortTitle = new JLabel(BUNDLE.getString("metatag.sorttitle")); //$NON-NLS-1$
        details1Panel.add(lblSortTitle, "2, 4, right, default");
    }
    {
        tfSorttitle = new JTextField();
        details1Panel.add(tfSorttitle, "4, 4, 15, 1, fill, default");
        tfSorttitle.setColumns(10);
    }
    {
        JLabel lblYear = new JLabel(BUNDLE.getString("metatag.year")); //$NON-NLS-1$
        details1Panel.add(lblYear, "2, 6, right, default");
    }
    {
        spYear = new YearSpinner();
        details1Panel.add(spYear, "4, 6, fill, top");
    }
    {
        JLabel lblpremiered = new JLabel(BUNDLE.getString("metatag.premiered")); //$NON-NLS-1$
        details1Panel.add(lblpremiered, "8, 6, right, default");
    }
    {
        dpPremiered = new DatePicker(tvShow.getFirstAired());
        details1Panel.add(dpPremiered, "10, 6, fill, default");
    }
    {
        JLabel lblRuntime = new JLabel(BUNDLE.getString("metatag.runtime")); //$NON-NLS-1$
        details1Panel.add(lblRuntime, "14, 6, right, default");
    }
    {
        spRuntime = new JSpinner();
        details1Panel.add(spRuntime, "16, 6, fill, default");
    }
    spRuntime.setValue(tvShow.getRuntime());

    {
        JLabel lblMin = new JLabel(BUNDLE.getString("metatag.minutes")); //$NON-NLS-1$
        details1Panel.add(lblMin, "18, 6");
    }
    {
        JLabel lblRating = new JLabel(BUNDLE.getString("metatag.rating")); //$NON-NLS-1$
        details1Panel.add(lblRating, "2, 8, right, default");
    }
    {
        spRating = new JSpinner();
        details1Panel.add(spRating, "4, 8");
    }
    spRating.setModel(new SpinnerNumberModel(tvShow.getRating(), 0.0, 10.0, 0.1));
    {
        {
            JLabel lblCertification = new JLabel(BUNDLE.getString("metatag.certification")); //$NON-NLS-1$
            details1Panel.add(lblCertification, "8, 8, right, default");
        }
    }
    cbCertification = new JComboBox();
    for (Certification cert : Certification
            .getCertificationsforCountry(TvShowModuleManager.SETTINGS.getCertificationCountry())) {
        cbCertification.addItem(cert);
    }
    details1Panel.add(cbCertification, "10, 8, fill, default");
    cbCertification.setSelectedItem(tvShow.getCertification());
    {
        JLabel lblStatus = new JLabel(BUNDLE.getString("metatag.status")); //$NON-NLS-1$
        details1Panel.add(lblStatus, "14, 8, right, default");
    }
    {
        cbStatus = new JComboBox(new String[] { "", "Continuing", "Ended" });
        details1Panel.add(cbStatus, "16, 8, 3, 1, fill, default");
    }
    cbStatus.setSelectedItem(tvShow.getStatus());
    {
        JLabel lblDateAdded = new JLabel(BUNDLE.getString("metatag.dateadded")); //$NON-NLS-1$
        details1Panel.add(lblDateAdded, "2, 10, right, default");
    }
    {
        spDateAdded = new JSpinner(new SpinnerDateModel());
        details1Panel.add(spDateAdded, "4, 10");
    }

    {
        JLabel lblIds = new JLabel("Ids");
        details1Panel.add(lblIds, "2, 12, right, default");
    }
    {
        JScrollPane scrollPaneIds = new JScrollPane();
        details1Panel.add(scrollPaneIds, "4, 12, 9, 5, fill, fill");
        {
            tableIds = new MediaIdTable(ids, ScraperType.TV_SHOW);
            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, 14, right, top");
    }
    {
        JButton btnRemoveId = new JButton("RemoveId");
        btnRemoveId.setAction(new RemoveIdAction());
        btnRemoveId.setIcon(IconManager.LIST_REMOVE);
        btnRemoveId.setMargin(new Insets(2, 2, 2, 2));
        details1Panel.add(btnRemoveId, "2, 16, right, top");
    }
    {
        JLabel lblPlot = new JLabel(BUNDLE.getString("metatag.plot")); //$NON-NLS-1$
        details1Panel.add(lblPlot, "2, 18, right, top");
    }
    {
        JScrollPane scrollPanePlot = new JScrollPane();
        details1Panel.add(scrollPanePlot, "4, 18, 15, 3, fill, fill");
        {
            tpPlot = new JTextPane();
            scrollPanePlot.setViewportView(tpPlot);
        }
    }
    {
        JLabel lblStudio = new JLabel(BUNDLE.getString("metatag.studio")); //$NON-NLS-1$
        details1Panel.add(lblStudio, "2, 22, right, top");
    }
    {
        tfStudio = new JTextField();
        details1Panel.add(tfStudio, "4, 22, 15, 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("100px:grow(2)"),
                    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:30px: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, 7");
        {
            tableActors = new JTable();
            tableActors.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
            scrollPane.setViewportView(tableActors);
        }
    }
    {
        JLabel lblGenres = new JLabel(BUNDLE.getString("metatag.genre")); //$NON-NLS-1$
        details2Panel.add(lblGenres, "6, 2");
    }
    {
        JButton btnAddActor = new JButton("Add Actor");
        btnAddActor.setMargin(new Insets(2, 2, 2, 2));
        btnAddActor.setAction(new AddActorAction());
        btnAddActor.setIcon(IconManager.LIST_ADD);
        details2Panel.add(btnAddActor, "2, 4, right, top");
    }
    {
        JScrollPane scrollPaneGenres = new JScrollPane();
        details2Panel.add(scrollPaneGenres, "8, 2, 1, 5");
        {
            listGenres = new JList();
            scrollPaneGenres.setViewportView(listGenres);
        }
    }
    {
        JButton btnAddGenre = new JButton("");
        btnAddGenre.setAction(new AddGenreAction());
        btnAddGenre.setIcon(IconManager.LIST_ADD);
        btnAddGenre.setMargin(new Insets(2, 2, 2, 2));
        details2Panel.add(btnAddGenre, "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 btnRemoveGenre = new JButton("");
        btnRemoveGenre.setAction(new RemoveGenreAction());
        btnRemoveGenre.setMargin(new Insets(2, 2, 2, 2));
        btnRemoveGenre.setIcon(IconManager.LIST_REMOVE);
        details2Panel.add(btnRemoveGenre, "6, 6, right, top");
    }
    {
        cbGenres = new AutocompleteComboBox(MediaGenres.values());
        cbGenres.setEditable(true);
        details2Panel.add(cbGenres, "8,8");
    }
    {
        JLabel lblTags = new JLabel(BUNDLE.getString("metatag.tags")); //$NON-NLS-1$
        details2Panel.add(lblTags, "2, 10, right, default");
    }
    {
        JScrollPane scrollPaneTags = new JScrollPane();
        details2Panel.add(scrollPaneTags, "4, 10, 1, 5");
        listTags = new JList();
        scrollPaneTags.setViewportView(listTags);
    }
    {
        JButton btnAddTag = new JButton("");
        btnAddTag.setAction(new AddTagAction());
        btnAddTag.setIcon(IconManager.LIST_ADD);
        btnAddTag.setMargin(new Insets(2, 2, 2, 2));
        details2Panel.add(btnAddTag, "2, 12, 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, "2, 14, right, top");
    }
    {
        cbTags = new AutocompleteComboBox(tvShowList.getTagsInTvShows().toArray());
        cbTags.setEditable(true);
        details2Panel.add(cbTags, "4, 16");
    }

    /**
     * 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[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"),
                        FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"),
                        FormFactory.RELATED_GAP_COLSPEC, },
                new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                        FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("50px:grow(2)"),
                        FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                        FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("200px:grow(2)"),
                        FormFactory.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(tvShowToEdit.getIds(), ImageType.LOGO,
                            tvShowList.getAvailableArtworkScrapers(), lblLogo, null, null, MediaType.TV_SHOW);
                    dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                    dialog.setVisible(true);
                }
            });
            {
                final JLabel lblClearlogoT = new JLabel(BUNDLE.getString("mediafiletype.clearlogo")); //$NON-NLS-1$
                artworkPanel.add(lblClearlogoT, "4, 2");
            }
            lblLogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            artworkPanel.add(lblLogo, "2, 4, fill, fill");
        }
        {
            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(tvShowToEdit.getIds(),
                            ImageType.CLEARLOGO, tvShowList.getAvailableArtworkScrapers(), lblClearlogo, null,
                            null, MediaType.TV_SHOW);
                    dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                    dialog.setVisible(true);
                }
            });
            lblClearlogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            artworkPanel.add(lblClearlogo, "4, 4, fill, fill");
        }
        {
            JLabel lblClearartT = new JLabel(BUNDLE.getString("mediafiletype.clearart")); //$NON-NLS-1$
            artworkPanel.add(lblClearartT, "2, 6");
        }
        {
            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(tvShowToEdit.getIds(),
                            ImageType.CLEARART, tvShowList.getAvailableArtworkScrapers(), lblClearart, null,
                            null, MediaType.TV_SHOW);
                    dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                    dialog.setVisible(true);
                }
            });
            lblClearart.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            artworkPanel.add(lblClearart, "2, 8, fill, fill");
        }
        {
            JLabel lblThumbT = new JLabel(BUNDLE.getString("mediafiletype.thumb")); //$NON-NLS-1$
            artworkPanel.add(lblThumbT, "4, 6");
        }
        {
            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(tvShowToEdit.getIds(), ImageType.THUMB,
                            tvShowList.getAvailableArtworkScrapers(), lblThumb, null, null, MediaType.TV_SHOW);
                    dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                    dialog.setVisible(true);
                }
            });
            lblThumb.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            artworkPanel.add(lblThumb, "4, 8, fill, fill");
        }

    }
    tabbedPane.addTab(BUNDLE.getString("metatag.episodes"), episodesPanel); //$NON-NLS-1$
    episodesPanel.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                    FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), }));
    {
        JButton btnCloneEpisode = new JButton("");
        btnCloneEpisode.setAction(new CloneEpisodeAction());
        episodesPanel.add(btnCloneEpisode, "2, 2");
    }
    {
        JScrollPane scrollPaneEpisodes = new JScrollPane();
        episodesPanel.add(scrollPaneEpisodes, "4, 2, 1, 3, fill, fill");
        {
            tableEpisodes = new JTable();
            scrollPaneEpisodes.setViewportView(tableEpisodes);
        }
    }
    {
        JButton btnRemoveEpisode = new JButton("");
        btnRemoveEpisode.setAction(new RemoveEpisodeAction());
        btnRemoveEpisode.setIcon(IconManager.LIST_REMOVE);
        episodesPanel.add(btnRemoveEpisode, "2, 4, default, top");
    }

    /**
     * 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, RowSpec.decode("25px"),
                        FormFactory.RELATED_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);
            okButton.setAction(new OKAction());
            okButton.setActionCommand("OK");
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$
            buttonPane.add(cancelButton);
            cancelButton.setAction(new CancelAction());
            cancelButton.setActionCommand("Cancel");
        }
        if (inQueue) {
            JButton btnAbort = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$
            btnAbort.setAction(new AbortAction());
            buttonPane.add(btnAbort);
        }

    }

    initDataBindings();

    {
        lvlTvShowPath.setText(tvShow.getPath());
        tfTitle.setText(tvShow.getTitle());
        tfSorttitle.setText(tvShow.getSortTitle());
        tpPlot.setText(tvShow.getPlot());
        lblPoster.setImagePath(tvShow.getArtworkFilename(MediaFileType.POSTER));
        lblThumb.setImagePath(tvShowToEdit.getArtworkFilename(MediaFileType.THUMB));
        lblLogo.setImagePath(tvShowToEdit.getArtworkFilename(MediaFileType.LOGO));
        lblClearlogo.setImagePath(tvShowToEdit.getArtworkFilename(MediaFileType.CLEARLOGO));
        lblClearart.setImagePath(tvShowToEdit.getArtworkFilename(MediaFileType.CLEARART));
        tfStudio.setText(tvShow.getProductionCompany());

        int year = 0;
        try {
            year = Integer.parseInt(tvShow.getYear());
        } catch (Exception e) {
        }
        spYear.setValue(year);
        spDateAdded.setValue(tvShow.getDateAdded());

        for (TvShowActor origCast : tvShow.getActors()) {
            TvShowActor actor = new TvShowActor();
            actor.setName(origCast.getName());
            actor.setCharacter(origCast.getCharacter());
            actor.setThumbUrl(origCast.getThumbUrl());
            actors.add(actor);
        }

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

        // for (MediaTrailer trailer : tvShow.getTrailers()) {
        // trailers.add(trailer);
        // }

        for (String tag : tvShowToEdit.getTags()) {
            tags.add(tag);
        }

        List<TvShowEpisode> epl = new ArrayList<>(tvShowToEdit.getEpisodes());
        // custom sort per filename (just this time)
        // for unknown EPs (-1/-1) this is extremely useful to sort like on filesystem
        // and for already renamed ones, it makes no difference
        Collections.sort(epl, new Comparator<TvShowEpisode>() {
            public int compare(TvShowEpisode s1, TvShowEpisode s2) {
                return s1.getMediaFiles(MediaFileType.VIDEO).get(0).getFile()
                        .compareTo(s2.getMediaFiles(MediaFileType.VIDEO).get(0).getFile());
            }
        });

        for (TvShowEpisode episode : epl) {
            TvShowEpisodeEditorContainer container = new TvShowEpisodeEditorContainer();
            container.tvShowEpisode = episode;
            container.dvdOrder = episode.isDvdOrder();
            container.season = episode.getSeason();
            container.episode = episode.getEpisode();
            episodes.add(container);
        }

        if (((DefaultComboBoxModel) cbCertification.getModel()).getIndexOf(tvShow.getCertification()) == -1) {
            cbCertification.addItem(tvShow.getCertification());
        }

    }
    lblBanner = new ImageLabel();
    lblBanner.setAlternativeText(BUNDLE.getString("image.notfound.banner")); //$NON-NLS-1$
    lblBanner.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    lblBanner.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            ImageChooserDialog dialog = new ImageChooserDialog(tvShowToEdit.getIds(), ImageType.BANNER,
                    tvShowList.getAvailableArtworkScrapers(), lblBanner, null, null, MediaType.TV_SHOW);
            dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
            dialog.setVisible(true);
        }
    });
    details1Panel.add(lblBanner, "4, 24, 15, 3, fill, fill");
    lblBanner.setImagePath(tvShow.getArtworkFilename(MediaFileType.BANNER));
    {
        // JLabel lblFanart = new JLabel("");
        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(tvShowToEdit.getIds(), ImageType.FANART,
                        tvShowList.getAvailableArtworkScrapers(), lblFanart, null, null, MediaType.TV_SHOW);
                dialog.setLocationRelativeTo(MainWindow.getActiveInstance());
                dialog.setVisible(true);
            }
        });
        details1Panel.add(lblFanart, "22, 22, 3, 5, fill, fill");
    }
    lblFanart.setImagePath(tvShow.getArtworkFilename(MediaFileType.FANART));

    // 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$

    tableEpisodes.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.title")); //$NON-NLS-1$
    tableEpisodes.getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.filename")); //$NON-NLS-1$
    tableEpisodes.getColumnModel().getColumn(2).setHeaderValue(BUNDLE.getString("metatag.season")); //$NON-NLS-1$
    tableEpisodes.getColumnModel().getColumn(3).setHeaderValue(BUNDLE.getString("metatag.episode")); //$NON-NLS-1$
    tableEpisodes.getColumnModel().getColumn(4).setHeaderValue(BUNDLE.getString("metatag.dvdorder")); //$NON-NLS-1$
    tableEpisodes.getColumnModel().getColumn(2).setMaxWidth(150);
    tableEpisodes.getColumnModel().getColumn(3).setMaxWidth(150);
    tableEpisodes.getColumnModel().getColumn(2).setCellEditor(new TableSpinnerEditor());
    tableEpisodes.getColumnModel().getColumn(3).setCellEditor(new TableSpinnerEditor());

    // adjust table columns
    TableColumnResizer.adjustColumnPreferredWidths(tableActors, 6);
    // TableColumnResizer.adjustColumnPreferredWidths(tableTrailer, 6);
    TableColumnResizer.adjustColumnPreferredWidths(tableEpisodes, 6);
}

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

/**
 * Instantiates a new tv show episode scrape dialog.
 * /*  w w  w . j a va2 s. co  m*/
 * @param episode
 *          the episode
 * @param inQueue
 *          the in queue
 */
public TvShowEpisodeEditorDialog(TvShowEpisode episode, boolean inQueue) {
    super(BUNDLE.getString("tvshowepisode.scrape"), "tvShowEpisodeScraper"); //$NON-NLS-1$
    setBounds(5, 5, 964, 632);

    for (MediaFile mf : episode.getMediaFiles()) {
        mediaFiles.add(new MediaFile(mf));
    }

    this.episodeToEdit = episode;
    getContentPane().setLayout(new BorderLayout());

    {
        JPanel panelFilename = new JPanel();
        getContentPane().add(panelFilename, BorderLayout.NORTH);
        panelFilename.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 lblFilenameT = new JLabel(BUNDLE.getString("metatag.path")); //$NON-NLS-1$
        panelFilename.add(lblFilenameT, "2, 2, left, top");

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

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

    /**
     * DetailsPanel
     */
    {
        JPanel detailsPanel = new JPanel();
        tabbedPane.addTab(BUNDLE.getString("metatag.details"), detailsPanel); //$NON-NLS-1$
        detailsPanel.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("40dlu:grow"),
                FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("7dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC,
                FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("20dlu"),
                FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("30dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC,
                FormSpecs.DEFAULT_COLSPEC, 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("100dlu:grow"),
                FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, },
                new RowSpec[] { FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                        FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                        FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                        FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                        FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                        FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                        RowSpec.decode("35dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                        FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                        FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                        FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                        FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                        FormSpecs.RELATED_GAP_ROWSPEC, }));

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

        tfTitle = new JTextField();
        detailsPanel.add(tfTitle, "4, 4, 19, 1");
        tfTitle.setColumns(10);

        JLabel lblSeason = new JLabel(BUNDLE.getString("metatag.season")); //$NON-NLS-1$
        detailsPanel.add(lblSeason, "2, 6, right, default");

        spSeason = new JSpinner();
        detailsPanel.add(spSeason, "4, 6");

        JLabel lblEpisode = new JLabel(BUNDLE.getString("metatag.episode")); //$NON-NLS-1$
        detailsPanel.add(lblEpisode, "8, 6, right, default");

        spEpisode = new JSpinner();
        detailsPanel.add(spEpisode, "10, 6");

        JLabel lblDvdSeason = new JLabel(BUNDLE.getString("metatag.dvdseason")); //$NON-NLS-1$
        detailsPanel.add(lblDvdSeason, "2, 8, right, default");

        spDvdSeason = new JSpinner();
        detailsPanel.add(spDvdSeason, "4, 8");

        JLabel lblDvdEpisode = new JLabel(BUNDLE.getString("metatag.dvdepisode")); //$NON-NLS-1$
        detailsPanel.add(lblDvdEpisode, "8, 8, right, default");

        spDvdEpisode = new JSpinner();
        detailsPanel.add(spDvdEpisode, "10, 8");

        JLabel lblDvdOrder = new JLabel(BUNDLE.getString("metatag.dvdorder")); //$NON-NLS-1$
        detailsPanel.add(lblDvdOrder, "14, 8, right, default");

        cbDvdOrder = new JCheckBox("");
        detailsPanel.add(cbDvdOrder, "16, 8");
        cbDvdOrder.setSelected(episodeToEdit.isDvdOrder());

        JLabel lblDisplaySeason = new JLabel(BUNDLE.getString("metatag.displayseason")); //$NON-NLS-1$
        detailsPanel.add(lblDisplaySeason, "2, 10, right, default");

        spDisplaySeason = new JSpinner();
        detailsPanel.add(spDisplaySeason, "4, 10");

        JLabel lblDisplayEpisode = new JLabel(BUNDLE.getString("metatag.displayepisode")); //$NON-NLS-1$
        detailsPanel.add(lblDisplayEpisode, "8, 10, right, default");

        spDisplayEpisode = new JSpinner();
        detailsPanel.add(spDisplayEpisode, "10, 10");

        JLabel lblRating = new JLabel(BUNDLE.getString("metatag.rating")); //$NON-NLS-1$
        detailsPanel.add(lblRating, "2, 12, right, default");

        spRating = new JSpinner();
        detailsPanel.add(spRating, "4, 12");

        JLabel lblFirstAired = new JLabel(BUNDLE.getString("metatag.aired")); //$NON-NLS-1$
        detailsPanel.add(lblFirstAired, "8, 12, right, default");

        dpFirstAired = new DatePicker(episode.getFirstAired());
        detailsPanel.add(dpFirstAired, "10, 12, 3, 1, fill, default");

        JLabel lblWatched = new JLabel(BUNDLE.getString("metatag.watched")); //$NON-NLS-1$
        detailsPanel.add(lblWatched, "2, 14, right, default");

        chckbxWatched = new JCheckBox("");
        detailsPanel.add(chckbxWatched, "4, 14");

        JLabel lblDateAdded = new JLabel(BUNDLE.getString("metatag.dateadded")); //$NON-NLS-1$
        detailsPanel.add(lblDateAdded, "8, 14, right, default");

        spDateAdded = new JSpinner(new SpinnerDateModel());
        detailsPanel.add(spDateAdded, "10, 14, 3, 1, fill, default");

        JLabel lblMediasource = new JLabel(BUNDLE.getString("metatag.source")); //$NON-NLS-1$
        detailsPanel.add(lblMediasource, "2, 16, right, default");

        cbMediaSource = new JComboBox(MediaSource.values());
        detailsPanel.add(cbMediaSource, "4, 16, 4, 1, fill, default");

        JLabel lblPlot = new JLabel(BUNDLE.getString("metatag.plot")); //$NON-NLS-1$
        detailsPanel.add(lblPlot, "2, 18, right, top");

        JScrollPane scrollPane = new JScrollPane();
        detailsPanel.add(scrollPane, "4, 18, 13, 1, fill, fill");

        taPlot = new JTextArea();
        taPlot.setLineWrap(true);
        taPlot.setWrapStyleWord(true);
        scrollPane.setViewportView(taPlot);

        lblThumb = new ImageLabel();
        lblThumb.setAlternativeText(BUNDLE.getString("image.notfound.thumb")); //$NON-NLS-1$
        lblThumb.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                Path file = TmmUIHelper.selectFile(BUNDLE.getString("image.choose")); //$NON-NLS-1$
                if (file != null && Utils.isRegularFile(file)) {
                    String fileName = file.toAbsolutePath().toString();
                    lblThumb.setImageUrl("file:/" + fileName);
                }
            }
        });
        lblThumb.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        detailsPanel.add(lblThumb, "20, 6, 3, 13");

        JLabel lblDirector = new JLabel(BUNDLE.getString("metatag.director")); //$NON-NLS-1$
        detailsPanel.add(lblDirector, "2, 20, right, default");

        tfDirector = new JTextField();
        tfDirector.setText((String) null);
        tfDirector.setColumns(10);
        detailsPanel.add(tfDirector, "4, 20, 13, 1, fill, default");

        JLabel lblWriter = new JLabel(BUNDLE.getString("metatag.writer")); //$NON-NLS-1$
        detailsPanel.add(lblWriter, "2, 22, right, default");

        tfWriter = new JTextField();
        tfWriter.setText((String) null);
        tfWriter.setColumns(10);
        detailsPanel.add(tfWriter, "4, 22, 13, 1, fill, default");

        JLabel lblGuests = new JLabel(BUNDLE.getString("metatag.guests")); //$NON-NLS-1$
        detailsPanel.add(lblGuests, "2, 24, right, top");

        JScrollPane scrollPaneGuests = new JScrollPane();
        detailsPanel.add(scrollPaneGuests, "4, 24, 13, 7, fill, fill");

        tableGuests = new JTable();
        tableGuests.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
        scrollPaneGuests.setViewportView(tableGuests);

        JLabel lblTags = new JLabel(BUNDLE.getString("metatag.tags")); //$NON-NLS-1$
        detailsPanel.add(lblTags, "20, 24, default, top");

        JScrollPane scrollPaneTags = new JScrollPane();
        detailsPanel.add(scrollPaneTags, "22, 24, 1, 5, fill, fill");

        listTags = new JList();
        scrollPaneTags.setViewportView(listTags);

        JButton btnAddActor = new JButton("");
        btnAddActor.setMargin(new Insets(2, 2, 2, 2));
        btnAddActor.setAction(new AddActorAction());
        btnAddActor.setIcon(IconManager.LIST_ADD);
        detailsPanel.add(btnAddActor, "2, 26, right, top");

        JButton btnAddTag = new JButton("");
        btnAddTag.setMargin(new Insets(2, 2, 2, 2));
        btnAddTag.setAction(new AddTagAction());
        btnAddTag.setIcon(IconManager.LIST_ADD);
        detailsPanel.add(btnAddTag, "20, 26, right, top");

        JButton btnRemoveActor = new JButton("");
        btnRemoveActor.setMargin(new Insets(2, 2, 2, 2));
        btnRemoveActor.setAction(new RemoveActorAction());
        btnRemoveActor.setIcon(IconManager.LIST_REMOVE);
        detailsPanel.add(btnRemoveActor, "2, 28, right, top");

        JButton btnRemoveTag = new JButton("");
        btnRemoveTag.setMargin(new Insets(2, 2, 2, 2));
        btnRemoveTag.setAction(new RemoveTagAction());
        btnRemoveTag.setIcon(IconManager.LIST_REMOVE);
        detailsPanel.add(btnRemoveTag, "20, 28, right, top");

        cbTags = new AutocompleteComboBox(tvShowList.getTagsInEpisodes().toArray());
        cbTags.setEditable(true);
        detailsPanel.add(cbTags, "22, 30, fill, default");
    }

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

    {
        JPanel bottomPanel = new JPanel();
        getContentPane().add(bottomPanel, BorderLayout.SOUTH);

        bottomPanel.setLayout(new FormLayout(
                new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                        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.LINE_GAP_ROWSPEC, RowSpec.decode("25px"),
                        FormFactory.RELATED_GAP_ROWSPEC, }));

        cbScraper = new MediaScraperComboBox(tvShowList.getAvailableMediaScrapers());
        MediaScraper defaultScraper = tvShowList.getDefaultMediaScraper();
        cbScraper.setSelectedItem(defaultScraper);
        bottomPanel.add(cbScraper, "2, 2, fill, default");

        JButton btnScrape = new JButton(BUNDLE.getString("Button.scrape")); //$NON-NLS-1$
        btnScrape.setPreferredSize(new Dimension(100, 23));
        btnScrape.setMaximumSize(new Dimension(0, 0));
        btnScrape.setMinimumSize(new Dimension(100, 23));
        btnScrape.setActionCommand("Scrape");
        btnScrape.addActionListener(this);
        bottomPanel.add(btnScrape, "4, 2, left, fill");

        JButton btnSearch = new JButton(BUNDLE.getString("tvshowepisodechooser.search")); //$NON-NLS-1$
        btnSearch.setActionCommand("Search");
        btnSearch.addActionListener(this);
        btnSearch.setIcon(IconManager.SEARCH);
        bottomPanel.add(btnSearch, "6, 2, left, fill");
        {
            JPanel buttonPane = new JPanel();
            bottomPanel.add(buttonPane, "8, 2, fill, fill");
            EqualsLayout layout = new EqualsLayout(5);
            layout.setMinWidth(100);
            buttonPane.setLayout(layout);
            JButton okButton = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$
            okButton.setToolTipText(BUNDLE.getString("tvshow.change"));
            okButton.setIcon(IconManager.APPLY);
            buttonPane.add(okButton);
            okButton.setActionCommand("OK");
            okButton.addActionListener(this);

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

            if (inQueue) {
                JButton abortButton = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$
                abortButton.setToolTipText(BUNDLE.getString("tvshow.edit.abortqueue.desc")); //$NON-NLS-1$
                abortButton.setIcon(IconManager.PROCESS_STOP);
                buttonPane.add(abortButton);
                abortButton.setActionCommand("Abort");
                abortButton.addActionListener(this);
            }
        }
    }

    initDataBindings();

    // fill data
    {
        MediaFile mediaFile = episodeToEdit.getMediaFiles().get(0);
        lblFilename.setText(mediaFile.getFileAsPath().toString());
        tfTitle.setText(episodeToEdit.getTitle());

        spSeason.setModel(new SpinnerNumberModel(episodeToEdit.getAiredSeason(), -1, Integer.MAX_VALUE, 1));
        spEpisode.setModel(new SpinnerNumberModel(episodeToEdit.getAiredEpisode(), -1, Integer.MAX_VALUE, 1));
        spDvdSeason.setModel(new SpinnerNumberModel(episodeToEdit.getDvdSeason(), -1, Integer.MAX_VALUE, 1));
        spDvdEpisode.setModel(new SpinnerNumberModel(episodeToEdit.getDvdEpisode(), -1, Integer.MAX_VALUE, 1));
        spDisplaySeason
                .setModel(new SpinnerNumberModel(episodeToEdit.getDisplaySeason(), -1, Integer.MAX_VALUE, 1));
        spDisplayEpisode
                .setModel(new SpinnerNumberModel(episodeToEdit.getDisplayEpisode(), -1, Integer.MAX_VALUE, 1));
        spDateAdded.setValue(episodeToEdit.getDateAdded());

        lblThumb.setImagePath(episodeToEdit.getArtworkFilename(MediaFileType.THUMB));
        spRating.setModel(new SpinnerNumberModel(episodeToEdit.getRating(), 0.0, 10.0, 0.1));
        spRating.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                voteCount = 1;
            }
        });
        voteCount = episodeToEdit.getVotes();
        chckbxWatched.setSelected(episodeToEdit.isWatched());
        taPlot.setText(episodeToEdit.getPlot());
        taPlot.setCaretPosition(0);
        tfDirector.setText(episodeToEdit.getDirector());
        tfWriter.setText(episodeToEdit.getWriter());
        cbMediaSource.setSelectedItem(episodeToEdit.getMediaSource());

        for (TvShowActor origCast : episodeToEdit.getGuests()) {
            TvShowActor actor = new TvShowActor();
            actor.setName(origCast.getName());
            actor.setCharacter(origCast.getCharacter());
            actor.setThumbUrl(origCast.getThumbUrl());
            cast.add(actor);
        }

        for (String tag : episodeToEdit.getTags()) {
            tags.add(tag);
        }
    }

    // adjust table columns
    tableGuests.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.name")); //$NON-NLS-1$
    tableGuests.getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.role")); //$NON-NLS-1$

}

From source file:storybook.toolkit.swing.panel.DateChooser.java

@Override
public void initUi() {
    setLayout(new MigLayout("flowx, ins 0"));

    dateChooser = new JDateChooser();
    dateChooser.setDateFormatString(//from  ww  w.  ja v  a2  s .c om
            PrefUtil.get(SbConstants.PreferenceKey.DATEFORMAT, "MM-dd-yyyy").getStringValue());
    dateChooser.setMinimumSize(new Dimension(120, 20));

    JLabel lbTime = new JLabel(I18N.getMsgColon("msg.common.time"));

    IconButton btClearTime = new IconButton("icon.small.clear", getClearTimeAction());
    btClearTime.setSize20x20();

    timeSpinner = new JSpinner(new SpinnerDateModel());
    JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, I18N.TIME_FORMAT);
    timeSpinner.setEditor(timeEditor);
    timeSpinner.setValue(DateUtil.getZeroTimeDate());
    timeSpinner.setPreferredSize(new Dimension(80, 30));

    IconButton btFirstDate = new IconButton("icon.small.first", getFirstDateAction());
    btFirstDate.setSize20x20();

    IconButton btPrevDay = new IconButton("icon.small.previous", getPrevDayAction());
    btPrevDay.setSize20x20();

    IconButton btNextDay = new IconButton("icon.small.next", getNextDayAction());
    btNextDay.setSize20x20();

    IconButton btLastDate = new IconButton("icon.small.last", getLastDateAction());
    btLastDate.setSize20x20();

    // layout
    add(dateChooser, "gapafter 10");
    add(btFirstDate);
    add(btPrevDay);
    add(btNextDay);
    add(btLastDate);
    if (showDateTime) {
        add(lbTime, "aligny center,newline,span,split 3");
        add(timeSpinner);
        add(btClearTime);
    }
}