Example usage for javax.swing JTabbedPane addTab

List of usage examples for javax.swing JTabbedPane addTab

Introduction

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

Prototype

public void addTab(String title, Component component) 

Source Link

Document

Adds a component represented by a title and no icon.

Usage

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

/**
 * Instantiates a new tv show editor dialog.
 * /* ww w.  j av  a2s .c  o  m*/
 * @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.
 * //from w ww .  j  a  v a 2  s. c  om
 * @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:org.webcat.plugintester.ui.MainFrameBuilder.java

/**
 * Creates and lays out the Swing components for the window.
 *
 * @param frame the JFrame instance that will contain the components
 *//*from w ww .  j a va  2  s  .  co  m*/
private void constructFrame(JFrame frame) {
    GridBagConstraints gridBagConstraints;

    fileChooser = new JFileChooser();
    bottomPanel = new JPanel();
    runButton = new JButton();
    mainPanel = new JPanel();
    JLabel webCatHomeLabel = new JLabel();
    webCatHomeField = new JTextField();
    webCatHomeBrowseButton = new JButton();
    JSeparator jSeparator0 = new JSeparator();
    JLabel submissionLabel = new JLabel();
    submissionField = new JTextField();
    submissionBrowseButton = new JButton();
    JSeparator jSeparator1 = new JSeparator();
    JLabel pluginsLabel = new JLabel();
    JPanel pluginsPanel = new JPanel();
    JScrollPane pluginsScrollPane = new JScrollPane();
    pluginsTable = new JTable();
    pluginAddButton = new JButton();
    pluginRemoveButton = new JButton();
    JSeparator jSeparator2 = new JSeparator();
    JTabbedPane tabPane = new JTabbedPane();
    propertiesPanel = new JPanel();
    JScrollPane propertiesScrollPane = new JScrollPane();
    propertiesEditor = new JEditorPane();
    documentationPanel = new JPanel();
    JScrollPane documentationScrollPane = new JScrollPane();
    documentationEditor = new JEditorPane();

    // File chooser
    fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

    // Bottom panel
    bottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 4));

    // Run button
    runButton.setText("Run Plug-ins");
    runButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            runButtonActionPerformed(evt);
        }
    });
    bottomPanel.add(runButton);

    frame.getContentPane().add(bottomPanel, BorderLayout.PAGE_END);

    // Main panel
    mainPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
    mainPanel.setLayout(new GridBagLayout());

    // Web-CAT Home field
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = GridBagConstraints.RELATIVE;
    gridBagConstraints.anchor = GridBagConstraints.LINE_START;
    webCatHomeLabel.setText("Web-CAT Home:");
    mainPanel.add(webCatHomeLabel, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    webCatHomeField.setTransferHandler(new WebCATHomeTransferHandler());
    mainPanel.add(webCatHomeField, gridBagConstraints);

    // Web-CAT Home browse button
    webCatHomeBrowseButton.setText("Browse...");
    webCatHomeBrowseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            webCatHomeBrowseButtonActionPerformed(evt);
        }
    });
    mainPanel.add(webCatHomeBrowseButton, new GridBagConstraints());

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(jSeparator0, gridBagConstraints);

    // Submission field
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = GridBagConstraints.RELATIVE;
    gridBagConstraints.anchor = GridBagConstraints.LINE_START;
    submissionLabel.setText("Submission:");
    mainPanel.add(submissionLabel, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    submissionField.setTransferHandler(new SubmissionTransferHandler());
    mainPanel.add(submissionField, gridBagConstraints);

    // Submission browse button
    submissionBrowseButton.setText("Browse...");
    submissionBrowseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            submissionBrowseButtonActionPerformed(evt);
        }
    });
    mainPanel.add(submissionBrowseButton, new GridBagConstraints());

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(jSeparator1, gridBagConstraints);

    // Plug-ins area
    pluginsLabel.setText("Plug-ins to run:");
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(pluginsLabel, gridBagConstraints);

    pluginsPanel.setPreferredSize(new Dimension(400, 80));
    pluginsPanel.setLayout(new GridBagLayout());

    pluginsModel = new PluginsTableModel();
    pluginsTable.setModel(pluginsModel);
    pluginsTable.setColumnSelectionAllowed(true);
    pluginsTable.getTableHeader().setReorderingAllowed(false);
    pluginsScrollPane.setViewportView(pluginsTable);
    pluginsTable.getColumnModel().getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    pluginsTable.getColumnModel().getColumn(0).setResizable(false);
    pluginsScrollPane.setTransferHandler(new PluginsTransferHandler());

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pluginsPanel.add(pluginsScrollPane, gridBagConstraints);

    pluginAddButton.setText("Add...");
    pluginAddButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            pluginAddButtonActionPerformed(evt);
        }
    });
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = GridBagConstraints.PAGE_START;
    pluginsPanel.add(pluginAddButton, gridBagConstraints);

    pluginRemoveButton.setText("Remove");

    pluginRemoveButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            pluginRemoveButtonActionPerformed(evt);
        }
    });
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = GridBagConstraints.PAGE_START;
    pluginsPanel.add(pluginRemoveButton, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 0.25;
    mainPanel.add(pluginsPanel, gridBagConstraints);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(jSeparator2, gridBagConstraints);

    tabPane.setPreferredSize(new Dimension(466, 150));

    propertiesPanel.setLayout(new GridBagLayout());

    propertiesEditor.addKeyListener(new KeyAdapter() {
        public void keyTyped(KeyEvent e) {
            propertiesTimer.restart();
        }
    });

    propertiesTimer = new Timer(1000, new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateGradingProperties();
        }
    });

    propertiesScrollPane.setViewportView(propertiesEditor);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    propertiesPanel.add(propertiesScrollPane, gridBagConstraints);

    tabPane.addTab("Properties", propertiesPanel);

    documentationPanel.setLayout(new GridBagLayout());

    documentationEditor.setContentType("text/html");
    documentationEditor.setEditable(false);
    documentationScrollPane.setViewportView(documentationEditor);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    documentationPanel.add(documentationScrollPane, gridBagConstraints);

    tabPane.addTab("Documentation", documentationPanel);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.gridheight = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weighty = 1.0;
    mainPanel.add(tabPane, gridBagConstraints);

    frame.getContentPane().add(mainPanel, BorderLayout.CENTER);

    frame.pack();
}

