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

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

Introduction

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

Prototype

Alignment RIGHT

To view the source code for com.jgoodies.forms.layout CellConstraints RIGHT.

Click Source Link

Document

Put the component in the right.

Usage

From source file:de.dal33t.powerfolder.ui.widget.FileFilterTextField.java

License:Open Source License

public JPanel getUIComponent() {
    if (panel == null) {
        initComponents();// w ww  .  j  a  v  a2  s.  c o  m
        FormLayout layout = new FormLayout("pref, 1dlu, pref:grow, 15dlu", "pref");
        PanelBuilder builder = new PanelBuilder(layout);
        CellConstraints cc = new CellConstraints();

        builder.add(glassIcon, cc.xy(1, 1));
        builder.add(textField, cc.xy(3, 1));
        builder.add(clearTextJButton, cc.xy(4, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT));
        builder.setBorder(new EtchedBorder());
        panel = builder.getPanel();
        panel.setBackground(Color.white);
    }
    return panel;
}

From source file:de.dal33t.powerfolder.ui.widget.FilterTextField.java

License:Open Source License

public JPanel getUIComponent() {
    if (panel == null) {
        initComponents();/*from  ww  w  . j a v a 2s .  c  om*/
        FormLayout layout = new FormLayout("pref, 1dlu, pref:grow, 15dlu", "pref");
        PanelBuilder builder = new PanelBuilder(layout);
        CellConstraints cc = new CellConstraints();

        builder.add(glassIcon, cc.xy(1, 1));
        builder.add(textField, cc.xy(3, 1));
        builder.add(clearTextJButton, cc.xy(4, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT));
        builder.add(spacerIcon, cc.xy(4, 1));
        builder.setBorder(new EtchedBorder());
        panel = builder.getPanel();
        panel.setBackground(Color.white);
    }
    return panel;
}

From source file:de.luschny.apps.factorial.BenchmarkForm.java

License:Open Source License

@SuppressWarnings("unchecked")
private void initComponents() {
    checkBoxArray = new JCheckBox[21];
    JMenuBar menuBar = new JMenuBar();
    JMenu benchMenu = new JMenu();
    recommededMenu = new JMenuItem();
    JMenuItem parallelMenu = new JMenuItem();
    primeMenu = new JMenuItem();
    simpleMenu = new JMenuItem();
    JMenuItem lameMenu = new JMenuItem();
    JMenu ectMenu = new JMenu();
    sanityMenu = new JMenuItem();
    JMenuItem aboutMenu = new JMenuItem();
    JLabel algoLabel = new JLabel();
    logToFileCheckBox = new JCheckBox();
    showValueCheckBox = new JCheckBox();
    verboseCheckBox = new JCheckBox();
    JLabel startLabel = new JLabel();
    startField = new JTextField();
    JLabel stepLabel = new JLabel();
    stepBox = new JComboBox();
    cancelButton = new JButton();
    JLabel lenghtLabel = new JLabel();
    lenghtSpinner = new JSpinner();
    benchmarkButton = new JButton();
    JPanel algoSelection = new JPanel();
    JScrollPane scrollPane = new JScrollPane();
    textArea = new JTextArea();
    infoLabel = new JLabel();
    progressBar = new JProgressBar();
    CellConstraints cc = new CellConstraints();

    // ======== benchForm ========

    setTitle("Factorial Algorithm Benchmark");
    setFont(new Font("Verdana", Font.BOLD, 16));
    Container benchFormContentPane = getContentPane();
    benchFormContentPane.setLayout(new FormLayout(
            "6dlu, $lcgap, 4dlu, $lcgap, 82dlu, 10dlu, 6dlu, center:46dlu, $lcgap, 42dlu, $lcgap, 18dlu, $lcgap, center:58dlu, 6dlu, left:12dlu",
            "2dlu, $lgap, default, $lgap, top:176dlu, $lgap, default, $lgap, 16dlu, $lgap, 18dlu, $lgap, 16dlu, $lgap, 18dlu, $lgap, 4dlu"));
    ((FormLayout) benchFormContentPane.getLayout()).setRowGroups(new int[][] { { 9, 11, 13 } });

    JCheckBox checkBox = new JCheckBox();

    Font font = benchMenu.getFont().deriveFont(benchMenu.getFont().getStyle() | Font.BOLD,
            benchMenu.getFont().getSize() - 1f);
    Font labelFont = algoLabel.getFont().deriveFont(algoLabel.getFont().getStyle() | Font.BOLD,
            algoLabel.getFont().getSize() - 1f);
    Font checkFont = checkBox.getFont().deriveFont(checkBox.getFont().getStyle() | Font.BOLD,
            checkBox.getFont().getSize() - 1f);
    Font buttonFont = cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() | Font.BOLD);

    // ======== benchMenu ========

    benchMenu.setText("Benchmark");
    benchMenu.setFont(font);//from  w ww  .ja va 2 s . c o  m

    // ---- recommendedMenu ----
    recommededMenu.setText("Recommended");
    recommededMenu.setFont(font);
    recommededMenu.addActionListener((ActionEvent e) -> toptenMenuActionPerformed(e));

    benchMenu.add(recommededMenu);

    // ---- primeMenu ----
    primeMenu.setText("Prime");
    primeMenu.setFont(font);
    primeMenu.addActionListener((ActionEvent e) -> primeMenuActionPerformed(e));

    benchMenu.add(primeMenu);

    // ---- parallelMenu ----
    parallelMenu.setText("Parallel");
    parallelMenu.setFont(font);
    parallelMenu.addActionListener((ActionEvent e) -> parallelMenuActionPerformed(e));

    benchMenu.add(parallelMenu);

    // ---- simpleMenu ----
    simpleMenu.setText("Simple");
    simpleMenu.setFont(font);
    simpleMenu.addActionListener((ActionEvent e) -> simpleMenuActionPerformed(e));

    benchMenu.add(simpleMenu);

    // ---- lameMenu ----
    lameMenu.setText("Lame");
    lameMenu.setFont(font);
    lameMenu.addActionListener((ActionEvent e) -> lameMenuActionPerformed(e));

    benchMenu.add(lameMenu);

    menuBar.add(benchMenu);

    // ======== ectMenu ========
    ectMenu.setText("Ecetera");
    ectMenu.setFont(font);

    // ---- sanityMenu ----
    sanityMenu.setText("Sanity Check");
    sanityMenu.setFont(font);
    sanityMenu.addActionListener((ActionEvent e) -> sanityMenuActionPerformed(e));

    ectMenu.add(sanityMenu);
    ectMenu.addSeparator();

    // ---- aboutMenu ----
    aboutMenu.setText("About");
    aboutMenu.setFont(font);
    aboutMenu.addActionListener((ActionEvent e) -> aboutMenuActionPerformed(e));

    ectMenu.add(aboutMenu);
    menuBar.add(ectMenu);

    setJMenuBar(menuBar);

    // ---- algoLabel ----
    algoLabel.setText("Algorithm");
    algoLabel.setFont(labelFont);
    benchFormContentPane.add(algoLabel, new CellConstraints(5, 3, 1, 1, CellConstraints.DEFAULT,
            CellConstraints.DEFAULT, new Insets(0, 12, 0, 0)));

    // ---- logToFileCheckBox ----
    logToFileCheckBox.setText("Log To File");
    logToFileCheckBox.setFont(checkFont);
    benchFormContentPane.add(logToFileCheckBox, new CellConstraints(8, 3, 3, 1, CellConstraints.LEFT,
            CellConstraints.DEFAULT, new Insets(0, 8, 0, 0)));

    // ---- showValueCheckBox ----
    showValueCheckBox.setText("Show Value");
    showValueCheckBox.setFont(checkFont);
    benchFormContentPane.add(showValueCheckBox,
            cc.xywh(10, 3, 3, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT));

    // ---- verboseCheckBox ----
    verboseCheckBox.setText("Verbose");
    verboseCheckBox.setFont(checkFont);
    benchFormContentPane.add(verboseCheckBox, new CellConstraints(14, 3, 1, 1, CellConstraints.CENTER,
            CellConstraints.DEFAULT, new Insets(0, 4, 0, 0)));

    // ---- startLabel ----
    startLabel.setText("Start");
    startLabel.setFont(labelFont);
    benchFormContentPane.add(startLabel, cc.xywh(8, 9, 1, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT));

    // ---- startField ----
    startField.setToolTipText("Enter start value of n");
    startField.setText("8000");
    benchFormContentPane.add(startField, cc.xy(10, 9));

    // ---- stepLabel ----
    stepLabel.setText("Stepfactor");
    stepLabel.setFont(labelFont);
    benchFormContentPane.add(stepLabel, cc.xywh(8, 11, 1, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT));

    // ---- stepBox ----
    stepBox.setEditable(true);
    DefaultComboBoxModel dcbm = new DefaultComboBoxModel(new String[] { "1.5", "2.0", "2.5", "3.0" });
    stepBox.setModel(dcbm);
    stepBox.setSelectedIndex(1);
    benchFormContentPane.add(stepBox, cc.xy(10, 11));

    // ---- cancelButton ----
    cancelButton.setText("Cancel");
    cancelButton.setEnabled(false);
    cancelButton.setBackground(SystemColor.activeCaption);
    cancelButton.setForeground(SystemColor.window);
    cancelButton.setFont(buttonFont);
    cancelButton.addActionListener((ActionEvent e) -> cancelButtonActionPerformed(e));

    benchFormContentPane.add(cancelButton,
            cc.xywh(14, 11, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT));

    // ---- lenghtLabel ----
    lenghtLabel.setText("Length");
    lenghtLabel.setFont(labelFont);
    benchFormContentPane.add(lenghtLabel, cc.xywh(8, 13, 1, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT));

    // ---- lenghtSpinner ----
    lenghtSpinner.setModel(new SpinnerListModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9" }));
    benchFormContentPane.add(lenghtSpinner, cc.xy(10, 13));

    // ---- benchmarkButton ----
    benchmarkButton.setText("Benchmark!");
    benchmarkButton.setFont(buttonFont);
    benchmarkButton.addActionListener((ActionEvent e) -> benchmarkButtonActionPerformed(e));
    benchFormContentPane.add(benchmarkButton,
            cc.xywh(14, 13, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT));

    // ======== AlgoSelection ========

    algoSelection.setPreferredSize(new Dimension(47, 550));
    algoSelection.setBackground(SystemColor.window);
    algoSelection.setLayout(new FormLayout("left:default:grow", "21*(fill:default)"));

    for (int i = 0; i < checkBoxArray.length; i++) {
        checkBox = new JCheckBox();
        checkBox.setText(FactorialTest.getNames()[i]);
        checkBox.setBackground(SystemColor.window);
        checkBox.setMargin(new Insets(3, 4, 1, 0));
        algoSelection.add(checkBox, cc.xy(1, i + 1));
        checkBox.setFont(checkFont);
        checkBoxArray[i] = checkBox;
    }

    benchFormContentPane.add(algoSelection, cc.xywh(3, 5, 3, 9));

    // ---- textArea ----
    textArea.setLineWrap(true);
    textArea.setEditable(false);
    textArea.setDisabledTextColor(SystemColor.windowText);
    textArea.setBackground(SystemColor.window);
    textArea.setFont(new Font("Courier New", Font.PLAIN, 12));

    // ======== scrollPane ========
    scrollPane.setViewportView(textArea);
    benchFormContentPane.add(scrollPane, cc.xywh(7, 5, 9, 3));

    // ---- infoLabel ----
    infoLabel.setText("(c) 2008 Peter Luschny");
    infoLabel.setFont(labelFont);
    benchFormContentPane.add(infoLabel, cc.xywh(3, 15, 3, 1));
    benchFormContentPane.add(progressBar, cc.xywh(7, 15, 9, 1));
    pack();
    setLocationRelativeTo(getOwner());
}

