Example usage for com.jgoodies.forms.layout CellConstraints xyw

List of usage examples for com.jgoodies.forms.layout CellConstraints xyw

Introduction

In this page you can find the example usage for com.jgoodies.forms.layout CellConstraints xyw.

Prototype

public CellConstraints xyw(int col, int row, int colSpan) 

Source Link

Document

Sets the column, row, width, and height; uses a height (row span) of 1 and the horizontal and vertical default alignments.

Examples:

 cc.xyw(1, 3, 7); cc.xyw(1, 3, 2); 

Usage

From source file:net.pms.newgui.NavigationShareTab.java

License:Open Source License

private PanelBuilder initSharedFoldersGuiComponents(CellConstraints cc) {
    // Apply the orientation for the locale
    Locale locale = new Locale(configuration.getLanguage());
    ComponentOrientation orientation = ComponentOrientation.getOrientation(locale);
    String colSpec = FormLayoutUtil.getColSpec(SHARED_FOLDER_COL_SPEC, orientation);

    FormLayout layoutFolders = new FormLayout(colSpec, SHARED_FOLDER_ROW_SPEC);
    PanelBuilder builderFolder = new PanelBuilder(layoutFolders);
    builderFolder.opaque(true);//from w w w  . j  av a2  s .  c o m

    JComponent cmp = builderFolder.addSeparator(Messages.getString("FoldTab.7"),
            FormLayoutUtil.flip(cc.xyw(1, 1, 6), colSpec, orientation));
    cmp = (JComponent) cmp.getComponent(0);
    cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

    JButton but = new JButton(LooksFrame.readImageIcon("folder_new-32.png"));
    but.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
            JFileChooser chooser = null;
            try {
                chooser = new JFileChooser();
            } catch (Exception ee) {
                chooser = new JFileChooser(new RestrictedFileSystemView());
            }
            chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            //int returnVal = chooser.showDialog((Component) e.getSource(), Messages.getString("FoldTab.9"));
            int returnVal = chooser.showOpenDialog((Component) e.getSource());
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                ((DefaultListModel) FList.getModel()).add(FList.getModel().getSize(),
                        chooser.getSelectedFile().getAbsolutePath());
                if (FList.getModel().getElementAt(0).equals(ALL_DRIVES)) {
                    ((DefaultListModel) FList.getModel()).remove(0);
                }
                updateModel();
            }
        }
    });
    builderFolder.add(but, FormLayoutUtil.flip(cc.xy(1, 3), colSpec, orientation));
    JButton but2 = new JButton(LooksFrame.readImageIcon("button_cancel-32.png"));
    //but2.setBorder(BorderFactory.createEtchedBorder());
    but2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
            if (FList.getSelectedIndex() > -1) {
                ((DefaultListModel) FList.getModel()).remove(FList.getSelectedIndex());
                if (FList.getModel().getSize() == 0) {
                    ((DefaultListModel) FList.getModel()).add(0, ALL_DRIVES);
                }
                updateModel();
            }
        }
    });
    builderFolder.add(but2, FormLayoutUtil.flip(cc.xy(2, 3), colSpec, orientation));

    JButton but3 = new JButton(LooksFrame.readImageIcon("kdevelop_down-32.png"));
    but3.setToolTipText(Messages.getString("FoldTab.12"));
    // but3.setBorder(BorderFactory.createEmptyBorder());
    but3.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            DefaultListModel model = ((DefaultListModel) FList.getModel());
            for (int i = 0; i < model.size() - 1; i++) {
                if (FList.isSelectedIndex(i)) {
                    String value = model.get(i).toString();
                    model.set(i, model.get(i + 1));
                    model.set(i + 1, value);
                    FList.setSelectedIndex(i + 1);
                    updateModel();
                    break;
                }
            }
        }
    });

    builderFolder.add(but3, FormLayoutUtil.flip(cc.xy(3, 3), colSpec, orientation));
    JButton but4 = new JButton(LooksFrame.readImageIcon("up-32.png"));
    but4.setToolTipText(Messages.getString("FoldTab.12"));
    //  but4.setBorder(BorderFactory.createEmptyBorder());
    but4.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            DefaultListModel model = ((DefaultListModel) FList.getModel());
            for (int i = 1; i < model.size(); i++) {
                if (FList.isSelectedIndex(i)) {
                    String value = model.get(i).toString();

                    model.set(i, model.get(i - 1));
                    model.set(i - 1, value);
                    FList.setSelectedIndex(i - 1);
                    updateModel();
                    break;

                }
            }
        }
    });
    builderFolder.add(but4, FormLayoutUtil.flip(cc.xy(4, 3), colSpec, orientation));

    but5 = new JButton(LooksFrame.readImageIcon("search-32.png"));
    but5.setToolTipText(Messages.getString("FoldTab.2"));
    //but5.setBorder(BorderFactory.createEmptyBorder());
    but5.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (configuration.getUseCache()) {
                DLNAMediaDatabase database = PMS.get().getDatabase();

                if (database != null) {
                    if (!database.isScanLibraryRunning()) {
                        int option = JOptionPane.showConfirmDialog((Component) PMS.get().getFrame(),
                                Messages.getString("FoldTab.3") + Messages.getString("FoldTab.4"),
                                Messages.getString("Dialog.Question"), JOptionPane.YES_NO_OPTION);
                        if (option == JOptionPane.YES_OPTION) {
                            database.scanLibrary();
                            but5.setIcon(LooksFrame.readImageIcon("viewmagfit-32.png"));
                        }
                    } else {
                        int option = JOptionPane.showConfirmDialog((Component) PMS.get().getFrame(),
                                Messages.getString("FoldTab.10"), Messages.getString("Dialog.Question"),
                                JOptionPane.YES_NO_OPTION);
                        if (option == JOptionPane.YES_OPTION) {
                            database.stopScanLibrary();
                            PMS.get().getFrame().setStatusLine(null);
                            but5.setIcon(LooksFrame.readImageIcon("search-32.png"));
                        }
                    }
                }
            }
        }
    });

    builderFolder.add(but5, FormLayoutUtil.flip(cc.xy(5, 3), colSpec, orientation));
    but5.setEnabled(configuration.getUseCache());

    df = new DefaultListModel();
    File[] folders = PMS.get().getFoldersConf();
    if (folders != null && folders.length > 0) {
        for (File file : folders) {
            df.addElement(file.getAbsolutePath());
        }
    } else {
        df.addElement(ALL_DRIVES);
    }
    FList = new JList();
    FList.setModel(df);
    JScrollPane pane = new JScrollPane(FList);
    builderFolder.add(pane, FormLayoutUtil.flip(cc.xyw(1, 5, 6), colSpec, orientation));

    return builderFolder;
}