From source file:phex.gui.dialogs.AboutDialog.java

/**
 * /*w w  w.j  ava 2s.  c  o  m*/
 */
private void prepareComponent() {
    CloseEventHandler closeEventHandler = new CloseEventHandler();
    addWindowListener(closeEventHandler);

    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());
    JPanel contentPanel = new JPanel();
    //JPanel contentPanel = new FormDebugPanel();
    contentPane.add(contentPanel, BorderLayout.CENTER);

    CellConstraints cc = new CellConstraints();
    FormLayout layout = new FormLayout("4dlu, fill:d:grow, 4dlu", // columns
            "p, p, 2dlu, p, 4dlu, p, 4dlu"); //row
    PanelBuilder contentPB = new PanelBuilder(layout, contentPanel);

    Object[] objArr = { PrivateNetworkConstants.PRIVATE_BUILD_ID + VersionUtils.getProgramVersion(),
            VersionUtils.getBuild() };
    DialogBanner banner = new DialogBanner("Phex",
            Localizer.getFormatedString("AboutPhex_VersionInfo", objArr));
    contentPB.add(banner, cc.xywh(1, 1, 3, 1));

    contentPB.add(new JSeparator(), cc.xywh(1, 2, 3, 1));

    JTabbedPane tabbedPane = new JTabbedPane();
    contentPB.add(tabbedPane, cc.xy(2, 4));

    JButton closeBtn = new JButton(Localizer.getString("Close"));
    closeBtn.addActionListener(closeEventHandler);
    contentPB.add(ButtonBarFactory.buildCloseBar(closeBtn), cc.xy(2, 6));

    JPanel aboutPanel = new JPanel();
    layout = new FormLayout("4dlu, fill:d:grow, 4dlu", // columns
            "4dlu, p, 4dlu"); //row
    PanelBuilder aboutPB = new PanelBuilder(layout, aboutPanel);
    tabbedPane.addTab(Localizer.getString("AboutPhex_About"), aboutPanel);

    Object[] objArr2 = { Res.getStr("Program.Url") };
    HTMLMultiLinePanel aboutHtml = new HTMLMultiLinePanel(
            Localizer.getFormatedString("AboutPhex_AboutText", objArr2));
    aboutPB.add(aboutHtml, cc.xy(2, 2));

    JPanel envPanel = new JPanel();
    layout = new FormLayout("2dlu, fill:d:grow, 2dlu", // columns
            "2dlu, p, 2dlu, p, 2dlu"); //row
    PanelBuilder envPB = new PanelBuilder(layout, envPanel);
    tabbedPane.addTab(Localizer.getString("AboutPhex_Environment"), envPanel);

    environmentInfo = new JTextArea(12, 55);
    environmentInfo.setEditable(false);
    envPB.add(new JScrollPane(environmentInfo), cc.xy(2, 2));

    StringBuffer envTextBuffer = new StringBuffer();
    Properties pros = System.getProperties();
    ArrayList<String> list = new ArrayList(pros.keySet());
    Collections.sort(list);
    Iterator<String> iterator = list.iterator();
    while (iterator.hasNext()) {
        String key = iterator.next();
        String value = (String) pros.get(key);
        envTextBuffer.append(key).append(" = ").append(value).append(SystemUtils.LINE_SEPARATOR);
    }
    environmentInfo.setText(envTextBuffer.toString());
    environmentInfo.setCaretPosition(0);

    JButton copyBtn = new JButton(Localizer.getString("Copy"));
    copyBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Toolkit.getDefaultToolkit().getSystemClipboard()
                    .setContents(new StringSelection(environmentInfo.getText()), null);
        }
    });
    envPB.add(ButtonBarFactory.buildLeftAlignedBar(copyBtn), cc.xy(2, 4));

    pack();
    setLocationRelativeTo(getParent());
}