From source file:demo.MainScreen.java

public void setupCoverFlows(Container container, CellConstraints cc) {
    femaleCoverFlow.setPreferredSize(new Dimension(800, 300));
    femaleCoverFlow.addListener(new ShapeListener() {
        public void shapeClicked(ShapeEvent e) {
            MouseEvent me = e.getMouseEvent();
            if (!me.isConsumed() && me.getButton() == MouseEvent.BUTTON1 && me.getClickCount() == 1) {
                System.out.println(e.getShape());
                //TODO Add some feedback to let them know they actually clicked something
                Picture pic = (Picture) e.getShape();
            }/*from  w ww .j  av a 2  s .co  m*/
        }

        @Override
        public void shapeActivated(ShapeEvent e) {
        }

        @Override
        public void shapeDeactivated(ShapeEvent e) {
        }
    });

    femaleCoverFlow.setPreferredSize(new Dimension(800, 300));
    femaleCoverFlow.addListener(new ShapeListener() {
        public void shapeClicked(ShapeEvent e) {
            MouseEvent me = e.getMouseEvent();
            if (!me.isConsumed() && me.getButton() == MouseEvent.BUTTON1 && me.getClickCount() == 1) {
                Picture pic = (Picture) e.getShape();
                if (pic.isSelected()) {
                    pic.unselect();
                } else {
                    pic.select();
                    System.out.println(e.getShape());
                }
                coverFlow().updateShapes();
            }
        }

        @Override
        public void shapeActivated(ShapeEvent e) {
        }

        @Override
        public void shapeDeactivated(ShapeEvent e) {
        }
    });

    maleCoverFlow.setPreferredSize(new Dimension(800, 300));
    maleCoverFlow.addListener(new ShapeListener() {
        public void shapeClicked(ShapeEvent e) {
            MouseEvent me = e.getMouseEvent();
            if (!me.isConsumed() && me.getButton() == MouseEvent.BUTTON1 && me.getClickCount() == 1) {
                Picture pic = (Picture) e.getShape();
                if (pic.isSelected()) {
                    pic.unselect();
                } else {
                    pic.select();
                    System.out.println(e.getShape());
                }
                coverFlow().updateShapes();
            }
        }

        @Override
        public void shapeActivated(ShapeEvent e) {
        }

        @Override
        public void shapeDeactivated(ShapeEvent e) {
        }
    });

    isMale = true;
    femaleCoverFlow.setVisible(false);
    container.add(femaleCoverFlow, cc.xywh(5, 13, 1, 6, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    container.add(maleCoverFlow, cc.xywh(5, 13, 1, 6, CellConstraints.RIGHT, CellConstraints.DEFAULT));
}

From source file:edu.byu.plugins.editors.dialogs.BYU_ResourceLookup.java

License:Open Source License

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    dialogPane = new JPanel();
    HeaderPanel = new JPanel();
    mainHeaderPanel = new JPanel();
    mainHeaderLabel = new JLabel();
    panel3 = new JPanel();
    subHeaderLabel = new JLabel();
    contentPane = new JPanel();
    label3 = new JLabel();
    label4 = new JLabel();
    scrollPane1 = new JScrollPane();
    lookupTable = new DomainSortableTable(Resources.class, filterField);
    label1 = new JLabel();
    filterField = new JTextField();
    buttonBar = new JPanel();
    select = new JButton();
    linkButton = new JButton();
    createButton = new JButton();
    doneButton = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setModal(true);/*from w ww . ja  v a  2  s.  c  o  m*/
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            thisWindowClosing();
        }
    });
    Container contentPane2 = getContentPane();
    contentPane2.setLayout(new BorderLayout());

    //======== dialogPane ========
    {
        dialogPane.setBorder(null);
        dialogPane.setBackground(new Color(200, 205, 232));
        dialogPane.setLayout(new BorderLayout());

        //======== HeaderPanel ========
        {
            HeaderPanel.setBackground(new Color(80, 69, 57));
            HeaderPanel.setOpaque(false);
            HeaderPanel.setFont(new Font("Trebuchet MS", Font.PLAIN, 13));
            HeaderPanel
                    .setLayout(new FormLayout(
                            new ColumnSpec[] {
                                    new ColumnSpec(
                                            Sizes.bounded(Sizes.MINIMUM, Sizes.dluX(100), Sizes.dluX(200))),
                                    new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) },
                            RowSpec.decodeSpecs("default")));

            //======== mainHeaderPanel ========
            {
                mainHeaderPanel.setBackground(new Color(80, 35, 45));
                mainHeaderPanel.setFont(new Font("Trebuchet MS", Font.PLAIN, 13));
                mainHeaderPanel
                        .setLayout(
                                new FormLayout(
                                        new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC,
                                                new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT,
                                                        FormSpec.DEFAULT_GROW) },
                                        new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC,
                                                FormFactory.DEFAULT_ROWSPEC,
                                                FormFactory.RELATED_GAP_ROWSPEC }));

                //---- mainHeaderLabel ----
                mainHeaderLabel.setText("Main Header");
                mainHeaderLabel.setFont(new Font("Trebuchet MS", Font.PLAIN, 18));
                mainHeaderLabel.setForeground(Color.white);
                mainHeaderPanel.add(mainHeaderLabel, cc.xy(2, 2));
            }
            HeaderPanel.add(mainHeaderPanel, cc.xy(1, 1));

            //======== panel3 ========
            {
                panel3.setBackground(new Color(66, 60, 111));
                panel3.setFont(new Font("Trebuchet MS", Font.PLAIN, 13));
                panel3.setLayout(new FormLayout(
                        new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC,
                                new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                                FormFactory.UNRELATED_GAP_COLSPEC },
                        new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                                FormFactory.RELATED_GAP_ROWSPEC }));

                //---- subHeaderLabel ----
                subHeaderLabel.setText("Lookup Resource");
                subHeaderLabel.setFont(new Font("Trebuchet MS", Font.PLAIN, 18));
                subHeaderLabel.setForeground(Color.white);
                panel3.add(subHeaderLabel, cc.xy(2, 2));
            }
            HeaderPanel.add(panel3, cc.xy(2, 1));
        }
        dialogPane.add(HeaderPanel, BorderLayout.NORTH);

        //======== contentPane ========
        {
            contentPane.setBackground(new Color(231, 188, 251));
            contentPane.setOpaque(false);
            contentPane
                    .setLayout(
                            new FormLayout(
                                    new ColumnSpec[] { FormFactory.UNRELATED_GAP_COLSPEC,
                                            FormFactory.DEFAULT_COLSPEC,
                                            FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                                            new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT,
                                                    FormSpec.DEFAULT_GROW),
                                            FormFactory.UNRELATED_GAP_COLSPEC },
                                    new RowSpec[] { FormFactory.UNRELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                            new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                                            FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                                            FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                                            FormFactory.UNRELATED_GAP_ROWSPEC }));

            //---- label3 ----
            label3.setText("Double click on a Resource to select it.");
            contentPane.add(label3, cc.xywh(2, 2, 3, 1));

            //---- label4 ----
            label4.setText("Or hit enter if a Resource is highlighted.");
            contentPane.add(label4, cc.xywh(2, 4, 3, 1));

            //======== scrollPane1 ========
            {
                scrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

                //---- lookupTable ----
                lookupTable.setPreferredScrollableViewportSize(new Dimension(450, 300));
                lookupTable.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent e) {
                        lookupTableMouseClicked(e);
                    }
                });
                lookupTable.addKeyListener(new KeyAdapter() {
                    @Override
                    public void keyTyped(KeyEvent e) {
                        lookupTableKeyTyped(e);
                    }
                });
                scrollPane1.setViewportView(lookupTable);
            }
            contentPane.add(scrollPane1, cc.xywh(2, 6, 3, 1));

            //---- label1 ----
            label1.setText("Filter:");
            contentPane.add(label1, cc.xy(2, 8));
            contentPane.add(filterField, cc.xy(4, 8));

            //======== buttonBar ========
            {
                buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
                buttonBar.setBackground(new Color(231, 188, 251));
                buttonBar.setOpaque(false);
                buttonBar
                        .setLayout(new FormLayout(
                                new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC,
                                        FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                                        FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.BUTTON_COLSPEC,
                                        FormFactory.RELATED_GAP_COLSPEC, FormFactory.BUTTON_COLSPEC },
                                RowSpec.decodeSpecs("pref")));

                //---- select ----
                select.setText("Select");
                select.setOpaque(false);
                select.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        selectActionPerformed();
                    }
                });
                buttonBar.add(select, cc.xy(1, 1));

                //---- linkButton ----
                linkButton.setText("Link");
                linkButton.setOpaque(false);
                linkButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        linkButtonActionPerformed();
                    }
                });
                buttonBar.add(linkButton, cc.xy(3, 1));

                //---- createButton ----
                createButton.setText("Create Resource");
                createButton.setOpaque(false);
                createButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        createButtonActionPerformed(e);
                    }
                });
                buttonBar.add(createButton, cc.xy(5, 1));

                //---- doneButton ----
                doneButton.setText("Close Window");
                doneButton.setOpaque(false);
                doneButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        doneButtonActionPerformed(e);
                    }
                });
                buttonBar.add(doneButton, cc.xy(7, 1));
            }
            contentPane.add(buttonBar, cc.xywh(2, 10, 3, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT));
        }
        dialogPane.add(contentPane, BorderLayout.CENTER);
    }
    contentPane2.add(dialogPane, BorderLayout.CENTER);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:edu.yale.plugins.tasks.search.BoxLookupReturnScreen.java