From source file:net.pms.newgui.NetworkTab.java

License:Open Source License

public JComponent build() {
    FormLayout layout = new FormLayout("left:pref, 2dlu, p, 2dlu , p, 2dlu, p, 2dlu, pref:grow",
            "p, 0dlu, p, 0dlu, p, 3dlu, p, 3dlu, p, 3dlu,p, 3dlu, p, 15dlu, p, 3dlu,p, 3dlu, p,  3dlu, p, 3dlu, p, 3dlu, p,3dlu, p, 3dlu, p, 15dlu, p,3dlu, p, 3dlu, p, 15dlu, p, 3dlu, p");
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.DLU4_BORDER);
    builder.setOpaque(true);/*from   w ww .  j a v  a 2s . com*/

    CellConstraints cc = new CellConstraints();

    smcheckBox = new JCheckBox(Messages.getString("NetworkTab.3"));
    smcheckBox.setContentAreaFilled(false);
    smcheckBox.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            PMS.getConfiguration().setMinimized((e.getStateChange() == ItemEvent.SELECTED));
        }
    });
    if (PMS.getConfiguration().isMinimized()) {
        smcheckBox.setSelected(true);
    }

    JComponent cmp = builder.addSeparator(Messages.getString("NetworkTab.5"), cc.xyw(1, 1, 9));
    cmp = (JComponent) cmp.getComponent(0);
    cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

    builder.addLabel(Messages.getString("NetworkTab.0"), cc.xy(1, 7));
    final KeyedComboBoxModel kcbm = new KeyedComboBoxModel(
            new Object[] { "bg", "ca", "zhs", "zht", "cz", "da", "nl", "en", "fi", "fr", "de", "el", "is", "it",
                    "ja", "no", "pl", "pt", "br", "ro", "ru", "sl", "es", "sv" },
            new Object[] { "Bulgarian", "Catalan", "Chinese (Simplified)", "Chinese (Traditional)", "Czech",
                    "Danish", "Dutch", "English", "Finnish", "French", "German", "Greek", "Icelandic",
                    "Italian", "Japanese", "Norwegian", "Polish", "Portuguese", "Portuguese (Brazilian)",
                    "Romanian", "Russian", "Slovenian", "Spanish", "Swedish" });
    langs = new JComboBox(kcbm);
    langs.setEditable(false);
    //langs.setSelectedIndex(0);
    String defaultLang = null;
    if (configuration.getLanguage() != null && configuration.getLanguage().length() > 0) {
        defaultLang = configuration.getLanguage();
    } else {
        defaultLang = Locale.getDefault().getLanguage();
    }
    if (defaultLang == null) {
        defaultLang = "en";
    }
    kcbm.setSelectedKey(defaultLang);
    if (langs.getSelectedIndex() == -1) {
        langs.setSelectedIndex(0);
    }

    langs.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                configuration.setLanguage((String) kcbm.getSelectedKey());

            }
        }
    });
    builder.add(langs, cc.xyw(3, 7, 7));

    builder.add(smcheckBox, cc.xyw(1, 9, 9));

    JButton service = new JButton(Messages.getString("NetworkTab.4"));
    service.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (PMS.get().installWin32Service()) {
                JOptionPane.showMessageDialog(
                        (JFrame) (SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame())),
                        Messages.getString("NetworkTab.11") + Messages.getString("NetworkTab.12"),
                        "Information", JOptionPane.INFORMATION_MESSAGE);

            } else {
                JOptionPane.showMessageDialog(
                        (JFrame) (SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame())),
                        Messages.getString("NetworkTab.14"), "Error", JOptionPane.ERROR_MESSAGE);
            }
        }
    });
    builder.add(service, cc.xy(1, 11));
    if (System.getProperty(LooksFrame.START_SERVICE) != null || !Platform.isWindows()) {
        service.setEnabled(false);
    }

    host = new JTextField(PMS.getConfiguration().getServerHostname());
    host.addKeyListener(new KeyListener() {

        @Override
        public void keyPressed(KeyEvent e) {
        }

        @Override
        public void keyTyped(KeyEvent e) {
        }

        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setHostname(host.getText());
            PMS.get().getFrame().setReloadable(true);
        }
    });
    // host.setEnabled( StringUtils.isBlank(configuration.getNetworkInterface())) ;
    port = new JTextField(configuration.getServerPort() != 5001 ? "" + configuration.getServerPort() : "");
    port.addKeyListener(new KeyListener() {

        @Override
        public void keyPressed(KeyEvent e) {
        }

        @Override
        public void keyTyped(KeyEvent e) {
        }

        @Override
        public void keyReleased(KeyEvent e) {
            try {
                String p = port.getText();
                if (StringUtils.isEmpty(p)) {
                    p = "5001";
                }
                int ab = Integer.parseInt(p);
                configuration.setServerPort(ab);
                PMS.get().getFrame().setReloadable(true);
            } catch (NumberFormatException nfe) {
            }

        }
    });

    cmp = builder.addSeparator(Messages.getString("NetworkTab.22"), cc.xyw(1, 21, 9));
    cmp = (JComponent) cmp.getComponent(0);
    cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

    ArrayList<String> names = new ArrayList<String>();
    names.add("");
    ArrayList<String> interfaces = new ArrayList<String>();
    interfaces.add("");
    Enumeration<NetworkInterface> enm;
    try {
        enm = NetworkInterface.getNetworkInterfaces();
        while (enm.hasMoreElements()) {
            NetworkInterface ni = enm.nextElement();
            // check for interface has at least one ip address.
            if (ni.getInetAddresses().hasMoreElements()) {
                names.add(ni.getName());
                String displayName = ni.getDisplayName();
                if (displayName == null) {
                    displayName = ni.getName();
                }
                interfaces.add(displayName.trim());
            }
        }
    } catch (SocketException e1) {
        logger.error(null, e1);
    }

    final KeyedComboBoxModel networkInterfaces = new KeyedComboBoxModel(names.toArray(), interfaces.toArray());
    networkinterfacesCBX = new JComboBox(networkInterfaces);
    networkInterfaces.setSelectedKey(configuration.getNetworkInterface());
    networkinterfacesCBX.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                configuration.setNetworkInterface((String) networkInterfaces.getSelectedKey());
                //host.setEnabled( StringUtils.isBlank(configuration.getNetworkInterface())) ;
                PMS.get().getFrame().setReloadable(true);
            }
        }
    });

    ip_filter = new JTextField(PMS.getConfiguration().getIpFilter());
    ip_filter.addKeyListener(new KeyListener() {

        @Override
        public void keyPressed(KeyEvent e) {
        }

        @Override
        public void keyTyped(KeyEvent e) {
        }

        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setIpFilter(ip_filter.getText());
            PMS.get().getFrame().setReloadable(true);
        }
    });

    builder.addLabel(Messages.getString("NetworkTab.20"), cc.xy(1, 23));
    builder.add(networkinterfacesCBX, cc.xyw(3, 23, 7));
    builder.addLabel(Messages.getString("NetworkTab.23"), cc.xy(1, 25));
    builder.add(host, cc.xyw(3, 25, 7));
    builder.addLabel(Messages.getString("NetworkTab.24"), cc.xy(1, 27));
    builder.add(port, cc.xyw(3, 27, 7));
    builder.addLabel(Messages.getString("NetworkTab.30"), cc.xy(1, 29));
    builder.add(ip_filter, cc.xyw(3, 29, 7));

    cmp = builder.addSeparator(Messages.getString("NetworkTab.31"), cc.xyw(1, 31, 9));
    cmp = (JComponent) cmp.getComponent(0);
    cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

    newHTTPEngine = new JCheckBox(Messages.getString("NetworkTab.32"));
    newHTTPEngine.setSelected(PMS.getConfiguration().isHTTPEngineV2());
    newHTTPEngine.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            PMS.getConfiguration().setHTTPEngineV2((e.getStateChange() == ItemEvent.SELECTED));
        }
    });
    builder.add(newHTTPEngine, cc.xyw(1, 33, 9));

    preventSleep = new JCheckBox(Messages.getString("NetworkTab.33"));
    preventSleep.setSelected(PMS.getConfiguration().isPreventsSleep());
    preventSleep.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            PMS.getConfiguration().setPreventsSleep((e.getStateChange() == ItemEvent.SELECTED));
        }
    });
    builder.add(preventSleep, cc.xyw(1, 35, 9));

    cmp = builder.addSeparator(Messages.getString("NetworkTab.34"), cc.xyw(1, 37, 9));
    cmp = (JComponent) cmp.getComponent(0);
    cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

    JPanel panel = builder.getPanel();
    JScrollPane scrollPane = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    return scrollPane;
}