From source file:qic.ui.QicFrame.java

public QicFrame(Main main, String query) {
    super("QIC Search - Simple GUI");
    setLayout(new BorderLayout(5, 5));

    RSyntaxTextArea textArea = new RSyntaxTextArea(20, 60);
    textArea.setText("Enter a command in the textfield then press Enter..");
    textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JSON);
    textArea.setCodeFoldingEnabled(true);
    RTextScrollPane sp = new RTextScrollPane(textArea);

    JTextField searchTf = new JTextField(100);
    JButton runBtn = new JButton("Run");
    JPanel northPanel = new JPanel();
    northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.X_AXIS));
    northPanel.add(searchTf);/*from  w  w w.  j av a  2s .  c o m*/
    northPanel.add(runBtn);
    getContentPane().add(northPanel, BorderLayout.NORTH);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setSize(screenSize.width - 50, screenSize.height - 50);
    setLocationRelativeTo(null);

    searchTf.setText("search bo tmpsc ");
    if (query != null) {
        searchTf.setText(query);
    }

    JTable table = new JTable();
    table.setDefaultRenderer(List.class, new MultiLineTableCellRenderer());

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Table", new JScrollPane(table));
    tabbedPane.addTab("JSON", new JScrollPane(sp));

    BeanPropertyTableModel<SearchResultItem> model = new BeanPropertyTableModel<>(SearchResultItem.class);
    model.setOrderedProperties(asList("id", "buyout", "item", "seller", "reqs", "mods", "q", "APS", "PDPS",
            "EDPS", "DPS", "ele", "phys", "ar", "ev", "ES", "blk", "crit", "lvl"));
    table.setModel(model);
    setColumnWidths(table.getColumnModel(), asList(1, 15, 280, 230, 50, 420));

    getContentPane().add(tabbedPane, BorderLayout.CENTER);

    ActionListener runCommand = e -> {
        String tfText = searchTf.getText();

        Worker<Command> pathNotesWorker = new Worker<Command>(() -> runQuery(main, tfText), command -> {
            String json = command.toJson();
            textArea.setText(json);
            model.setData(command.itemResults);
        }, ex -> {
            String stackTrace = ExceptionUtils.getStackTrace(ex);
            textArea.setText(stackTrace);
            showError(ex);
        });
        pathNotesWorker.execute();
    };

    searchTf.addActionListener(runCommand);
    runBtn.addActionListener(runCommand);

    table.getSelectionModel().addListSelectionListener(e -> {
        if (e.getValueIsAdjusting()) {
            int selectedRow = table.getSelectedRow();
            if (selectedRow > -1) {
                SearchResultItem searchResultItem = model.getData().get(selectedRow);
                SwingUtil.copyToClipboard(searchResultItem.wtb());
            }
        }
    });

    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setVisible(true);
}

From source file:utybo.branchingstorytree.swing.editor.StoryEditor.java