License:Open Source License

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    panel2 = new JPanel();
    label2 = new JLabel();
    msNumberField = new JTextField();
    label3 = new JLabel();
    ruNumberField = new JTextField();
    label4 = new JLabel();
    seriesField = new JTextField();
    label5 = new JLabel();
    accessionNumberField = new JTextField();
    label6 = new JLabel();
    boxField = new JTextField();
    searchResults = new JLabel();
    buttonBar2 = new JPanel();
    searchButton = new JButton();
    clearButton = new JButton();
    cancelButton = new JButton();
    scrollPane1 = new JScrollPane();
    results = createReturnTable();//  ww w .j a va 2s  .c om
    panel1 = new JPanel();
    label1 = new JLabel();
    elapsedTime = new JLabel();
    buttonBar = new JPanel();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setModal(true);
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {
        dialogPane.setBorder(Borders.DIALOG_BORDER);
        dialogPane.setPreferredSize(new Dimension(1000, 700));
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {
            contentPanel.setPreferredSize(new Dimension(750, 600));
            contentPanel.setLayout(new FormLayout(ColumnSpec.decodeSpecs("default:grow"),
                    new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(RowSpec.CENTER, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                            FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC }));

            //======== panel2 ========
            {
                panel2.setLayout(new FormLayout(
                        new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                                new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                                new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                                new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                                new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                                FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                                new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) },
                        new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                                FormFactory.DEFAULT_ROWSPEC }));

                //---- label2 ----
                label2.setText("MS #");
                panel2.add(label2, cc.xy(1, 1));
                panel2.add(msNumberField, cc.xy(3, 1));

                //---- label3 ----
                label3.setText("RU #");
                panel2.add(label3, cc.xy(5, 1));
                panel2.add(ruNumberField, cc.xy(7, 1));

                //---- label4 ----
                label4.setText("Series");
                panel2.add(label4, cc.xy(9, 1));
                panel2.add(seriesField, cc.xy(11, 1));

                //---- label5 ----
                label5.setText("Accn");
                panel2.add(label5, cc.xy(13, 1));
                panel2.add(accessionNumberField, cc.xy(15, 1));

                //---- label6 ----
                label6.setText("Box");
                panel2.add(label6, cc.xy(17, 1));
                panel2.add(boxField, cc.xywh(19, 1, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT));
                panel2.add(searchResults, cc.xywh(1, 3, 7, 1));

                //======== buttonBar2 ========
                {
                    buttonBar2.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
                    buttonBar2.setLayout(new FormLayout(
                            new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                                    FormFactory.DEFAULT_COLSPEC, FormFactory.BUTTON_COLSPEC,
                                    FormFactory.RELATED_GAP_COLSPEC, FormFactory.BUTTON_COLSPEC },
                            RowSpec.decodeSpecs("pref")));

                    //---- searchButton ----
                    searchButton.setText("Search");
                    searchButton.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            searchButtonActionPerformed();
                        }
                    });
                    buttonBar2.add(searchButton, cc.xy(2, 1));

                    //---- clearButton ----
                    clearButton.setText("Clear");
                    clearButton.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            clearButtonActionPerformed();
                        }
                    });
                    buttonBar2.add(clearButton, cc.xy(3, 1));

                    //---- cancelButton ----
                    cancelButton.setText("Done");
                    cancelButton.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            cancelButtonActionPerformed();
                        }
                    });
                    buttonBar2.add(cancelButton, cc.xy(5, 1));
                }
                panel2.add(buttonBar2, cc.xywh(11, 3, 9, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT));
            }
            contentPanel.add(panel2, cc.xy(1, 1));

            //======== scrollPane1 ========
            {
                scrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
                scrollPane1.setPreferredSize(new Dimension(750, 450));

                //---- results ----
                results.setPreferredScrollableViewportSize(new Dimension(700, 400));
                scrollPane1.setViewportView(results);
            }
            contentPanel.add(scrollPane1, cc.xywh(1, 3, 1, 1, CellConstraints.FILL, CellConstraints.FILL));

            //======== panel1 ========
            {
                panel1.setLayout(
                        new FormLayout(
                                new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC,
                                        FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC },
                                RowSpec.decodeSpecs("default")));

                //---- label1 ----
                label1.setText("Elapsed Time:");
                panel1.add(label1, cc.xy(1, 1));
                panel1.add(elapsedTime, cc.xy(3, 1));
            }
            contentPanel.add(panel1, cc.xy(1, 5));
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);

        //======== buttonBar ========
        {
            buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
            buttonBar.setLayout(
                    new FormLayout(new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC },
                            RowSpec.decodeSpecs("")));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:imageviewer.ui.dialog.OpenOptionsPanel.java

