Example usage for javax.swing JSplitPane setContinuousLayout

List of usage examples for javax.swing JSplitPane setContinuousLayout

Introduction

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

Prototype

@BeanProperty(description = "Whether the child components are continuously redisplayed and laid out during user intervention.")
public void setContinuousLayout(boolean newContinuousLayout) 

Source Link

Document

Sets the value of the continuousLayout property, which must be true for the child components to be continuously redisplayed and laid out during user intervention.

Usage

From source file:org.sintef.thingml.ThingMLFrame.java

public ThingMLFrame(String args[]) {
    int i = 0;/*  w  w  w  .  j  a  va 2  s  .  c  o m*/
    for (String s : args) {
        if (i > 0) {
            argsFlat += "=";
        }
        argsFlat += s;
    }

    if (argsFlat.contains("-open=")) {
        File filePath = new File(argsFlat.substring(argsFlat.indexOf("=") + 1));
        filePanel = new FilePanel(editor, this, filePath.getParentFile());

        String content = "";
        try {
            final InputStream input = new FileInputStream(filePath);
            final java.util.List<String> packLines = IOUtils.readLines(input);
            for (String line : packLines) {
                content += line + "\n";
            }
            input.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        editor.loadText(content, null);
    } else {
        filePanel = new FilePanel(editor, this, null);
    }

    setTitle("ThingML Editor");
    this.setLayout(new BorderLayout());

    filePanel.setPreferredSize(new Dimension(300, 300));
    filePanel.setSize(300, 300);

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, filePanel, editor);
    splitPane.setContinuousLayout(true);
    splitPane.setDividerSize(6);
    splitPane.setDividerLocation(200);
    splitPane.setResizeWeight(0.0);
    splitPane.setBorder(null);

    add(splitPane, BorderLayout.CENTER);
}

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

/**
 * Instantiates a new movie set chooser panel.
 * /*from  w ww .  jav a 2  s  . c  o  m*/
 * @param movieSet
 *          the movie set
 */
public MovieSetChooserDialog(MovieSet movieSet, boolean inQueue) {
    super(BUNDLE.getString("movieset.search"), "movieSetChooser"); //$NON-NLS-1$
    setBounds(5, 5, 865, 578);

    movieSetToScrape = movieSet;

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

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

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

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

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

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

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

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

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

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

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

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

}

From source file:org.tinymediamanager.ui.tvshows.TvShowPanel.java

/**
 * Instantiates a new tv show panel./*w  w w . j a  v  a 2s . co  m*/
 */