From source file:net.pms.newgui.TracesTab.java

License:Open Source License

public JComponent build() {
    // Apply the orientation for the locale
    Locale locale = new Locale(configuration.getLanguage());
    ComponentOrientation orientation = ComponentOrientation.getOrientation(locale);
    String colSpec = FormLayoutUtil.getColSpec("left:pref, 10:grow", orientation);

    FormLayout layout = new FormLayout(colSpec, "fill:10:grow, p");
    PanelBuilder builder = new PanelBuilder(layout);
    builder.opaque(true);//from w w w .  j av  a  2  s  .  c  o  m

    CellConstraints cc = new CellConstraints();

    // create trace text box
    jList = new JTextArea();
    jList.setEditable(false);
    jList.setBackground(Color.WHITE);
    jList.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    final JPopupMenu popup = new JPopupMenu();
    JMenuItem defaultItem = new JMenuItem(Messages.getString("TracesTab.3"));

    defaultItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            jList.setText("");
        }
    });

    popup.add(defaultItem);
    jList.addMouseListener(new PopupTriggerMouseListener(popup, jList));

    jListPane = new JScrollPane(jList, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    jListPane.setBorder(BorderFactory.createEmptyBorder());
    builder.add(jListPane, cc.xyw(1, 1, 2));

    // Add buttons to open logfiles (there may be more than one)
    JPanel pLogfileButtons = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    HashMap<String, String> logfiles = LoggingConfigFileLoader.getLogFilePaths();

    for (String loggerName : logfiles.keySet()) {
        JButton b = new JButton(loggerName);
        b.setToolTipText(logfiles.get(loggerName));

        b.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                File logfile = new File(((JButton) e.getSource()).getToolTipText());
                try {
                    java.awt.Desktop.getDesktop().open(logfile);
                } catch (IOException ioe) {
                    logger.error(String.format("Failed to open file %s in default editor", logfile), ioe);
                } catch (UnsupportedOperationException usoe) {
                    logger.error(String.format("Failed to open file %s in default editor", logfile), usoe);
                }
            }
        });

        pLogfileButtons.add(b);
    }

    builder.add(pLogfileButtons, cc.xy(2, 2));
    return builder.getPanel();
}