License:Open Source License

private JPanel createRightPanel() {

    JPanel containerPanel = new JPanel(new BorderLayout(10, 0));

    JLabel localArchiveLabel = new JLabel("Local archive properties", JLabel.LEFT);
    JLabel purgeNowLabel = new JLabel("Verify archive", JLabel.LEFT);
    JLabel updateLabel = new JLabel("Update archive", JLabel.LEFT);
    JLabel archiveDirectoryLabel = new JLabel("Local archive directory", JLabel.LEFT);

    JTextArea purgeDescription = DialogUtil.createTextArea(
            "Verifying the archive allows the system to check that the contents of the archive are valid.  File paths and images "
                    + "are checked against the local hard drive.  Images that cannot be found are removed.  Completing the verify process "
                    + "may take several minutes dependent on the size of your archive, and will occur in the background.");
    JTextArea updateDescription = DialogUtil
            .createTextArea("Specify a directory for immediate updating into the local archive.");
    JTextArea startupDirectoryDescription = DialogUtil.createTextArea(
            "Specify the directory that will be used to update the local archive when imageViewer starts.");

    JSeparator separator1 = new JSeparator();
    separator1.setPreferredSize(new Dimension(225, 5));
    JSeparator separator2 = new JSeparator();
    separator2.setPreferredSize(new Dimension(225, 5));
    JSeparator separator3 = new JSeparator();
    separator3.setPreferredSize(new Dimension(225, 5));
    JSeparator separator4 = new JSeparator();
    separator4.setPreferredSize(new Dimension(225, 5));

    FormLayout fl = new FormLayout("pref,2dlu,22px,2dlu,pref",
            "pref,5px,pref,5px,pref,2px,pref,2px,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref,5px,pref");
    CellConstraints cc = new CellConstraints();

    JPanel archivePropertyPanel = new JPanel(fl);
    archivePropertyPanel.add(localArchiveLabel, cc.xywh(1, 1, 5, 1));
    archivePropertyPanel.add(separator1, cc.xywh(1, 3, 5, 1));
    archivePropertyPanel.add(updateArchiveOnStartCheckBox, cc.xywh(1, 5, 5, 1));
    archivePropertyPanel.add(purgeArchiveOnStartCheckBox, cc.xywh(1, 7, 5, 1));
    archivePropertyPanel.add(allowFindCheckBox, cc.xywh(1, 9, 5, 1));
    archivePropertyPanel.add(purgeNowLabel, cc.xywh(1, 11, 5, 1));
    archivePropertyPanel.add(separator2, cc.xywh(1, 13, 5, 1));
    archivePropertyPanel.add(purgeDescription, cc.xywh(1, 15, 5, 1));
    archivePropertyPanel.add(purgeButton, cc.xywh(1, 17, 5, 1, CellConstraints.RIGHT, CellConstraints.BOTTOM));
    archivePropertyPanel.add(archiveDirectoryLabel, cc.xywh(1, 19, 5, 1));
    archivePropertyPanel.add(separator4, cc.xywh(1, 21, 5, 1));
    archivePropertyPanel.add(startupDirectoryDescription, cc.xywh(1, 23, 5, 1));
    archivePropertyPanel.add(startupDirectory, cc.xy(1, 25));
    archivePropertyPanel.add(selectStartDirButton, cc.xy(3, 25));
    archivePropertyPanel.add(updateLabel, cc.xywh(1, 27, 5, 1));
    archivePropertyPanel.add(separator3, cc.xywh(1, 29, 5, 1));
    archivePropertyPanel.add(updateDescription, cc.xywh(1, 31, 5, 1));
    archivePropertyPanel.add(updateDir, cc.xy(1, 33));
    archivePropertyPanel.add(updateDirButton, cc.xy(3, 33));
    archivePropertyPanel.add(runUpdateButton, cc.xy(5, 33));

    updateDir.setActionCommand("runUpdate");
    updateDir.addActionListener(this);

    containerPanel.add(archivePropertyPanel, BorderLayout.WEST);
    return containerPanel;
}

From source file:jflowmap.ui.ControlPanel.java

License:Apache License

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL/*from  www  . j  a  v  a  2 s .  c o  m*/
 */