public StoryEditor(BranchingStory baseStory) throws BSTException {
    setLayout(new MigLayout("hidemode 3", "[grow]", "[][grow]"));

    JToolBar toolBar = new JToolBar();
    toolBar.setBorder(null);/*from   w  w w.  j  a v a2s .c  o  m*/
    toolBar.setFloatable(false);
    add(toolBar, "cell 0 0,growx");

    JButton btnSaveAs = new JButton(Lang.get("saveas"), new ImageIcon(Icons.getImage("Save As", 16)));
    btnSaveAs.addActionListener(e -> {
        saveAs();
    });
    toolBar.add(btnSaveAs);

    JButton btnSave = new JButton(Lang.get("save"), new ImageIcon(Icons.getImage("Save", 16)));
    btnSave.addActionListener(e -> {
        save();
    });
    toolBar.add(btnSave);

    JButton btnPlay = new JButton(Lang.get("play"), new ImageIcon(Icons.getImage("Circled Play", 16)));
    btnPlay.addActionListener(ev -> {
        try {
            String s = exportToString();
            File f = Files.createTempDirectory("openbst").toFile();
            File bstFile = new File(f, "expoted.bst");
            try (FileOutputStream fos = new FileOutputStream(bstFile);) {
                IOUtils.write(s, fos, StandardCharsets.UTF_8);
            }
            OpenBSTGUI.getInstance().openStory(bstFile);
        } catch (Exception e) {
            OpenBST.LOG.error("Export failed", e);
            Messagers.showException(OpenBSTGUI.getInstance(), Lang.get("editor.exportfail"), e);
        }
    });
    toolBar.add(btnPlay);

    JButton btnFilePreview = new JButton(Lang.get("editor.exportpreview"),
            new ImageIcon(Icons.getImage("PreviewText", 16)));
    btnFilePreview.addActionListener(e -> {
        try {
            String s = exportToString();
            JDialog dialog = new JDialog(OpenBSTGUI.getInstance(), Lang.get("editor.exportpreview"));
            JTextArea jta = new JTextArea(s);
            jta.setLineWrap(true);
            jta.setWrapStyleWord(true);
            dialog.add(new JScrollPane(jta));

            dialog.setModalityType(ModalityType.APPLICATION_MODAL);
            dialog.setSize((int) (Icons.getScale() * 350), (int) (Icons.getScale() * 300));
            dialog.setLocationRelativeTo(OpenBSTGUI.getInstance());
            dialog.setVisible(true);
        } catch (Exception x) {
            OpenBST.LOG.error("Failed to preview", x);
            Messagers.showException(OpenBSTGUI.getInstance(), Lang.get("editor.previewerror"), x);
        }
    });
    toolBar.add(btnFilePreview);

    Component horizontalGlue = Box.createHorizontalGlue();
    toolBar.add(horizontalGlue);

    JButton btnClose = new JButton(Lang.get("close"), new ImageIcon(Icons.getImage("Cancel", 16)));
    btnClose.addActionListener(e -> {
        askClose();
    });
    toolBar.add(btnClose);

    for (final Component component : toolBar.getComponents()) {
        if (component instanceof JButton) {
            ((JButton) component).setHideActionText(false);
            ((JButton) component).setToolTipText(((JButton) component).getText());
            ((JButton) component).setText("");
        }
    }

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setTabPlacement(JTabbedPane.LEFT);
    add(tabbedPane, "cell 0 1,grow");

    tabbedPane.addTab("Beta Warning", new StoryEditorWelcomeScreen());

    details = new StoryDetailsEditor(this);
    tabbedPane.addTab(Lang.get("editor.details"), details);

    nodesEditor = new StoryNodesEditor();
    tabbedPane.addTab(Lang.get("editor.nodes"), nodesEditor);

    this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("control S"),
            "doSave");
    this.getActionMap().put("doSave", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            save();
        }
    });

    importFrom(baseStory);
}

From source file:zxmax.tools.timerreview.gui.StartTimerWindow.java

private void initComponents() {
    // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 450, 300);/*from  ww w.j av  a 2 s . c  o m*/

    JTabbedPane tabTimers = new JTabbedPane();

    tabTimers.addTab(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_LABEL), getPnlNewTimer());

    tabTimers.addTab(I18N.getLabel(this.getClass(), TAB_TIMER_LIST_LABEL), new JPanel());

    ChangeListener changeListener = new TabbedPaneChangeListener();

    tabTimers.addChangeListener(changeListener);

    getContentPane().add(tabTimers);

    validatorService = (ValidatorService) Register.get(ValidatorService.class);

    getBasicDao();

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent evt) {
            // do not close the application from here ...
        }

    });
}