Example usage for javax.swing JPanel applyComponentOrientation

List of usage examples for javax.swing JPanel applyComponentOrientation

Introduction

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

Prototype

public void applyComponentOrientation(ComponentOrientation o) 

Source Link

Document

Sets the ComponentOrientation property of this container and all components contained within it.

Usage

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

public void build() {
    JPanel checkPanel = new JPanel();
    checkPanel.applyComponentOrientation(ComponentOrientation.getOrientation(PMS.getLocale()));
    add(checkPanel, BorderLayout.LINE_START);
    allRenderers = new SearchableMutableTreeNode(Messages.getString("GeneralTab.13"));

    Pattern pattern = Pattern.compile("^\\s*([^\\s]*) ?([^\\s].*?)?\\s*$");
    for (String renderer : RendererConfiguration.getAllRenderersNames()) {
        Matcher match = pattern.matcher(renderer);
        if (match.find()) {
            // Find or create group or single name renderer
            SearchableMutableTreeNode node = null;
            try {
                node = allRenderers.findChild(match.group(1));
            } catch (IllegalChildException e) {
            }/* w  ww.j  a  v  a  2  s  .com*/
            if (node == null) {
                node = new SearchableMutableTreeNode(match.group(1));
                allRenderers.add(node);
            }
            // Find or create subgroup/name
            if (match.groupCount() > 1 && match.group(2) != null) {
                SearchableMutableTreeNode subNode = null;
                try {
                    subNode = node.findChild(match.group(2));
                } catch (IllegalChildException e) {
                }
                if (subNode != null) {
                    LOGGER.warn("Renderer {} found twice, ignoring repeated entry", renderer);
                } else {
                    subNode = new SearchableMutableTreeNode(match.group(2));
                    node.add(subNode);
                }
            }
        } else {
            LOGGER.warn("Can't parse renderer name \"{}\"", renderer);
        }
    }

    SrvTree = new JTree(new DefaultTreeModel(allRenderers));
    checkTreeManager = new CheckTreeManager(SrvTree);
    checkPanel.add(new JScrollPane(SrvTree));
    checkPanel.setSize(400, 500);
}

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