private void $$$setupUI$$$() {
    createUIComponents();
    panel1 = new JPanel();
    panel1.setLayout(new BorderLayout(0, 0));
    tabbedPane1 = new JTabbedPane();
    panel1.add(tabbedPane1, BorderLayout.CENTER);
    final JPanel panel2 = new JPanel();
    panel2.setLayout(new FormLayout(
            "fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:187px:noGrow,left:4dlu:noGrow,fill:20px:noGrow,left:4dlu:noGrow,fill:p:noGrow,left:4dlu:noGrow,fill:119px:noGrow,left:20dlu:noGrow,fill:max(d;4px):grow",
            "center:d:noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:min(p;200px):grow"));
    tabbedPane1.addTab("Dataset", panel2);
    panel2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10), null));
    datasetCombo = new JComboBox();
    CellConstraints cc = new CellConstraints();
    panel2.add(datasetCombo, cc.xy(3, 1));
    final JLabel label1 = new JLabel();
    label1.setText("Flow weight attr:");
    panel2.add(label1, cc.xy(1, 1));
    final JSeparator separator1 = new JSeparator();
    separator1.setOrientation(1);
    panel2.add(separator1, cc.xywh(5, 1, 1, 9, CellConstraints.CENTER, CellConstraints.FILL));
    final JLabel label2 = new JLabel();
    label2.setEnabled(false);
    label2.setText("Edge weight field:");
    panel2.add(label2, cc.xy(7, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    comboBox4 = new JComboBox();
    comboBox4.setEnabled(false);
    panel2.add(comboBox4, cc.xy(9, 1));
    final JLabel label3 = new JLabel();
    label3.setEnabled(false);
    label3.setText("Node label field:");
    panel2.add(label3, cc.xy(7, 3, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    comboBox6 = new JComboBox();
    comboBox6.setEnabled(false);
    panel2.add(comboBox6, cc.xy(9, 3));
    final JSeparator separator2 = new JSeparator();
    separator2.setOrientation(1);
    panel2.add(separator2, cc.xywh(10, 1, 1, 9, CellConstraints.CENTER, CellConstraints.FILL));
    final JTabbedPane tabbedPane3 = new JTabbedPane();
    tabbedPane3.setTabPlacement(3);
    panel2.add(tabbedPane3, cc.xywh(11, 1, 1, 9, CellConstraints.DEFAULT, CellConstraints.FILL));
    final JScrollPane scrollPane1 = new JScrollPane();
    tabbedPane3.addTab("Flows", scrollPane1);
    scrollPane1.setBorder(BorderFactory.createTitledBorder(""));
    flowsTable.setPreferredScrollableViewportSize(new Dimension(450, 100));
    scrollPane1.setViewportView(flowsTable);
    final JLabel label4 = new JLabel();
    label4.setEnabled(false);
    label4.setText("Node X coord field:");
    panel2.add(label4, cc.xy(7, 5, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    comboBox2 = new JComboBox();
    comboBox2.setEnabled(false);
    panel2.add(comboBox2, cc.xy(9, 5));
    final JLabel label5 = new JLabel();
    label5.setEnabled(false);
    label5.setText("Node Y coord field:");
    panel2.add(label5, cc.xy(7, 7, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    comboBox3 = new JComboBox();
    comboBox3.setEnabled(false);
    panel2.add(comboBox3, cc.xy(9, 7));
    final JPanel panel3 = new JPanel();
    panel3.setLayout(new FormLayout(
            "right:max(d;4px):noGrow,left:4dlu:noGrow,fill:d:grow(2.0),left:4dlu:noGrow,fill:p:noGrow,left:4dlu:noGrow,fill:20px:noGrow,left:4dlu:noGrow,right:max(d;4px):noGrow,left:4dlu:noGrow,fill:d:grow,left:4dlu:noGrow,fill:p:noGrow",
            "center:26px:noGrow,top:4dlu:noGrow,center:24px:noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:5dlu:noGrow,center:d:noGrow"));
    tabbedPane1.addTab("Filter", panel3);
    panel3.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10), null));
    minWeightFilterSpinner = new JSpinner();
    panel3.add(minWeightFilterSpinner, cc.xy(5, 1, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JSeparator separator3 = new JSeparator();
    separator3.setOrientation(1);
    panel3.add(separator3, cc.xywh(7, 1, 1, 5, CellConstraints.CENTER, CellConstraints.FILL));
    final JLabel label6 = new JLabel();
    label6.setText("Min length:");
    panel3.add(label6, cc.xy(9, 1));
    minLengthFilterSlider = new JSlider();
    panel3.add(minLengthFilterSlider, cc.xy(11, 1, CellConstraints.FILL, CellConstraints.DEFAULT));
    minLengthFilterSpinner = new JSpinner();
    panel3.add(minLengthFilterSpinner, cc.xy(13, 1, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JLabel label7 = new JLabel();
    label7.setText("Max edge weight:");
    panel3.add(label7, cc.xy(1, 3));
    maxWeightFilterSlider = new JSlider();
    panel3.add(maxWeightFilterSlider, cc.xy(3, 3, CellConstraints.FILL, CellConstraints.CENTER));
    maxWeightFilterSpinner = new JSpinner();
    panel3.add(maxWeightFilterSpinner, cc.xy(5, 3, CellConstraints.FILL, CellConstraints.DEFAULT));
    autoAdjustColorScaleCheckBox = new JCheckBox();
    autoAdjustColorScaleCheckBox.setEnabled(false);
    autoAdjustColorScaleCheckBox.setText("Auto adjust color scale");
    panel3.add(autoAdjustColorScaleCheckBox, cc.xyw(3, 5, 3));
    final JLabel label8 = new JLabel();
    label8.setText("Max length:");
    panel3.add(label8, cc.xy(9, 3));
    maxLengthFilterSlider = new JSlider();
    panel3.add(maxLengthFilterSlider, cc.xy(11, 3, CellConstraints.FILL, CellConstraints.DEFAULT));
    maxLengthFilterSpinner = new JSpinner();
    panel3.add(maxLengthFilterSpinner, cc.xy(13, 3, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JPanel panel4 = new JPanel();
    panel4.setLayout(new FormLayout("fill:d:grow", "center:d:grow"));
    panel3.add(panel4, cc.xy(5, 7));
    final JLabel label9 = new JLabel();
    label9.setText("Min edge weight:");
    panel3.add(label9, cc.xy(1, 1));
    minWeightFilterSlider = new JSlider();
    panel3.add(minWeightFilterSlider, cc.xy(3, 1, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JPanel panel5 = new JPanel();
    panel5.setLayout(new FormLayout(
            "fill:d:noGrow,left:p:noGrow,fill:20px:noGrow,left:4dlu:noGrow,fill:p:noGrow,left:20dlu:noGrow,fill:max(d;4px):grow",
            "center:max(d;4px):noGrow,top:4dlu:noGrow,center:24px:noGrow,top:6dlu:noGrow,top:4dlu:noGrow"));
    tabbedPane1.addTab("Scales", panel5);
    panel5.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10), null));
    final JSeparator separator4 = new JSeparator();
    separator4.setOrientation(1);
    panel5.add(separator4, cc.xywh(3, 1, 1, 5, CellConstraints.CENTER, CellConstraints.FILL));
    useLogWidthScaleCheckbox = new JCheckBox();
    useLogWidthScaleCheckbox.setEnabled(true);
    useLogWidthScaleCheckbox.setText("Use log width scale");
    panel5.add(useLogWidthScaleCheckbox, cc.xy(2, 1));
    useLogColorScaleCheckbox = new JCheckBox();
    useLogColorScaleCheckbox.setEnabled(true);
    useLogColorScaleCheckbox.setText("Use log color scale");
    panel5.add(useLogColorScaleCheckbox, cc.xyw(1, 3, 2));
    mapEdgeValueToCheckBox = new JCheckBox();
    mapEdgeValueToCheckBox.setEnabled(false);
    mapEdgeValueToCheckBox.setText("Map edge value to color");
    panel5.add(mapEdgeValueToCheckBox, cc.xy(5, 1));
    mapEdgeValueToCheckBox1 = new JCheckBox();
    mapEdgeValueToCheckBox1.setEnabled(false);
    mapEdgeValueToCheckBox1.setText("Map edge value to width");
    panel5.add(mapEdgeValueToCheckBox1, cc.xy(5, 3));
    final JSeparator separator5 = new JSeparator();
    separator5.setOrientation(1);
    panel5.add(separator5, cc.xywh(6, 1, 1, 5, CellConstraints.CENTER, CellConstraints.FILL));
    final JPanel panel6 = new JPanel();
    panel6.setLayout(new FormLayout(
            "fill:d:noGrow,left:4dlu:noGrow,fill:110px:noGrow,left:4dlu:noGrow,fill:20px:noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,fill:20px:noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):grow,left:4dlu:noGrow,fill:max(m;50px):noGrow",
            "center:d:noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow"));
    tabbedPane1.addTab("Aesthetics", panel6);
    panel6.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10), null));
    final JLabel label10 = new JLabel();
    label10.setEnabled(true);
    label10.setText("Color scheme:");
    panel6.add(label10, cc.xy(1, 1));
    colorSchemeCombo = new JComboBox();
    colorSchemeCombo.setEnabled(true);
    panel6.add(colorSchemeCombo, cc.xy(3, 1));
    final JSeparator separator6 = new JSeparator();
    separator6.setOrientation(1);
    panel6.add(separator6, cc.xywh(5, 1, 1, 7, CellConstraints.CENTER, CellConstraints.FILL));
    final JLabel label11 = new JLabel();
    label11.setText("Edge width:");
    panel6.add(label11, cc.xy(10, 1, CellConstraints.RIGHT, CellConstraints.CENTER));
    maxEdgeWidthSlider = new JSlider();
    maxEdgeWidthSlider.setPaintLabels(false);
    maxEdgeWidthSlider.setPaintTicks(false);
    maxEdgeWidthSlider.setPaintTrack(true);
    panel6.add(maxEdgeWidthSlider, cc.xy(12, 1, CellConstraints.FILL, CellConstraints.DEFAULT));
    maxEdgeWidthSpinner = new JSpinner();
    panel6.add(maxEdgeWidthSpinner, cc.xy(14, 1, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JLabel label12 = new JLabel();
    label12.setText("Edge opacity:");
    panel6.add(label12, cc.xy(10, 3, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    edgeOpacitySlider = new JSlider();
    panel6.add(edgeOpacitySlider, cc.xy(12, 3, CellConstraints.FILL, CellConstraints.DEFAULT));
    edgeOpacitySpinner = new JSpinner();
    panel6.add(edgeOpacitySpinner, cc.xy(14, 3, CellConstraints.FILL, CellConstraints.DEFAULT));
    showNodesCheckBox = new JCheckBox();
    showNodesCheckBox.setText("Show nodes");
    panel6.add(showNodesCheckBox, cc.xy(7, 1));
    final JSeparator separator7 = new JSeparator();
    separator7.setOrientation(1);
    panel6.add(separator7, cc.xywh(8, 1, 1, 7, CellConstraints.CENTER, CellConstraints.FILL));
    showDirectionMarkersCheckBox = new JCheckBox();
    showDirectionMarkersCheckBox.setText("Show direction markers");
    panel6.add(showDirectionMarkersCheckBox, cc.xy(7, 5));
    fillEdgesWithGradientCheckBox = new JCheckBox();
    fillEdgesWithGradientCheckBox.setText("Fill edges with gradient");
    panel6.add(fillEdgesWithGradientCheckBox, cc.xy(7, 3));
    proportionalDirectionMarkersCheckBox = new JCheckBox();
    proportionalDirectionMarkersCheckBox.setText("Proportional direction markers");
    panel6.add(proportionalDirectionMarkersCheckBox, cc.xy(7, 7));
    edgeMarkerSizeSpinner = new JSpinner();
    panel6.add(edgeMarkerSizeSpinner, cc.xy(14, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
    edgeMarkerSizeSlider = new JSlider();
    panel6.add(edgeMarkerSizeSlider, cc.xy(12, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
    edgeMarkerOpacitySpinner = new JSpinner();
    panel6.add(edgeMarkerOpacitySpinner, cc.xy(14, 7, CellConstraints.FILL, CellConstraints.DEFAULT));
    edgeMarkerOpacitySlider = new JSlider();
    panel6.add(edgeMarkerOpacitySlider, cc.xy(12, 7, CellConstraints.FILL, CellConstraints.DEFAULT));
    edgeMarkerSizeLabel = new JLabel();
    edgeMarkerSizeLabel.setText("Direction marker size:");
    panel6.add(edgeMarkerSizeLabel, cc.xy(10, 5, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    edgeMarkerOpacityLabel = new JLabel();
    edgeMarkerOpacityLabel.setText("Direction marker opacity:");
    panel6.add(edgeMarkerOpacityLabel, cc.xy(10, 7, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    final JPanel panel7 = new JPanel();
    panel7.setLayout(new FormLayout(
            "fill:d:noGrow,left:6dlu:noGrow,fill:p:noGrow,left:4dlu:noGrow,fill:p:noGrow,left:4dlu:noGrow,fill:p:noGrow,left:4dlu:noGrow,fill:12px:noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:p:noGrow,left:12dlu:noGrow,fill:p:noGrow,fill:d:noGrow,left:d:noGrow",
            "center:max(d;4px):noGrow,top:4dlu:noGrow,center:25px:noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:d:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow"));
    tabbedPane1.addTab("Edge bundling", panel7);
    panel7.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10), null));
    final JSeparator separator8 = new JSeparator();
    separator8.setOrientation(1);
    panel7.add(separator8, cc.xywh(9, 1, 1, 8, CellConstraints.CENTER, CellConstraints.FILL));
    final JLabel label13 = new JLabel();
    label13.setHorizontalAlignment(4);
    label13.setText("Step damping factor:");
    panel7.add(label13, cc.xy(11, 3));
    stepDampingFactorSpinner = new JSpinner();
    panel7.add(stepDampingFactorSpinner, cc.xy(13, 3, CellConstraints.FILL, CellConstraints.DEFAULT));
    stepSizeSpinner = new JSpinner();
    panel7.add(stepSizeSpinner, cc.xy(13, 1, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JLabel label14 = new JLabel();
    label14.setHorizontalAlignment(4);
    label14.setText("Step size (S):");
    panel7.add(label14, cc.xy(11, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    final JLabel label15 = new JLabel();
    label15.setHorizontalAlignment(4);
    label15.setText("Edge stiffness (K):");
    panel7.add(label15, cc.xy(5, 3, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    edgeStiffnessSpinner = new JSpinner();
    panel7.add(edgeStiffnessSpinner, cc.xy(7, 3, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JSeparator separator9 = new JSeparator();
    separator9.setOrientation(1);
    panel7.add(separator9, cc.xywh(14, 1, 1, 8, CellConstraints.CENTER, CellConstraints.FILL));
    final JLabel label16 = new JLabel();
    label16.setHorizontalAlignment(4);
    label16.setText("Number of cycles:");
    panel7.add(label16, cc.xy(5, 1));
    numberOfCyclesSpinner = new JSpinner();
    panel7.add(numberOfCyclesSpinner, cc.xy(7, 1, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JLabel label17 = new JLabel();
    label17.setHorizontalAlignment(4);
    label17.setText("Compatibility threshold:");
    panel7.add(label17, cc.xy(5, 5));
    edgeCompatibilityThresholdSpinner = new JSpinner();
    panel7.add(edgeCompatibilityThresholdSpinner, cc.xy(7, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JLabel label18 = new JLabel();
    label18.setHorizontalAlignment(4);
    label18.setText("Steps in 1st cycle (I):");
    panel7.add(label18, cc.xy(11, 5));
    stepsInCycleSpinner = new JSpinner();
    panel7.add(stepsInCycleSpinner, cc.xy(13, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
    bundleButton = new JButton();
    bundleButton.setText("Bundle");
    panel7.add(bundleButton, cc.xy(1, 1));
    resetBundlingButton = new JButton();
    resetBundlingButton.setText("Reset");
    panel7.add(resetBundlingButton, cc.xy(1, 3));
    defaultValuesButton = new JButton();
    defaultValuesButton.setText("Default Values");
    panel7.add(defaultValuesButton, cc.xy(1, 5));
    final JSeparator separator10 = new JSeparator();
    separator10.setOrientation(1);
    panel7.add(separator10, cc.xywh(3, 1, 1, 8, CellConstraints.CENTER, CellConstraints.FILL));
    repulsiveEdgesCheckBox = new JCheckBox();
    repulsiveEdgesCheckBox.setText("Repulsion:");
    panel7.add(repulsiveEdgesCheckBox, cc.xy(5, 8, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    repulsionSpinner = new JSpinner();
    panel7.add(repulsionSpinner, cc.xy(7, 8, CellConstraints.FILL, CellConstraints.DEFAULT));
    inverseQuadraticModelCheckBox = new JCheckBox();
    inverseQuadraticModelCheckBox.setText("Inverse-quadratic model");
    panel7.add(inverseQuadraticModelCheckBox, cc.xyw(11, 8, 3, CellConstraints.LEFT, CellConstraints.DEFAULT));
    final JSeparator separator11 = new JSeparator();
    panel7.add(separator11, cc.xyw(1, 7, 2, CellConstraints.FILL, CellConstraints.FILL));
    aggregateEdgesButton = new JButton();
    aggregateEdgesButton.setText("Aggregate edges");
    panel7.add(aggregateEdgesButton, cc.xy(1, 8));
    directionAffectsCompatibilityCheckBox = new JCheckBox();
    directionAffectsCompatibilityCheckBox.setText("Direction affects compatibility");
    panel7.add(directionAffectsCompatibilityCheckBox,
            cc.xy(17, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
    edgeValueAffectsAttractionCheckBox = new JCheckBox();
    edgeValueAffectsAttractionCheckBox.setText("Edge value affects attraction");
    panel7.add(edgeValueAffectsAttractionCheckBox, cc.xy(17, 3));
    simpleCompatibilityMeasureCheckBox = new JCheckBox();
    simpleCompatibilityMeasureCheckBox.setText("Simple compatibility measure");
    panel7.add(simpleCompatibilityMeasureCheckBox, cc.xy(17, 5, CellConstraints.LEFT, CellConstraints.DEFAULT));
    binaryCompatibilityCheckBox = new JCheckBox();
    binaryCompatibilityCheckBox.setText("Binary compatibility");
    panel7.add(binaryCompatibilityCheckBox, cc.xy(17, 8, CellConstraints.LEFT, CellConstraints.DEFAULT));
    final JPanel panel8 = new JPanel();
    panel8.setLayout(new FormLayout(
            "fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:20px:noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:d:noGrow,left:4dlu:noGrow,fill:max(d;4px):grow,left:4dlu:noGrow,fill:max(p;75px):noGrow,left:10dlu:noGrow,fill:1px:noGrow,left:10dlu:noGrow,fill:max(p;200px):noGrow",
            "center:max(p;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:m:noGrow,top:d:noGrow,center:max(d;6px):noGrow,center:d:noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:min(p;200px):grow"));
    tabbedPane1.addTab("Node clustering", panel8);
    panel8.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10), null));
    panel8.add(distanceMeasureCombo, cc.xyw(7, 1, 5, CellConstraints.LEFT, CellConstraints.DEFAULT));
    final JLabel label19 = new JLabel();
    label19.setText("Distance measure:");
    panel8.add(label19, cc.xy(5, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    tabbedPane2 = new JTabbedPane();
    tabbedPane2.setTabPlacement(3);
    panel8.add(tabbedPane2, cc.xywh(15, 1, 1, 14, CellConstraints.DEFAULT, CellConstraints.FILL));
    final JPanel panel9 = new JPanel();
    panel9.setLayout(new FormLayout("fill:d:grow", "center:d:grow"));
    tabbedPane2.addTab("Clusters", panel9);
    final JScrollPane scrollPane2 = new JScrollPane();
    panel9.add(scrollPane2, cc.xy(1, 1, CellConstraints.DEFAULT, CellConstraints.FILL));
    scrollPane2.setBorder(BorderFactory.createTitledBorder(""));
    clustersTable.setPreferredScrollableViewportSize(new Dimension(450, 100));
    scrollPane2.setViewportView(clustersTable);
    final JScrollPane scrollPane3 = new JScrollPane();
    tabbedPane2.addTab("Nodes", scrollPane3);
    scrollPane3.setBorder(BorderFactory.createTitledBorder(""));
    clusterNodesTable.setPreferredScrollableViewportSize(new Dimension(450, 100));
    scrollPane3.setViewportView(clusterNodesTable);
    final JScrollPane scrollPane4 = new JScrollPane();
    tabbedPane2.addTab("Distances", scrollPane4);
    scrollPane4.setBorder(BorderFactory.createTitledBorder(""));
    clusterDistancesTable.setPreferredScrollableViewportSize(new Dimension(450, 100));
    scrollPane4.setViewportView(clusterDistancesTable);
    final JSeparator separator12 = new JSeparator();
    separator12.setOrientation(1);
    panel8.add(separator12, cc.xywh(13, 1, 1, 14, CellConstraints.CENTER, CellConstraints.FILL));
    final JLabel label20 = new JLabel();
    label20.setText("Linkage:");
    panel8.add(label20, cc.xy(5, 3, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    panel8.add(linkageComboBox, cc.xy(7, 3, CellConstraints.LEFT, CellConstraints.DEFAULT));
    maxClusterDistanceSlider = new JSlider();
    maxClusterDistanceSlider.setEnabled(false);
    panel8.add(maxClusterDistanceSlider, cc.xyw(6, 8, 4, CellConstraints.FILL, CellConstraints.DEFAULT));
    euclideanMaxClusterDistanceSlider = new JSlider();
    euclideanMaxClusterDistanceSlider.setEnabled(false);
    panel8.add(euclideanMaxClusterDistanceSlider,
            cc.xyw(6, 10, 4, CellConstraints.FILL, CellConstraints.DEFAULT));
    maxClusterDistanceSpinner = new JSpinner();
    maxClusterDistanceSpinner.setEnabled(false);
    panel8.add(maxClusterDistanceSpinner, cc.xy(11, 8, CellConstraints.FILL, CellConstraints.DEFAULT));
    euclideanMaxClusterDistanceSpinner = new JSpinner();
    euclideanMaxClusterDistanceSpinner.setEnabled(false);
    panel8.add(euclideanMaxClusterDistanceSpinner,
            cc.xy(11, 10, CellConstraints.FILL, CellConstraints.DEFAULT));
    euclideanMaxClusterDistanceLabel = new JLabel();
    euclideanMaxClusterDistanceLabel.setEnabled(false);
    euclideanMaxClusterDistanceLabel.setText("Euclidean max cluster distance:");
    panel8.add(euclideanMaxClusterDistanceLabel, cc.xy(5, 10, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    maxClusterDistanceLabel = new JLabel();
    maxClusterDistanceLabel.setEnabled(false);
    maxClusterDistanceLabel.setText("Max cluster distance:");
    panel8.add(maxClusterDistanceLabel, cc.xy(5, 8, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    final JSeparator separator13 = new JSeparator();
    separator13.setOrientation(1);
    panel8.add(separator13, cc.xywh(3, 1, 1, 4, CellConstraints.FILL, CellConstraints.FILL));
    clusterButton = new JButton();
    clusterButton.setText("Cluster");
    panel8.add(clusterButton, cc.xy(1, 1));
    final JSeparator separator14 = new JSeparator();
    panel8.add(separator14, cc.xyw(1, 5, 12, CellConstraints.FILL, CellConstraints.FILL));
    numberOfClustersLabel = new JLabel();
    numberOfClustersLabel.setEnabled(false);
    numberOfClustersLabel.setText("Number of clusters:");
    panel8.add(numberOfClustersLabel, cc.xy(5, 12, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    numberOfClustersValueLabel = new JLabel();
    numberOfClustersValueLabel.setText("");
    panel8.add(numberOfClustersValueLabel, cc.xy(7, 12));
    joinClusterEdgesButton = new JButton();
    joinClusterEdgesButton.setEnabled(true);
    joinClusterEdgesButton.setText("Join edges");
    panel8.add(joinClusterEdgesButton, cc.xy(1, 8));
    resetClustersButton = new JButton();
    resetClustersButton.setEnabled(true);
    resetClustersButton.setText("Reset");
    panel8.add(resetClustersButton, cc.xy(1, 3));
    resetJoinedEdgesButton = new JButton();
    resetJoinedEdgesButton.setText("Reset");
    panel8.add(resetJoinedEdgesButton, cc.xy(1, 10));
    final JSeparator separator15 = new JSeparator();
    separator15.setOrientation(1);
    panel8.add(separator15, cc.xywh(3, 7, 1, 7, CellConstraints.FILL, CellConstraints.FILL));
    combineWithEuclideanClustersCheckBox = new JCheckBox();
    combineWithEuclideanClustersCheckBox.setEnabled(true);
    combineWithEuclideanClustersCheckBox.setSelected(false);
    combineWithEuclideanClustersCheckBox.setText("Combine with Euclidean clusters");
    panel8.add(combineWithEuclideanClustersCheckBox, cc.xyw(9, 3, 3));
}

From source file:loci.visbio.data.SpectralWidget.java

License:Open Source License

/** Creates a new spectral mapping widget with weighted sliders. */
public SpectralWidget(final SpectralTransform mapping, final String[] text) {
    super();/*from   w  ww.  ja va 2  s.  com*/
    this.mapping = mapping;

    // create sliders, labels and auto-set buttons
    final RealType[] range = ((ImageTransform) mapping.getParent()).getRangeTypes();
    final int in = range.length;
    final int out = mapping.getRangeCount();
    weights = new JSlider[out][in];
    labels = new JLabel[out][in];

    final Hashtable labelHash = new Hashtable();
    labelHash.put(new Integer(-PRECISION), new JLabel("-1"));
    labelHash.put(new Integer(0), new JLabel("0"));
    labelHash.put(new Integer(PRECISION), new JLabel("1"));

    final JButton[] negOnes = new JButton[out];
    final JButton[] zeroes = new JButton[out];
    final JButton[] ones = new JButton[out];

    final double[][] w = mapping.getWeights();

    for (int o = 0; o < out; o++) {
        for (int i = 0; i < in; i++) {
            final int value = (int) (PRECISION * w[o][i]);
            final JSlider s = new JSlider(-PRECISION, PRECISION, value);
            if (i == in - 1) {
                s.setMajorTickSpacing(PRECISION);
                s.setMinorTickSpacing(PRECISION / 10);
                s.setLabelTable(labelHash);
                s.setPaintTicks(true);
                s.setPaintLabels(true);
            }

            final JLabel l = new JLabel(shortString(value));
            s.addChangeListener(new ChangeListener() {

                @Override
                public void stateChanged(final ChangeEvent e) {
                    l.setText(shortString(((JSlider) e.getSource()).getValue()));
                }
            });

            weights[o][i] = s;
            labels[o][i] = l;
        }

        negOnes[o] = new JButton("-1");
        negOnes[o].setActionCommand("-1:" + o);
        negOnes[o].addActionListener(this);

        zeroes[o] = new JButton("0");
        zeroes[o].setActionCommand("0:" + o);
        zeroes[o].addActionListener(this);

        ones[o] = new JButton("1");
        ones[o].setActionCommand("1:" + o);
        ones[o].addActionListener(this);
    }

    // apply button
    final JButton apply = new JButton("Apply");
    if (!LAFUtil.isMacLookAndFeel())
        apply.setMnemonic('a');
    apply.setActionCommand("apply");
    apply.addActionListener(this);

    // lay out components
    final String s = "pref, 3dlu:grow, pref, 3dlu:grow, pref";
    final StringBuffer cols = new StringBuffer("pref, 3dlu, " + s + ", 3dlu, pref");
    for (int o = 1; o < out; o++) {
        cols.append(", 9dlu, " + s + ", 3dlu, pref");
    }

    final StringBuffer rows = new StringBuffer("pref, 3dlu, pref");
    for (int i = 1; i < in; i++)
        rows.append(", 3dlu, pref");
    rows.append(", 3dlu, pref, 5dlu, pref");

    final PanelBuilder builder = new PanelBuilder(new FormLayout(cols.toString(), rows.toString()));
    final CellConstraints cc = new CellConstraints();

    for (int i = 0; i < in; i++) {
        final int row = 2 * i + 3;
        builder.addLabel(range[i].getName(), cc.xy(1, row, CellConstraints.RIGHT, CellConstraints.TOP));
    }

    for (int o = 0; o < out; o++) {
        final int col = 8 * o + 3;
        builder.addLabel(text[o], cc.xyw(col, 1, 5, CellConstraints.CENTER, CellConstraints.DEFAULT));
        for (int i = 0; i < in; i++) {
            final int row = 2 * i + 3;
            builder.add(weights[o][i], cc.xyw(col, row, 5));
            builder.add(labels[o][i], cc.xy(col + 6, row, CellConstraints.DEFAULT, CellConstraints.TOP));
        }

        final int row = 2 * in + 3;
        builder.add(negOnes[o], cc.xy(col, row));
        builder.add(zeroes[o], cc.xy(col + 2, row));
        builder.add(ones[o], cc.xy(col + 4, row));
    }

    builder.add(ButtonBarFactory.buildCenteredBar(apply), cc.xyw(1, 2 * in + 5, 8 * out + 1));

    setLayout(new BorderLayout());
    add(builder.getPanel());
}

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

License:Open Source License

@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);

    CellConstraints cc = new CellConstraints();

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

    if (configuration.getSkipLoopFilterEnabled()) {
        checkBox.setSelected(true);/*w w  w  .j a va  2 s .co m*/
    }

    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;
}