public TvShowPanel() {
    super();

    treeModel = new TvShowTreeModel(tvShowList.getTvShows());
    tvShowSeasonSelectionModel = new TvShowSeasonSelectionModel();
    tvShowEpisodeSelectionModel = new TvShowEpisodeSelectionModel();

    // build menu
    menu = new JMenu(BUNDLE.getString("tmm.tvshows")); //$NON-NLS-1$
    JFrame mainFrame = MainWindow.getFrame();
    JMenuBar menuBar = mainFrame.getJMenuBar();
    menuBar.add(menu);

    setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("850px:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), }));

    JSplitPane splitPane = new JSplitPane();
    splitPane.setContinuousLayout(true);
    add(splitPane, "2, 2, fill, fill");

    JPanel panelTvShowTree = new JPanel();
    splitPane.setLeftComponent(panelTvShowTree);
    panelTvShowTree.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                    FormFactory.UNRELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, },
            new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                    RowSpec.decode("3px:grow"), FormFactory.RELATED_GAP_ROWSPEC,
                    FormFactory.DEFAULT_ROWSPEC, }));

    textField = EnhancedTextField.createSearchTextField();
    panelTvShowTree.add(textField, "4, 1, right, bottom");
    textField.setColumns(12);
    textField.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void insertUpdate(final DocumentEvent e) {
            applyFilter();
        }

        @Override
        public void removeUpdate(final DocumentEvent e) {
            applyFilter();
        }

        @Override
        public void changedUpdate(final DocumentEvent e) {
            applyFilter();
        }

        public void applyFilter() {
            TvShowTreeModel filteredModel = (TvShowTreeModel) tree.getModel();
            if (StringUtils.isNotBlank(textField.getText())) {
                filteredModel.setFilter(SearchOptions.TEXT, textField.getText());
            } else {
                filteredModel.removeFilter(SearchOptions.TEXT);
            }

            filteredModel.filter(tree);
        }
    });

    final JToggleButton btnFilter = new JToggleButton(IconManager.FILTER);
    btnFilter.setToolTipText(BUNDLE.getString("movieextendedsearch.options")); //$NON-NLS-1$
    panelTvShowTree.add(btnFilter, "6, 1, default, bottom");

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    panelTvShowTree.add(scrollPane, "2, 3, 5, 1, fill, fill");

    JToolBar toolBar = new JToolBar();
    toolBar.setRollover(true);
    toolBar.setFloatable(false);
    toolBar.setOpaque(false);
    panelTvShowTree.add(toolBar, "2, 1");

    // toolBar.add(actionUpdateDatasources);
    final JSplitButton buttonUpdateDatasource = new JSplitButton(IconManager.REFRESH);
    // temp fix for size of the button
    buttonUpdateDatasource.setText("   ");
    buttonUpdateDatasource.setHorizontalAlignment(JButton.LEFT);
    // buttonScrape.setMargin(new Insets(2, 2, 2, 24));
    buttonUpdateDatasource.setSplitWidth(18);
    buttonUpdateDatasource.setToolTipText(BUNDLE.getString("update.datasource")); //$NON-NLS-1$
    buttonUpdateDatasource.addSplitButtonActionListener(new SplitButtonActionListener() {
        public void buttonClicked(ActionEvent e) {
            actionUpdateDatasources.actionPerformed(e);
        }

        public void splitButtonClicked(ActionEvent e) {
            // build the popupmenu on the fly
            buttonUpdateDatasource.getPopupMenu().removeAll();
            buttonUpdateDatasource.getPopupMenu().add(new JMenuItem(actionUpdateDatasources2));
            buttonUpdateDatasource.getPopupMenu().addSeparator();
            for (String ds : TvShowModuleManager.SETTINGS.getTvShowDataSource()) {
                buttonUpdateDatasource.getPopupMenu()
                        .add(new JMenuItem(new TvShowUpdateSingleDatasourceAction(ds)));
            }
            buttonUpdateDatasource.getPopupMenu().addSeparator();
            buttonUpdateDatasource.getPopupMenu().add(new JMenuItem(actionUpdateTvShow));
            buttonUpdateDatasource.getPopupMenu().pack();
        }
    });

    JPopupMenu popup = new JPopupMenu("popup");
    buttonUpdateDatasource.setPopupMenu(popup);
    toolBar.add(buttonUpdateDatasource);

    JSplitButton buttonScrape = new JSplitButton(IconManager.SEARCH);
    // temp fix for size of the button
    buttonScrape.setText("   ");
    buttonScrape.setHorizontalAlignment(JButton.LEFT);
    buttonScrape.setSplitWidth(18);
    buttonScrape.setToolTipText(BUNDLE.getString("tvshow.scrape.selected")); //$NON-NLS-1$

    // register for listener
    buttonScrape.addSplitButtonActionListener(new SplitButtonActionListener() {
        @Override
        public void buttonClicked(ActionEvent e) {
            actionScrape.actionPerformed(e);
        }

        @Override
        public void splitButtonClicked(ActionEvent e) {
        }
    });

    popup = new JPopupMenu("popup");
    JMenuItem item = new JMenuItem(actionScrape2);
    popup.add(item);
    // item = new JMenuItem(actionScrapeUnscraped);
    // popup.add(item);
    item = new JMenuItem(actionScrapeSelected);
    popup.add(item);
    item = new JMenuItem(actionScrapeNewItems);
    popup.add(item);
    buttonScrape.setPopupMenu(popup);
    toolBar.add(buttonScrape);
    toolBar.add(actionEdit);

    JButton btnMediaInformation = new JButton();
    btnMediaInformation.setAction(actionMediaInformation);
    toolBar.add(btnMediaInformation);

    // install drawing of full with
    tree = new ZebraJTree(treeModel) {
        private static final long serialVersionUID = 2422163883324014637L;

        @Override
        public void paintComponent(Graphics g) {
            width = this.getWidth();
            super.paintComponent(g);
        }
    };
    tvShowSelectionModel = new TvShowSelectionModel(tree);

    TreeUI ui = new TreeUI() {
        @Override
        protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds,
                TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) {
            bounds.width = width - bounds.x;
            super.paintRow(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf);
        }
    };
    tree.setUI(ui);

    tree.setRootVisible(false);
    tree.setShowsRootHandles(true);
    tree.setCellRenderer(new TvShowTreeCellRenderer());
    tree.setRowHeight(0);
    scrollPane.setViewportView(tree);

    JPanel panelHeader = new JPanel() {
        private static final long serialVersionUID = -6914183798172482157L;

        @Override
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            JTattooUtilities.fillHorGradient(g, AbstractLookAndFeel.getTheme().getColHeaderColors(), 0, 0,
                    getWidth(), getHeight());
        }
    };
    scrollPane.setColumnHeaderView(panelHeader);
    panelHeader.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("center:20px"),
                    ColumnSpec.decode("center:20px"), ColumnSpec.decode("center:20px") },
            new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, }));

    JLabel lblTvShowsColumn = new JLabel(BUNDLE.getString("metatag.tvshow")); //$NON-NLS-1$
    lblTvShowsColumn.setHorizontalAlignment(JLabel.CENTER);
    panelHeader.add(lblTvShowsColumn, "2, 1");

    JLabel lblNfoColumn = new JLabel("");
    lblNfoColumn.setHorizontalAlignment(JLabel.CENTER);
    lblNfoColumn.setIcon(IconManager.INFO);
    lblNfoColumn.setToolTipText(BUNDLE.getString("metatag.nfo"));//$NON-NLS-1$
    panelHeader.add(lblNfoColumn, "4, 1");

    JLabel lblImageColumn = new JLabel("");
    lblImageColumn.setHorizontalAlignment(JLabel.CENTER);
    lblImageColumn.setIcon(IconManager.IMAGE);
    lblImageColumn.setToolTipText(BUNDLE.getString("metatag.images"));//$NON-NLS-1$
    panelHeader.add(lblImageColumn, "5, 1");

    JLabel lblSubtitleColumn = new JLabel("");
    lblSubtitleColumn.setHorizontalAlignment(JLabel.CENTER);
    lblSubtitleColumn.setIcon(IconManager.SUBTITLE);
    lblSubtitleColumn.setToolTipText(BUNDLE.getString("metatag.subtitles"));//$NON-NLS-1$
    panelHeader.add(lblSubtitleColumn, "6, 1");

    JPanel panel = new JPanel();
    panelTvShowTree.add(panel, "2, 5, 3, 1, fill, fill");
    panel.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC,
                    FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                    FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                    FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, },
            new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, }));

    JLabel lblTvShowsT = new JLabel(BUNDLE.getString("metatag.tvshows") + ":"); //$NON-NLS-1$
    panel.add(lblTvShowsT, "1, 2, fill, fill");

    lblTvShows = new JLabel("");
    panel.add(lblTvShows, "3, 2");

    JLabel labelSlash = new JLabel("/");
    panel.add(labelSlash, "5, 2");

    JLabel lblEpisodesT = new JLabel(BUNDLE.getString("metatag.episodes") + ":"); //$NON-NLS-1$
    panel.add(lblEpisodesT, "7, 2");

    lblEpisodes = new JLabel("");
    panel.add(lblEpisodes, "9, 2");

    JLayeredPane layeredPaneRight = new JLayeredPane();
    layeredPaneRight.setLayout(
            new FormLayout(new ColumnSpec[] { ColumnSpec.decode("default"), ColumnSpec.decode("default:grow") },
                    new RowSpec[] { RowSpec.decode("default"), RowSpec.decode("default:grow") }));
    panelRight = new JPanel();
    layeredPaneRight.add(panelRight, "1, 1, 2, 2, fill, fill");
    layeredPaneRight.setLayer(panelRight, 0);

    // glass pane
    final TvShowExtendedSearchPanel panelExtendedSearch = new TvShowExtendedSearchPanel(treeModel, tree);
    panelExtendedSearch.setVisible(false);
    // panelMovieList.add(panelExtendedSearch, "2, 5, 2, 1, fill, fill");
    btnFilter.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (panelExtendedSearch.isVisible() == true) {
                panelExtendedSearch.setVisible(false);
            } else {
                panelExtendedSearch.setVisible(true);
            }
        }
    });
    // add a propertychangelistener which reacts on setting a filter
    tree.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if ("filterChanged".equals(evt.getPropertyName())) {
                if (Boolean.TRUE.equals(evt.getNewValue())) {
                    btnFilter.setIcon(IconManager.FILTER_ACTIVE);
                    btnFilter.setToolTipText(BUNDLE.getString("movieextendedsearch.options.active")); //$NON-NLS-1$
                } else {
                    btnFilter.setIcon(IconManager.FILTER);
                    btnFilter.setToolTipText(BUNDLE.getString("movieextendedsearch.options")); //$NON-NLS-1$
                }
            }
        }
    });
    layeredPaneRight.add(panelExtendedSearch, "1, 1, fill, fill");
    layeredPaneRight.setLayer(panelExtendedSearch, 1);

    splitPane.setRightComponent(layeredPaneRight);
    panelRight.setLayout(new CardLayout(0, 0));

    JPanel panelTvShow = new TvShowInformationPanel(tvShowSelectionModel);
    panelRight.add(panelTvShow, "tvShow");

    JPanel panelTvShowSeason = new TvShowSeasonInformationPanel(tvShowSeasonSelectionModel);
    panelRight.add(panelTvShowSeason, "tvShowSeason");

    JPanel panelTvShowEpisode = new TvShowEpisodeInformationPanel(tvShowEpisodeSelectionModel);
    panelRight.add(panelTvShowEpisode, "tvShowEpisode");

    tree.addTreeSelectionListener(new TreeSelectionListener() {
        @Override
        public void valueChanged(TreeSelectionEvent e) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
            if (node != null) {
                // click on a tv show
                if (node.getUserObject() instanceof TvShow) {
                    TvShow tvShow = (TvShow) node.getUserObject();
                    tvShowSelectionModel.setSelectedTvShow(tvShow);
                    CardLayout cl = (CardLayout) (panelRight.getLayout());
                    cl.show(panelRight, "tvShow");
                }

                // click on a season
                if (node.getUserObject() instanceof TvShowSeason) {
                    TvShowSeason tvShowSeason = (TvShowSeason) node.getUserObject();
                    tvShowSeasonSelectionModel.setSelectedTvShowSeason(tvShowSeason);
                    CardLayout cl = (CardLayout) (panelRight.getLayout());
                    cl.show(panelRight, "tvShowSeason");
                }

                // click on an episode
                if (node.getUserObject() instanceof TvShowEpisode) {
                    TvShowEpisode tvShowEpisode = (TvShowEpisode) node.getUserObject();
                    tvShowEpisodeSelectionModel.setSelectedTvShowEpisode(tvShowEpisode);
                    CardLayout cl = (CardLayout) (panelRight.getLayout());
                    cl.show(panelRight, "tvShowEpisode");
                }
            } else {
                // check if there is at least one tv show in the model
                TvShowRootTreeNode root = (TvShowRootTreeNode) tree.getModel().getRoot();
                if (root.getChildCount() == 0) {
                    // sets an inital show
                    tvShowSelectionModel.setSelectedTvShow(null);
                }
            }
        }
    });

    addComponentListener(new ComponentAdapter() {
        @Override
        public void componentHidden(ComponentEvent e) {
            menu.setVisible(false);
            super.componentHidden(e);
        }

        @Override
        public void componentShown(ComponentEvent e) {
            menu.setVisible(true);
            super.componentHidden(e);
        }
    });

    // further initializations
    init();
    initDataBindings();

    // selecting first TV show at startup
    if (tvShowList.getTvShows() != null && tvShowList.getTvShows().size() > 0) {
        DefaultMutableTreeNode firstLeaf = (DefaultMutableTreeNode) ((DefaultMutableTreeNode) tree.getModel()
                .getRoot()).getFirstChild();
        tree.setSelectionPath(new TreePath(((DefaultMutableTreeNode) firstLeaf.getParent()).getPath()));
        tree.setSelectionPath(new TreePath(firstLeaf.getPath()));
    }
}