public JComponent build() {
    // Apply the orientation for the locale
    ComponentOrientation orientation = ComponentOrientation.getOrientation(PMS.getLocale());

    String colSpec = FormLayoutUtil.getColSpec("pref, 30dlu, fill:pref:grow, 30dlu, pref", orientation);
    //                                             1     2          3           4     5

    FormLayout layout = new FormLayout(colSpec,
            //                          1     2          3            4     5
            //                   //////////////////////////////////////////////////
            "p," // Detected Media Renderers --------------------//  1
                    + "9dlu," //                                              //
                    + "fill:p:grow," //                 <renderers>                  //  3
                    + "3dlu," //                                              //
                    + "p," // ---------------------------------------------//  5
                    + "3dlu," //           |                       |          //
                    + "p," // Connected |  Memory Usage         |<bitrate> //  7
                    + "3dlu," //           |                       |          //
                    + "p," //  <icon>   |  <statusbar>          |          //  9
                           //////////////////////////////////////////////////
    );/*from w  w w.jav a2s  .  c  om*/

    PanelBuilder builder = new PanelBuilder(layout);
    builder.border(Borders.DIALOG);
    builder.opaque(true);
    CellConstraints cc = new CellConstraints();

    // Renderers
    JComponent cmp = builder.addSeparator(Messages.getString("StatusTab.9"),
            FormLayoutUtil.flip(cc.xyw(1, 1, 5), colSpec, orientation));
    cmp = (JComponent) cmp.getComponent(0);
    Font bold = cmp.getFont().deriveFont(Font.BOLD);
    Color fgColor = new Color(68, 68, 68);
    cmp.setFont(bold);

    renderers = new JPanel(new GuiUtil.WrapLayout(FlowLayout.CENTER, 20, 10));
    JScrollPane rsp = new JScrollPane(renderers, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    rsp.setBorder(BorderFactory.createEmptyBorder());
    rsp.setPreferredSize(new Dimension(0, 260));
    rsp.getHorizontalScrollBar().setLocation(0, 250);

    builder.add(rsp, cc.xyw(1, 3, 5));

    cmp = builder.addSeparator(null, FormLayoutUtil.flip(cc.xyw(1, 5, 5), colSpec, orientation));

    // Connected
    jl = new JLabel(Messages.getString("StatusTab.3"));
    builder.add(jl, FormLayoutUtil.flip(cc.xy(1, 7, "center, top"), colSpec, orientation));
    jl.setFont(bold);
    jl.setForeground(fgColor);

    imagePanel = buildImagePanel("/resources/images/icon-status-connecting.png");
    builder.add(imagePanel, FormLayoutUtil.flip(cc.xy(1, 9), colSpec, orientation));

    // Memory
    memBarUI = new GuiUtil.SegmentedProgressBarUI(Color.white, Color.gray);
    memBarUI.setActiveLabel("{}", Color.white, 0);
    memBarUI.setActiveLabel("{}", Color.red, 90);
    memBarUI.addSegment("", memColor);
    memBarUI.addSegment("", bufColor);
    memBarUI.setTickMarks(getTickMarks(), "{}");
    memoryProgressBar = new GuiUtil.CustomUIProgressBar(0, 100, memBarUI);
    memoryProgressBar.setStringPainted(true);
    memoryProgressBar.setForeground(new Color(75, 140, 181));
    memoryProgressBar.setString(Messages.getString("StatusTab.5"));

    JLabel mem = builder
            .addLabel(
                    "<html><b>" + Messages.getString("StatusTab.6") + "</b> ("
                            + Messages.getString("StatusTab.12") + ")</html>",
                    FormLayoutUtil.flip(cc.xy(3, 7), colSpec, orientation));
    mem.setForeground(fgColor);
    builder.add(memoryProgressBar, FormLayoutUtil.flip(cc.xyw(3, 9, 1), colSpec, orientation));

    // Bitrate
    String bitColSpec = "left:pref, 3dlu, right:pref:grow";
    PanelBuilder bitrateBuilder = new PanelBuilder(new FormLayout(bitColSpec, "p, 1dlu, p, 1dlu, p"));

    bitrateLabel = new JLabel("<html><b>" + Messages.getString("StatusTab.13") + "</b> ("
            + Messages.getString("StatusTab.11") + ")</html>");
    bitrateLabel.setForeground(fgColor);
    bitrateBuilder.add(bitrateLabel, FormLayoutUtil.flip(cc.xy(1, 1), bitColSpec, orientation));

    currentBitrateLabel = new JLabel(Messages.getString("StatusTab.14"));
    currentBitrateLabel.setForeground(fgColor);
    bitrateBuilder.add(currentBitrateLabel, FormLayoutUtil.flip(cc.xy(1, 3), bitColSpec, orientation));

    currentBitrate = new JLabel("0");
    currentBitrate.setForeground(fgColor);
    bitrateBuilder.add(currentBitrate, FormLayoutUtil.flip(cc.xy(3, 3), bitColSpec, orientation));

    peakBitrateLabel = new JLabel(Messages.getString("StatusTab.15"));
    peakBitrateLabel.setForeground(fgColor);
    bitrateBuilder.add(peakBitrateLabel, FormLayoutUtil.flip(cc.xy(1, 5), bitColSpec, orientation));

    peakBitrate = new JLabel("0");
    peakBitrate.setForeground(fgColor);
    bitrateBuilder.add(peakBitrate, FormLayoutUtil.flip(cc.xy(3, 5), bitColSpec, orientation));

    builder.add(bitrateBuilder.getPanel(),
            FormLayoutUtil.flip(cc.xywh(5, 7, 1, 3, "left, top"), colSpec, orientation));

    JPanel panel = builder.getPanel();

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

    JScrollPane scrollPane = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_NEVER,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    startMemoryUpdater();
    return scrollPane;
}

From source file:fr.pasteque.pos.sales.restaurant.JTicketsBagRestaurantMap.java

/** Creates new form JTicketsBagRestaurant */
public JTicketsBagRestaurantMap(AppView app, TicketsEditor panelticket) {

    super(app, panelticket);

    dlReceipts = new DataLogicReceipts();
    dlSales = new DataLogicSales();

    m_restaurantmap = new JTicketsBagRestaurant(app, this);
    m_PlaceCurrent = null;/*from   w w  w .j a va 2 s .  c om*/
    m_PlaceClipboard = null;
    customer = null;
    this.floors = new ArrayList<Floor>();
    this.places = new HashMap<String, List<Place>>();
    try {
        ServerLoader loader = new ServerLoader();
        ServerLoader.Response r = loader.read("PlacesAPI", "getAll");
        if (r.getStatus().equals(ServerLoader.Response.STATUS_OK)) {
            JSONArray a = r.getArrayContent();
            for (int i = 0; i < a.length(); i++) {
                JSONObject oFloor = a.getJSONObject(i);
                Floor f = new Floor(oFloor);
                this.floors.add(f);
                this.places.put(f.getID(), new ArrayList<Place>());
                JSONArray aPlaces = oFloor.getJSONArray("places");
                for (int j = 0; j < aPlaces.length(); j++) {
                    Place p = new Place(aPlaces.getJSONObject(j));
                    this.places.get(f.getID()).add(p);
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    initComponents();

    // add the Floors containers
    if (this.floors.size() > 1) {
        // A tab container for 2 or more floors
        JTabbedPane jTabFloors = new JTabbedPane();
        jTabFloors.applyComponentOrientation(getComponentOrientation());
        jTabFloors.setBorder(new javax.swing.border.EmptyBorder(new Insets(5, 5, 5, 5)));
        jTabFloors.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        jTabFloors.setFocusable(false);
        jTabFloors.setRequestFocusEnabled(false);
        m_jPanelMap.add(jTabFloors, BorderLayout.CENTER);

        for (Floor f : this.floors) {
            f.getContainer().applyComponentOrientation(getComponentOrientation());
            JScrollPane jScrCont = new JScrollPane();
            jScrCont.applyComponentOrientation(getComponentOrientation());
            JPanel jPanCont = new JPanel();
            jPanCont.applyComponentOrientation(getComponentOrientation());

            jTabFloors.addTab(f.getName(), f.getIcon(), jScrCont);
            jScrCont.setViewportView(jPanCont);
            jPanCont.add(f.getContainer());
        }
    } else if (this.floors.size() == 1) {
        // Just a frame for 1 floor
        Floor f = this.floors.get(0);
        f.getContainer().applyComponentOrientation(getComponentOrientation());

        JPanel jPlaces = new JPanel();
        jPlaces.applyComponentOrientation(getComponentOrientation());
        jPlaces.setLayout(new BorderLayout());
        jPlaces.setBorder(new javax.swing.border.CompoundBorder(
                new javax.swing.border.EmptyBorder(new Insets(5, 5, 5, 5)),
                new javax.swing.border.TitledBorder(f.getName())));

        JScrollPane jScrCont = new JScrollPane();
        jScrCont.applyComponentOrientation(getComponentOrientation());
        JPanel jPanCont = new JPanel();
        jPanCont.applyComponentOrientation(getComponentOrientation());

        // jPlaces.setLayout(new FlowLayout());           
        m_jPanelMap.add(jPlaces, BorderLayout.CENTER);
        jPlaces.add(jScrCont, BorderLayout.CENTER);
        jScrCont.setViewportView(jPanCont);
        jPanCont.add(f.getContainer());
    }

    // Add all the Table buttons.
    for (Floor f : this.floors) {
        List<Place> places = this.places.get(f.getID());
        for (Place pl : places) {
            f.getContainer().add(pl.getButton());
            pl.setButtonBounds();
            pl.getButton().addActionListener(new MyActionListener(pl));
        }
    }

    // Add the reservations panel
    m_jreservations = new JTicketsBagRestaurantRes(app, this);
    add(m_jreservations, "res");
}

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

public JComponent build() {
    // Apply the orientation for the locale
    Locale locale = new Locale(configuration.getLanguage());
    ComponentOrientation orientation = ComponentOrientation.getOrientation(locale);
    String colSpec = FormLayoutUtil.getColSpec(COL_SPEC, orientation);

    FormLayout layout = new FormLayout(colSpec, ROW_SPEC);
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.DLU4_BORDER);
    builder.setOpaque(true);/*from w w  w  .ja  v  a 2  s  . co m*/

    CellConstraints cc = new CellConstraints();

    smcheckBox = new JCheckBox(Messages.getString("NetworkTab.3"));
    smcheckBox.setContentAreaFilled(false);
    smcheckBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            configuration.setMinimized((e.getStateChange() == ItemEvent.SELECTED));
        }
    });

    if (configuration.isMinimized()) {
        smcheckBox.setSelected(true);
    }

    JComponent cmp = builder.addSeparator(Messages.getString("NetworkTab.5"),
            FormLayoutUtil.flip(cc.xyw(1, 1, 9), colSpec, orientation));
    cmp = (JComponent) cmp.getComponent(0);
    cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));
    builder.addLabel(Messages.getString("NetworkTab.0"),
            FormLayoutUtil.flip(cc.xy(1, 7), colSpec, orientation));
    final KeyedComboBoxModel kcbm = new KeyedComboBoxModel(
            new Object[] { "ar", "bg", "ca", "zhs", "zht", "cz", "da", "nl", "en", "fi", "fr", "de", "el", "iw",
                    "is", "it", "ja", "ko", "no", "pl", "pt", "br", "ro", "ru", "sl", "es", "sv", "tr" },
            new Object[] { "Arabic", "Bulgarian", "Catalan", "Chinese (Simplified)", "Chinese (Traditional)",
                    "Czech", "Danish", "Dutch", "English", "Finnish", "French", "German", "Greek", "Hebrew",
                    "Icelandic", "Italian", "Japanese", "Korean", "Norwegian", "Polish", "Portuguese",
                    "Portuguese (Brazilian)", "Romanian", "Russian", "Slovenian", "Spanish", "Swedish",
                    "Turkish" });
    langs = new JComboBox(kcbm);
    langs.setEditable(false);
    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, FormLayoutUtil.flip(cc.xyw(3, 7, 7), colSpec, orientation));

    builder.add(smcheckBox, FormLayoutUtil.flip(cc.xyw(1, 9, 9), colSpec, orientation));

    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"),
                        Messages.getString("Dialog.Information"), JOptionPane.INFORMATION_MESSAGE);

            } else {
                JOptionPane.showMessageDialog(
                        (JFrame) (SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame())),
                        Messages.getString("NetworkTab.14"), Messages.getString("Dialog.Error"),
                        JOptionPane.ERROR_MESSAGE);
            }
        }
    });

    builder.add(service, FormLayoutUtil.flip(cc.xy(1, 11), colSpec, orientation));

    if (System.getProperty(LooksFrame.START_SERVICE) != null || !Platform.isWindows()) {
        service.setEnabled(false);
    }

    JButton checkForUpdates = new JButton(Messages.getString("NetworkTab.8"));

    checkForUpdates.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            LooksFrame frame = (LooksFrame) PMS.get().getFrame();
            frame.checkForUpdates();
        }
    });

    builder.add(checkForUpdates, FormLayoutUtil.flip(cc.xy(1, 13), colSpec, orientation));

    autoUpdateCheckBox = new JCheckBox(Messages.getString("NetworkTab.9"));
    autoUpdateCheckBox.setContentAreaFilled(false);
    autoUpdateCheckBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            configuration.setAutoUpdate((e.getStateChange() == ItemEvent.SELECTED));
        }
    });

    if (configuration.isAutoUpdate()) {
        autoUpdateCheckBox.setSelected(true);
    }

    builder.add(autoUpdateCheckBox, FormLayoutUtil.flip(cc.xyw(7, 13, 3), colSpec, orientation));

    if (!Build.isUpdatable()) {
        checkForUpdates.setEnabled(false);
        autoUpdateCheckBox.setEnabled(false);
    }

    host = new JTextField(configuration.getServerHostname());
    host.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setHostname(host.getText());
        }
    });

    port = new JTextField(configuration.getServerPort() != 5001 ? "" + configuration.getServerPort() : "");
    port.addKeyListener(new KeyAdapter() {
        @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);
            } catch (NumberFormatException nfe) {
                logger.debug("Could not parse port from \"" + port.getText() + "\"");
            }

        }
    });

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

    final KeyedComboBoxModel networkInterfaces = createNetworkInterfacesModel();
    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());
            }
        }
    });

    ip_filter = new JTextField(configuration.getIpFilter());
    ip_filter.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setIpFilter(ip_filter.getText());
        }
    });

    maxbitrate = new JTextField(configuration.getMaximumBitrate());
    maxbitrate.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            PMS.getConfiguration().setMaximumBitrate(maxbitrate.getText());
        }
    });

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

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

    newHTTPEngine = new JCheckBox(Messages.getString("NetworkTab.32"));
    newHTTPEngine.setSelected(configuration.isHTTPEngineV2());
    newHTTPEngine.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            configuration.setHTTPEngineV2((e.getStateChange() == ItemEvent.SELECTED));
        }
    });
    builder.add(newHTTPEngine, FormLayoutUtil.flip(cc.xyw(1, 35, 9), colSpec, orientation));

    preventSleep = new JCheckBox(Messages.getString("NetworkTab.33"));
    preventSleep.setSelected(configuration.isPreventsSleep());
    preventSleep.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            configuration.setPreventsSleep((e.getStateChange() == ItemEvent.SELECTED));
        }
    });
    builder.add(preventSleep, FormLayoutUtil.flip(cc.xyw(1, 37, 9), colSpec, orientation));

    JCheckBox fdCheckBox = new JCheckBox(Messages.getString("NetworkTab.38"));
    fdCheckBox.setContentAreaFilled(false);
    fdCheckBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            configuration.setRendererForceDefault((e.getStateChange() == ItemEvent.SELECTED));
        }
    });

    if (configuration.isRendererForceDefault()) {
        fdCheckBox.setSelected(true);
    }

    builder.addLabel(Messages.getString("NetworkTab.36"),
            FormLayoutUtil.flip(cc.xy(1, 39), colSpec, orientation));

    ArrayList<RendererConfiguration> allConfs = RendererConfiguration.getAllRendererConfigurations();
    ArrayList<Object> keyValues = new ArrayList<Object>();
    ArrayList<Object> nameValues = new ArrayList<Object>();
    keyValues.add("");
    nameValues.add(Messages.getString("NetworkTab.37"));

    if (allConfs != null) {
        for (RendererConfiguration renderer : allConfs) {
            if (renderer != null) {
                keyValues.add(renderer.getRendererName());
                nameValues.add(renderer.getRendererName());
            }
        }
    }

    final KeyedComboBoxModel renderersKcbm = new KeyedComboBoxModel(
            (Object[]) keyValues.toArray(new Object[keyValues.size()]),
            (Object[]) nameValues.toArray(new Object[nameValues.size()]));
    renderers = new JComboBox(renderersKcbm);
    renderers.setEditable(false);
    String defaultRenderer = configuration.getRendererDefault();
    renderersKcbm.setSelectedKey(defaultRenderer);

    if (renderers.getSelectedIndex() == -1) {
        renderers.setSelectedIndex(0);
    }

    builder.add(renderers, FormLayoutUtil.flip(cc.xyw(3, 39, 7), colSpec, orientation));

    builder.add(fdCheckBox, FormLayoutUtil.flip(cc.xyw(1, 41, 9), colSpec, orientation));

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

    pPlugins = new JPanel(new GridLayout());
    builder.add(pPlugins, FormLayoutUtil.flip(cc.xyw(1, 45, 9), colSpec, orientation));

    JPanel panel = builder.getPanel();

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

    JScrollPane scrollPane = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    return scrollPane;
}