From source file:net.pms.newgui.TranscodingTab.java

License:Open Source License

public JComponent build() {
    String colSpec = FormLayoutUtil.getColSpec(MAIN_COL_SPEC, orientation);
    FormLayout mainlayout = new FormLayout(colSpec, MAIN_ROW_SPEC);
    PanelBuilder builder = new PanelBuilder(mainlayout);
    builder.border(Borders.DLU4);/*  w  w  w.j a va2s .c  om*/
    builder.opaque(true);

    CellConstraints cc = new CellConstraints();
    builder.add(buildRightTabbedPanel(), FormLayoutUtil.flip(cc.xyw(4, 1, 3), colSpec, orientation));
    builder.add(buildLeft(), FormLayoutUtil.flip(cc.xy(2, 1), colSpec, orientation));

    JPanel panel = builder.getPanel();

    // Apply the orientation to the panel and all components in it
    panel.applyComponentOrientation(orientation);

    return panel;
}

From source file:net.pms.newgui.TranscodingTab.java

License:Open Source License

public JComponent buildLeft() {
    String colSpec = FormLayoutUtil.getColSpec(LEFT_COL_SPEC, orientation);
    FormLayout layout = new FormLayout(colSpec, LEFT_ROW_SPEC);
    PanelBuilder builder = new PanelBuilder(layout);
    CellConstraints cc = new CellConstraints();

    JButton but = new JButton(LooksFrame.readImageIcon("kdevelop_down-32.png"));
    but.setToolTipText(Messages.getString("TrTab2.6"));
    but.addActionListener(new ActionListener() {
        @Override//w  w w .j a v a 2 s.c o m
        public void actionPerformed(ActionEvent e) {
            TreePath path = tree.getSelectionModel().getSelectionPath();
            if (path != null && path.getLastPathComponent() instanceof TreeNodeSettings) {
                TreeNodeSettings node = ((TreeNodeSettings) path.getLastPathComponent());
                if (node.getPlayer() != null) {
                    DefaultTreeModel dtm = (DefaultTreeModel) tree.getModel(); // get the tree model
                    //now get the index of the selected node in the DefaultTreeModel
                    int index = dtm.getIndexOfChild(node.getParent(), node);
                    // if selected node is first, return (can't move it up)
                    if (index < node.getParent().getChildCount() - 1) {
                        dtm.insertNodeInto(node, (DefaultMutableTreeNode) node.getParent(), index + 1); // move the node
                        dtm.reload();
                        for (int i = 0; i < tree.getRowCount(); i++) {
                            tree.expandRow(i);
                        }
                        tree.getSelectionModel().setSelectionPath(new TreePath(node.getPath()));
                        updateEngineModel();
                    }
                }
            }
        }
    });
    builder.add(but, FormLayoutUtil.flip(cc.xy(2, 3), colSpec, orientation));

    JButton but2 = new JButton(LooksFrame.readImageIcon("up-32.png"));
    but2.setToolTipText(Messages.getString("TrTab2.6"));
    but2.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            TreePath path = tree.getSelectionModel().getSelectionPath();
            if (path != null && path.getLastPathComponent() instanceof TreeNodeSettings) {
                TreeNodeSettings node = ((TreeNodeSettings) path.getLastPathComponent());
                if (node.getPlayer() != null) {
                    DefaultTreeModel dtm = (DefaultTreeModel) tree.getModel(); // get the tree model
                    //now get the index of the selected node in the DefaultTreeModel
                    int index = dtm.getIndexOfChild(node.getParent(), node);
                    // if selected node is first, return (can't move it up)
                    if (index != 0) {
                        dtm.insertNodeInto(node, (DefaultMutableTreeNode) node.getParent(), index - 1); // move the node
                        dtm.reload();
                        for (int i = 0; i < tree.getRowCount(); i++) {
                            tree.expandRow(i);
                        }
                        tree.getSelectionModel().setSelectionPath(new TreePath(node.getPath()));
                        updateEngineModel();
                    }
                }
            }
        }
    });
    builder.add(but2, FormLayoutUtil.flip(cc.xy(3, 3), colSpec, orientation));

    JButton but3 = new JButton(LooksFrame.readImageIcon("connect_no-32.png"));
    but3.setToolTipText(Messages.getString("TrTab2.0"));
    but3.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            TreePath path = tree.getSelectionModel().getSelectionPath();
            if (path != null && path.getLastPathComponent() instanceof TreeNodeSettings
                    && ((TreeNodeSettings) path.getLastPathComponent()).getPlayer() != null) {
                ((TreeNodeSettings) path.getLastPathComponent())
                        .setEnable(!((TreeNodeSettings) path.getLastPathComponent()).isEnable());
                updateEngineModel();
                tree.updateUI();
            }
        }
    });
    builder.add(but3, FormLayoutUtil.flip(cc.xy(4, 3), colSpec, orientation));

    DefaultMutableTreeNode root = new DefaultMutableTreeNode(Messages.getString("TrTab2.11"));
    TreeNodeSettings commonEnc = new TreeNodeSettings(Messages.getString("TrTab2.5"), null, buildCommon());
    commonEnc.getConfigPanel().addComponentListener(new ComponentAdapter() {
        @Override
        public void componentShown(ComponentEvent e) {
            handleCardComponentChange(e.getComponent());
        }
    });
    tabbedPanel.add(commonEnc.id(), commonEnc.getConfigPanel());
    root.add(commonEnc);

    engineTreeNodes = new HashMap<PlayerPurpose, DefaultMutableTreeNode>(5);
    engineTreeNodes.put(VIDEO_FILE_PLAYER, new DefaultMutableTreeNode(Messages.getString("TrTab2.14")));
    engineTreeNodes.put(AUDIO_FILE_PLAYER, new DefaultMutableTreeNode(Messages.getString("TrTab2.15")));
    engineTreeNodes.put(VIDEO_WEB_STREAM_PLAYER, new DefaultMutableTreeNode(Messages.getString("TrTab2.16")));
    engineTreeNodes.put(AUDIO_WEB_STREAM_PLAYER, new DefaultMutableTreeNode(Messages.getString("TrTab2.17")));
    engineTreeNodes.put(MISC_PLAYER, new DefaultMutableTreeNode(Messages.getString("TrTab2.18")));
    root.add(engineTreeNodes.get(VIDEO_FILE_PLAYER));
    root.add(engineTreeNodes.get(AUDIO_FILE_PLAYER));
    root.add(engineTreeNodes.get(VIDEO_WEB_STREAM_PLAYER));
    root.add(engineTreeNodes.get(AUDIO_WEB_STREAM_PLAYER));
    root.add(engineTreeNodes.get(MISC_PLAYER));

    tree = new JTree(new DefaultTreeModel(root)) {
        private static final long serialVersionUID = -6703434752606636290L;
    };
    tree.setRootVisible(false);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.addTreeSelectionListener(new TreeSelectionListener() {
        @Override
        public void valueChanged(TreeSelectionEvent e) {
            if (e.getNewLeadSelectionPath() != null
                    && e.getNewLeadSelectionPath().getLastPathComponent() instanceof TreeNodeSettings) {
                TreeNodeSettings tns = (TreeNodeSettings) e.getNewLeadSelectionPath().getLastPathComponent();
                cl.show(tabbedPanel, tns.id());
            }
        }
    });

    tree.setRequestFocusEnabled(false);
    tree.setCellRenderer(new TreeRenderer());
    JScrollPane pane = new JScrollPane(tree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

    builder.add(pane, FormLayoutUtil.flip(cc.xyw(2, 1, 4), colSpec, orientation));

    builder.addLabel(Messages.getString("TrTab2.19"),
            FormLayoutUtil.flip(cc.xyw(2, 5, 4), colSpec, orientation));
    builder.addLabel(Messages.getString("TrTab2.20"),
            FormLayoutUtil.flip(cc.xyw(2, 7, 4), colSpec, orientation));

    JPanel panel = builder.getPanel();

    // Apply the orientation to the panel and all components in it
    panel.applyComponentOrientation(orientation);

    return panel;
}