From source file:net.pms.encoders.TsMuxeRVideo.java

@Override
public JComponent config() {
    // Apply the orientation for the locale
    Locale locale = new Locale(configuration.getLanguage());
    ComponentOrientation orientation = ComponentOrientation.getOrientation(locale);
    String colSpec = FormLayoutUtil.getColSpec(COL_SPEC, orientation);
    FormLayout layout = new FormLayout(colSpec, ROW_SPEC);

    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.EMPTY_BORDER);
    builder.setOpaque(false);/*from   w ww.j ava 2 s.  co m*/

    CellConstraints cc = new CellConstraints();

    JComponent cmp = builder.addSeparator(Messages.getString("TSMuxerVideo.3"),
            FormLayoutUtil.flip(cc.xyw(2, 1, 1), colSpec, orientation));
    cmp = (JComponent) cmp.getComponent(0);
    cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

    tsmuxerforcefps = new JCheckBox(Messages.getString("TSMuxerVideo.2"));
    tsmuxerforcefps.setContentAreaFilled(false);
    if (configuration.isTsmuxerForceFps()) {
        tsmuxerforcefps.setSelected(true);
    }
    tsmuxerforcefps.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setTsmuxerForceFps(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    builder.add(tsmuxerforcefps, FormLayoutUtil.flip(cc.xy(2, 3), colSpec, orientation));

    muxallaudiotracks = new JCheckBox(Messages.getString("TSMuxerVideo.19"));
    muxallaudiotracks.setContentAreaFilled(false);
    if (configuration.isMuxAllAudioTracks()) {
        muxallaudiotracks.setSelected(true);
    }

    muxallaudiotracks.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMuxAllAudioTracks(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    builder.add(muxallaudiotracks, FormLayoutUtil.flip(cc.xy(2, 5), 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.NavigationShareTab.java

public JComponent build() {
    // Apply the orientation for the locale
    ComponentOrientation orientation = ComponentOrientation.getOrientation(PMS.getLocale());
    String colSpec = FormLayoutUtil.getColSpec(PANEL_COL_SPEC, orientation);

    // Set basic layout
    FormLayout layout = new FormLayout(colSpec, PANEL_ROW_SPEC);
    PanelBuilder builder = new PanelBuilder(layout);
    builder.border(Borders.DLU4);/*  w  ww. j a  v a2s  .  c  o  m*/
    builder.opaque(true);

    CellConstraints cc = new CellConstraints();

    // Init all gui components
    initSimpleComponents(cc);
    sharedPanel = initSharedFoldersGuiComponents(cc).build();

    // Build gui with initialized components
    if (!configuration.isHideAdvancedOptions()) {
        JComponent cmp = builder.addSeparator(Messages.getString("FoldTab.13"),
                FormLayoutUtil.flip(cc.xyw(1, 1, 12), colSpec, orientation));
        cmp = (JComponent) cmp.getComponent(0);
        cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

        builder.add(GuiUtil.getPreferredSizeComponent(thumbgenCheckBox),
                FormLayoutUtil.flip(cc.xyw(1, 3, 3), colSpec, orientation));
        builder.addLabel(Messages.getString("NetworkTab.16"),
                FormLayoutUtil.flip(cc.xyw(4, 3, 2), colSpec, orientation));
        builder.add(seekpos, FormLayoutUtil.flip(cc.xy(6, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(image_thumb),
                FormLayoutUtil.flip(cc.xyw(9, 3, 4), colSpec, orientation));

        builder.addLabel(Messages.getString("FoldTab.26"),
                FormLayoutUtil.flip(cc.xyw(1, 5, 3), colSpec, orientation));
        builder.add(audiothumbnail, FormLayoutUtil.flip(cc.xyw(4, 5, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(mplayer_thumb),
                FormLayoutUtil.flip(cc.xyw(9, 5, 4), colSpec, orientation));

        builder.addLabel(Messages.getString("FoldTab.27"),
                FormLayoutUtil.flip(cc.xy(1, 7), colSpec, orientation));
        builder.add(defaultThumbFolder, FormLayoutUtil.flip(cc.xyw(4, 7, 2), colSpec, orientation));
        builder.add(select, FormLayoutUtil.flip(cc.xy(6, 7), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(dvdiso_thumb),
                FormLayoutUtil.flip(cc.xyw(9, 7, 4), colSpec, orientation));

        cmp = builder.addSeparator(Messages.getString("NetworkTab.59"),
                FormLayoutUtil.flip(cc.xyw(1, 9, 12), colSpec, orientation));
        cmp = (JComponent) cmp.getComponent(0);
        cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

        builder.addLabel(Messages.getString("FoldTab.18"),
                FormLayoutUtil.flip(cc.xyw(1, 11, 3), colSpec, orientation));
        builder.add(sortmethod, FormLayoutUtil.flip(cc.xyw(4, 11, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(ignorethewordthe),
                FormLayoutUtil.flip(cc.xyw(9, 11, 4), colSpec, orientation));

        builder.add(GuiUtil.getPreferredSizeComponent(prettifyfilenames),
                FormLayoutUtil.flip(cc.xyw(1, 13, 5), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(episodeTitles),
                FormLayoutUtil.flip(cc.xyw(9, 13, 4), colSpec, orientation));

        cmp = builder.addSeparator(Messages.getString("NetworkTab.60"),
                FormLayoutUtil.flip(cc.xyw(1, 15, 12), colSpec, orientation));
        cmp = (JComponent) cmp.getComponent(0);
        cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

        builder.add(GuiUtil.getPreferredSizeComponent(hideextensions),
                FormLayoutUtil.flip(cc.xyw(1, 17, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(hideengines),
                FormLayoutUtil.flip(cc.xyw(4, 17, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(hideemptyfolders),
                FormLayoutUtil.flip(cc.xyw(9, 17, 4), colSpec, orientation));

        builder.add(GuiUtil.getPreferredSizeComponent(itunes),
                FormLayoutUtil.flip(cc.xy(1, 19), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(iphoto),
                FormLayoutUtil.flip(cc.xyw(4, 19, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(aperture),
                FormLayoutUtil.flip(cc.xyw(9, 19, 4), colSpec, orientation));

        builder.add(GuiUtil.getPreferredSizeComponent(cacheenable),
                FormLayoutUtil.flip(cc.xy(1, 21), colSpec, orientation));
        builder.add(cachereset, FormLayoutUtil.flip(cc.xyw(4, 21, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(isShowFolderMediaLibrary),
                FormLayoutUtil.flip(cc.xyw(9, 21, 4), colSpec, orientation));

        builder.add(GuiUtil.getPreferredSizeComponent(archive),
                FormLayoutUtil.flip(cc.xyw(1, 23, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(isShowFolderServerSettings),
                FormLayoutUtil.flip(cc.xyw(4, 23, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(isShowFolderTranscode),
                FormLayoutUtil.flip(cc.xyw(9, 23, 4), colSpec, orientation));

        builder.add(GuiUtil.getPreferredSizeComponent(isShowFolderLiveSubtitles),
                FormLayoutUtil.flip(cc.xyw(1, 25, 3), colSpec, orientation));
        builder.addLabel(Messages.getString("FoldTab.37"),
                FormLayoutUtil.flip(cc.xyw(4, 25, 2), colSpec, orientation));
        builder.add(atzLimit, FormLayoutUtil.flip(cc.xy(6, 25), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(isShowFolderNewMedia),
                FormLayoutUtil.flip(cc.xyw(9, 25, 4), colSpec, orientation));

        builder.add(GuiUtil.getPreferredSizeComponent(resume),
                FormLayoutUtil.flip(cc.xy(1, 27), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(isShowFolderRecentlyPlayed),
                FormLayoutUtil.flip(cc.xyw(9, 27, 4), colSpec, orientation));

        builder.addLabel(Messages.getString("FoldTab.72"),
                FormLayoutUtil.flip(cc.xy(1, 29), colSpec, orientation));
        builder.add(fullyPlayedAction, FormLayoutUtil.flip(cc.xyw(4, 29, 3), colSpec, orientation));
        builder.add(fullyPlayedOutputDirectory, FormLayoutUtil.flip(cc.xyw(9, 29, 2), colSpec, orientation));
        builder.add(selectFullyPlayedOutputDirectory,
                FormLayoutUtil.flip(cc.xyw(11, 29, 2), colSpec, orientation));

        builder.add(sharedPanel, FormLayoutUtil.flip(cc.xyw(1, 31, 12), colSpec, orientation));
    } else {
        builder.add(sharedPanel, FormLayoutUtil.flip(cc.xyw(1, 1, 12), colSpec, orientation));
    }

    builder.add(sharedPanel, FormLayoutUtil.flip(cc.xyw(1, 31, 12), colSpec, orientation));

    JPanel panel = builder.getPanel();

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

    JScrollPane scrollPane = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    return scrollPane;
}

From source file:com.openbravo.pos.sales.restaurant.JRetailTicketsBagRestaurantMap.java

/**
 * Creates new form JTicketsBagRestaurant
 *//*from ww  w  .  ja  v a  2 s .  c o m*/
public JRetailTicketsBagRestaurantMap(AppView app, RetailTicketsEditor panelticket, String businessType) {

    super(app, panelticket);
    this.m_App = app;
    dlReceipts = (DataLogicReceipts) app.getBean("com.openbravo.pos.sales.DataLogicReceipts");
    dlSales = (DataLogicSales) m_App.getBean("com.openbravo.pos.forms.DataLogicSales");
    dlSystem = (DataLogicSystem) m_App.getBean("com.openbravo.pos.forms.DataLogicSystem");

    m_restaurantmap = new JRetailTicketsBagRestaurant(app, this);
    m_PlaceCurrent = null;
    m_PlaceClipboard = null;
    customer = null;
    //Select all the floor details from db for showing the floor name in screen
    try {
        SentenceList sent = new StaticSentence(app.getSession(),
                "SELECT ID, NAME, IMAGE FROM FLOORS ORDER BY NAME", null, new SerializerReadClass(Floor.class));
        m_afloors = sent.list();

    } catch (BasicException eD) {
        m_afloors = new ArrayList<Floor>();
    }
    //Select all the tables details from db for showing the table names in screen
    try {
        SentenceList sent = new StaticSentence(app.getSession(),
                "SELECT ID, NAME, X, Y, FLOOR FROM PLACES WHERE NAME NOT LIKE 'takeaway' ORDER BY FLOOR", null,
                new SerializerReadClass(Place.class));
        m_aplaces = sent.list();
    } catch (BasicException eD) {
        m_aplaces = new ArrayList<Place>();
    }
    //Initialise the components
    initComponents();

    // add the Floors containers
    if (m_afloors.size() > 1) {
        // A tab container for 2 or more floors
        JTabbedPane jTabFloors = new JTabbedPane();
        jTabFloors.applyComponentOrientation(getComponentOrientation());
        jTabFloors.setBorder(new javax.swing.border.EmptyBorder(new Insets(5, 5, 5, 5)));
        jTabFloors.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        jTabFloors.setFocusable(false);
        jTabFloors.setRequestFocusEnabled(false);
        m_jPanelMap.add(jTabFloors, BorderLayout.CENTER);

        for (Floor f : m_afloors) {
            f.getContainer().applyComponentOrientation(getComponentOrientation());

            JScrollPane jScrCont = new JScrollPane();
            jScrCont.applyComponentOrientation(getComponentOrientation());
            JPanel jPanCont = new JPanel();
            jPanCont.applyComponentOrientation(getComponentOrientation());

            jTabFloors.addTab(f.getName(), f.getIcon(), jScrCont);
            jScrCont.setViewportView(jPanCont);
            jPanCont.add(f.getContainer());
        }
    } else if (m_afloors.size() == 1) {
        // Just a frame for 1 floor
        Floor f = m_afloors.get(0);
        f.getContainer().applyComponentOrientation(getComponentOrientation());

        JPanel jPlaces = new JPanel();
        jPlaces.applyComponentOrientation(getComponentOrientation());
        jPlaces.setLayout(new BorderLayout());

        jPlaces.setBorder(new javax.swing.border.CompoundBorder(
                new javax.swing.border.EmptyBorder(new Insets(5, 5, 5, 5)),
                new javax.swing.border.TitledBorder(f.getName())));
        JScrollPane jScrCont = new JScrollPane();
        jScrCont.applyComponentOrientation(getComponentOrientation());
        JPanel jPanCont = new JPanel();
        jPanCont.applyComponentOrientation(getComponentOrientation());
        m_jPanelMap.add(jPlaces, BorderLayout.CENTER);
        jPlaces.add(jScrCont, BorderLayout.CENTER);
        jScrCont.setViewportView(jPanCont);
        jPanCont.add(f.getContainer());
    }

    // Add all the Table buttons.
    Floor currfloor = null;

    for (Place pl : m_aplaces) {
        int iFloor = 0;

        if (currfloor == null || !currfloor.getID().equals(pl.getFloor())) {
            // Look for a new floor
            do {
                currfloor = m_afloors.get(iFloor++);
            } while (!currfloor.getID().equals(pl.getFloor()));
        }

        currfloor.getContainer().add(pl.getButton());
        pl.setButtonBounds();
        pl.getButton().addActionListener(new MyActionListener(pl));
    }

    // Add the reservations panel
    m_jreservations = new JRetailTicketsBagRestaurantRes(app, this);
    add(m_jreservations, "res");
}

From source file:net.pms.encoders.MEncoderVideo.java

@Override
public JComponent config() {
    // Apply the orientation for the locale
    Locale locale = new Locale(configuration.getLanguage());
    ComponentOrientation orientation = ComponentOrientation.getOrientation(locale);
    String colSpec = FormLayoutUtil.getColSpec(COL_SPEC, orientation);

    FormLayout layout = new FormLayout(colSpec, ROW_SPEC);
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.EMPTY_BORDER);
    builder.setOpaque(false);//from www .  j  a  v a 2s. c  o  m

    CellConstraints cc = new CellConstraints();

    checkBox = new JCheckBox(Messages.getString("MEncoderVideo.0"));
    checkBox.setContentAreaFilled(false);

    if (configuration.getSkipLoopFilterEnabled()) {
        checkBox.setSelected(true);
    }

    checkBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setSkipLoopFilterEnabled((e.getStateChange() == ItemEvent.SELECTED));
        }
    });

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

    mencodermt = new JCheckBox(Messages.getString("MEncoderVideo.35"));
    mencodermt.setContentAreaFilled(false);

    if (configuration.getMencoderMT()) {
        mencodermt.setSelected(true);
    }

    mencodermt.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            configuration.setMencoderMT(mencodermt.isSelected());
        }
    });

    mencodermt.setEnabled(Platform.isWindows() || Platform.isMac());

    builder.add(mencodermt, FormLayoutUtil.flip(cc.xy(1, 3), colSpec, orientation));
    builder.add(checkBox, FormLayoutUtil.flip(cc.xyw(3, 3, 12), colSpec, orientation));

    noskip = new JCheckBox(Messages.getString("MEncoderVideo.2"));
    noskip.setContentAreaFilled(false);

    if (configuration.isMencoderNoOutOfSync()) {
        noskip.setSelected(true);
    }

    noskip.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderNoOutOfSync((e.getStateChange() == ItemEvent.SELECTED));
        }
    });

    builder.add(noskip, FormLayoutUtil.flip(cc.xy(1, 5), colSpec, orientation));

    JButton button = new JButton(Messages.getString("MEncoderVideo.29"));
    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JPanel codecPanel = new JPanel(new BorderLayout());
            final JTextArea textArea = new JTextArea();
            textArea.setText(configuration.getMencoderCodecSpecificConfig());
            textArea.setFont(new Font("Courier", Font.PLAIN, 12));
            JScrollPane scrollPane = new JScrollPane(textArea);
            scrollPane.setPreferredSize(new java.awt.Dimension(900, 100));

            final JTextArea textAreaDefault = new JTextArea();
            textAreaDefault.setText(DEFAULT_CODEC_CONF_SCRIPT);
            textAreaDefault.setBackground(Color.WHITE);
            textAreaDefault.setFont(new Font("Courier", Font.PLAIN, 12));
            textAreaDefault.setEditable(false);
            textAreaDefault.setEnabled(configuration.isMencoderIntelligentSync());
            JScrollPane scrollPaneDefault = new JScrollPane(textAreaDefault);
            scrollPaneDefault.setPreferredSize(new java.awt.Dimension(900, 450));

            JPanel customPanel = new JPanel(new BorderLayout());
            intelligentsync = new JCheckBox(Messages.getString("MEncoderVideo.3"));
            intelligentsync.setContentAreaFilled(false);

            if (configuration.isMencoderIntelligentSync()) {
                intelligentsync.setSelected(true);
            }

            intelligentsync.addItemListener(new ItemListener() {
                @Override
                public void itemStateChanged(ItemEvent e) {
                    configuration.setMencoderIntelligentSync((e.getStateChange() == ItemEvent.SELECTED));
                    textAreaDefault.setEnabled(configuration.isMencoderIntelligentSync());

                }
            });

            JLabel label = new JLabel(Messages.getString("MEncoderVideo.33"));
            customPanel.add(label, BorderLayout.NORTH);
            customPanel.add(scrollPane, BorderLayout.SOUTH);

            codecPanel.add(intelligentsync, BorderLayout.NORTH);
            codecPanel.add(scrollPaneDefault, BorderLayout.CENTER);
            codecPanel.add(customPanel, BorderLayout.SOUTH);

            while (JOptionPane.showOptionDialog(
                    SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame()), codecPanel,
                    Messages.getString("MEncoderVideo.34"), JOptionPane.OK_CANCEL_OPTION,
                    JOptionPane.PLAIN_MESSAGE, null, null, null) == JOptionPane.OK_OPTION) {
                String newCodecparam = textArea.getText();
                DLNAMediaInfo fakemedia = new DLNAMediaInfo();
                DLNAMediaAudio audio = new DLNAMediaAudio();
                audio.setCodecA("ac3");
                fakemedia.setCodecV("mpeg4");
                fakemedia.setContainer("matroska");
                fakemedia.setDuration(45d * 60);
                audio.getAudioProperties().setNumberOfChannels(2);
                fakemedia.setWidth(1280);
                fakemedia.setHeight(720);
                audio.setSampleFrequency("48000");
                fakemedia.setFrameRate("23.976");
                fakemedia.getAudioTracksList().add(audio);
                String result[] = getSpecificCodecOptions(newCodecparam, fakemedia,
                        new OutputParams(configuration), "dummy.mpg", "dummy.srt", false, true);

                if (result.length > 0 && result[0].startsWith("@@")) {
                    String errorMessage = result[0].substring(2);
                    JOptionPane.showMessageDialog(
                            SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame()), errorMessage,
                            Messages.getString("Dialog.Error"), JOptionPane.ERROR_MESSAGE);
                } else {
                    configuration.setMencoderCodecSpecificConfig(newCodecparam);
                    break;
                }
            }
        }
    });
    builder.add(button, FormLayoutUtil.flip(cc.xy(1, 11), colSpec, orientation));

    forcefps = new JCheckBox(Messages.getString("MEncoderVideo.4"));
    forcefps.setContentAreaFilled(false);
    if (configuration.isMencoderForceFps()) {
        forcefps.setSelected(true);
    }
    forcefps.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderForceFps(e.getStateChange() == ItemEvent.SELECTED);
        }
    });

    builder.add(forcefps, FormLayoutUtil.flip(cc.xyw(1, 7, 2), colSpec, orientation));

    yadif = new JCheckBox(Messages.getString("MEncoderVideo.26"));
    yadif.setContentAreaFilled(false);
    if (configuration.isMencoderYadif()) {
        yadif.setSelected(true);
    }
    yadif.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderYadif(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    builder.add(yadif, FormLayoutUtil.flip(cc.xyw(3, 7, 7), colSpec, orientation));

    scaler = new JCheckBox(Messages.getString("MEncoderVideo.27"));
    scaler.setContentAreaFilled(false);
    scaler.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderScaler(e.getStateChange() == ItemEvent.SELECTED);
            scaleX.setEnabled(configuration.isMencoderScaler());
            scaleY.setEnabled(configuration.isMencoderScaler());
        }
    });
    builder.add(scaler, FormLayoutUtil.flip(cc.xyw(3, 5, 7), colSpec, orientation));

    builder.addLabel(Messages.getString("MEncoderVideo.28"), FormLayoutUtil
            .flip(cc.xy(9, 5, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation));
    scaleX = new JTextField("" + configuration.getMencoderScaleX());
    scaleX.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            try {
                configuration.setMencoderScaleX(Integer.parseInt(scaleX.getText()));
            } catch (NumberFormatException nfe) {
                logger.debug("Could not parse scaleX from \"" + scaleX.getText() + "\"");
            }
        }
    });
    builder.add(scaleX, FormLayoutUtil.flip(cc.xy(11, 5), colSpec, orientation));

    builder.addLabel(Messages.getString("MEncoderVideo.30"), FormLayoutUtil
            .flip(cc.xy(13, 5, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation));
    scaleY = new JTextField("" + configuration.getMencoderScaleY());
    scaleY.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            try {
                configuration.setMencoderScaleY(Integer.parseInt(scaleY.getText()));
            } catch (NumberFormatException nfe) {
                logger.debug("Could not parse scaleY from \"" + scaleY.getText() + "\"");
            }
        }
    });
    builder.add(scaleY, FormLayoutUtil.flip(cc.xy(15, 5), colSpec, orientation));

    if (configuration.isMencoderScaler()) {
        scaler.setSelected(true);
    } else {
        scaleX.setEnabled(false);
        scaleY.setEnabled(false);
    }

    builder.addLabel(Messages.getString("MEncoderVideo.6"),
            FormLayoutUtil.flip(cc.xy(1, 13), colSpec, orientation));
    mencoder_custom_options = new JTextField(configuration.getMencoderCustomOptions());
    mencoder_custom_options.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderCustomOptions(mencoder_custom_options.getText());
        }
    });
    builder.add(mencoder_custom_options, FormLayoutUtil.flip(cc.xyw(3, 13, 13), colSpec, orientation));

    builder.addLabel(Messages.getString("MEncoderVideo.93"),
            FormLayoutUtil.flip(cc.xy(1, 15), colSpec, orientation));

    builder.addLabel(Messages.getString("MEncoderVideo.28") + " (%)", FormLayoutUtil
            .flip(cc.xy(1, 15, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation));
    ocw = new JTextField(configuration.getMencoderOverscanCompensationWidth());
    ocw.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderOverscanCompensationWidth(ocw.getText());
        }
    });
    builder.add(ocw, FormLayoutUtil.flip(cc.xy(3, 15), colSpec, orientation));

    builder.addLabel(Messages.getString("MEncoderVideo.30") + " (%)",
            FormLayoutUtil.flip(cc.xy(5, 15), colSpec, orientation));
    och = new JTextField(configuration.getMencoderOverscanCompensationHeight());
    och.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderOverscanCompensationHeight(och.getText());
        }
    });
    builder.add(och, FormLayoutUtil.flip(cc.xy(7, 15), colSpec, orientation));

    cmp = builder.addSeparator(Messages.getString("MEncoderVideo.8"),
            FormLayoutUtil.flip(cc.xyw(1, 17, 15), colSpec, orientation));
    cmp = (JComponent) cmp.getComponent(0);
    cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

    builder.addLabel(Messages.getString("MEncoderVideo.16"), FormLayoutUtil
            .flip(cc.xy(1, 27, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation));

    mencoder_noass_scale = new JTextField(configuration.getMencoderNoAssScale());
    mencoder_noass_scale.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderNoAssScale(mencoder_noass_scale.getText());
        }
    });

    builder.addLabel(Messages.getString("MEncoderVideo.17"),
            FormLayoutUtil.flip(cc.xy(5, 27), colSpec, orientation));

    mencoder_noass_outline = new JTextField(configuration.getMencoderNoAssOutline());
    mencoder_noass_outline.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderNoAssOutline(mencoder_noass_outline.getText());
        }
    });

    builder.addLabel(Messages.getString("MEncoderVideo.18"),
            FormLayoutUtil.flip(cc.xy(9, 27), colSpec, orientation));

    mencoder_noass_blur = new JTextField(configuration.getMencoderNoAssBlur());
    mencoder_noass_blur.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderNoAssBlur(mencoder_noass_blur.getText());
        }
    });

    builder.addLabel(Messages.getString("MEncoderVideo.19"),
            FormLayoutUtil.flip(cc.xy(13, 27), colSpec, orientation));

    mencoder_noass_subpos = new JTextField(configuration.getMencoderNoAssSubPos());
    mencoder_noass_subpos.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderNoAssSubPos(mencoder_noass_subpos.getText());
        }
    });

    builder.add(mencoder_noass_scale, FormLayoutUtil.flip(cc.xy(3, 27), colSpec, orientation));
    builder.add(mencoder_noass_outline, FormLayoutUtil.flip(cc.xy(7, 27), colSpec, orientation));
    builder.add(mencoder_noass_blur, FormLayoutUtil.flip(cc.xy(11, 27), colSpec, orientation));
    builder.add(mencoder_noass_subpos, FormLayoutUtil.flip(cc.xy(15, 27), colSpec, orientation));

    ass = new JCheckBox(Messages.getString("MEncoderVideo.20"));
    ass.setContentAreaFilled(false);
    ass.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e != null) {
                configuration.setMencoderAss(e.getStateChange() == ItemEvent.SELECTED);
            }
        }
    });
    builder.add(ass, FormLayoutUtil.flip(cc.xy(1, 23), colSpec, orientation));
    ass.setSelected(configuration.isMencoderAss());
    ass.getItemListeners()[0].itemStateChanged(null);

    fc = new JCheckBox(Messages.getString("MEncoderVideo.21"));
    fc.setContentAreaFilled(false);
    fc.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderFontConfig(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    builder.add(fc, FormLayoutUtil.flip(cc.xyw(3, 23, 5), colSpec, orientation));
    fc.setSelected(configuration.isMencoderFontConfig());

    assdefaultstyle = new JCheckBox(Messages.getString("MEncoderVideo.36"));
    assdefaultstyle.setContentAreaFilled(false);
    assdefaultstyle.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderAssDefaultStyle(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    builder.add(assdefaultstyle, FormLayoutUtil.flip(cc.xyw(8, 23, 4), colSpec, orientation));
    assdefaultstyle.setSelected(configuration.isMencoderAssDefaultStyle());

    builder.addLabel(Messages.getString("MEncoderVideo.92"),
            FormLayoutUtil.flip(cc.xy(1, 29), colSpec, orientation));
    subq = new JTextField(configuration.getMencoderVobsubSubtitleQuality());
    subq.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderVobsubSubtitleQuality(subq.getText());
        }
    });
    builder.add(subq, FormLayoutUtil.flip(cc.xyw(3, 29, 1), colSpec, orientation));

    configuration.addConfigurationListener(new ConfigurationListener() {
        @Override
        public void configurationChanged(ConfigurationEvent event) {
            if (event.getPropertyName() == null) {
                return;
            }
            if ((!event.isBeforeUpdate())
                    && event.getPropertyName().equals(PmsConfiguration.KEY_DISABLE_SUBTITLES)) {
                boolean enabled = !configuration.isDisableSubtitles();
                ass.setEnabled(enabled);
                assdefaultstyle.setEnabled(enabled);
                fc.setEnabled(enabled);
                mencoder_noass_scale.setEnabled(enabled);
                mencoder_noass_outline.setEnabled(enabled);
                mencoder_noass_blur.setEnabled(enabled);
                mencoder_noass_subpos.setEnabled(enabled);
                ocw.setEnabled(enabled);
                och.setEnabled(enabled);
                subq.setEnabled(enabled);

                if (enabled) {
                    ass.getItemListeners()[0].itemStateChanged(null);
                }
            }
        }
    });

    JPanel panel = builder.getPanel();

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

    return panel;
}