Example usage for java.awt FlowLayout RIGHT

List of usage examples for java.awt FlowLayout RIGHT

Introduction

In this page you can find the example usage for java.awt FlowLayout RIGHT.

Prototype

int RIGHT

To view the source code for java.awt FlowLayout RIGHT.

Click Source Link

Document

This value indicates that each row of components should be right-justified.

Usage

From source file:com.emental.mindraider.ui.dialogs.AttachmentJDialog.java

/**
 * Concetructor./*www.j a  v  a 2  s  .  c  o m*/
 * 
 * @param noteResource
 *            The concept resource.
 * @param dragAndDropReference
 *            The drag'n'drop reference.
 */
public AttachmentJDialog(ConceptResource conceptResource, DragAndDropReference dragAndDropReference) {

    super(Messages.getString("AttachmentJDialog.title"));
    this.conceptResource = conceptResource;
    getContentPane().setLayout(new BorderLayout());
    JPanel p, pp;

    p = new JPanel();
    p.setLayout(new BorderLayout());
    JLabel intro = new JLabel("<html>&nbsp;&nbsp;" + Messages.getString("AttachmentJDialog.introduction")
            + "&nbsp;&nbsp;<br><br></html>");
    p.add(intro, BorderLayout.NORTH);
    p.add(new JLabel("<html>&nbsp;&nbsp;" + Messages.getString("AttachmentJDialog.description") + "</html>"),
            BorderLayout.CENTER);
    description = new JTextField(38);
    pp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    pp.add(description);
    p.add(pp, BorderLayout.SOUTH);
    getContentPane().add(p, BorderLayout.NORTH);

    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    mainPanel.setBorder(new TitledBorder(Messages.getString("AttachmentJDialog.resource")));

    ButtonGroup attachType = new ButtonGroup();

    JPanel webPanel = new JPanel();
    webPanel.setLayout(new BorderLayout());
    webType = new JRadioButton(Messages.getString("AttachmentJDialog.web"));
    webType.setActionCommand(WEB);
    webType.addActionListener(this);
    webType.setSelected(true);
    attachType.add(webType);
    webPanel.add(webType, BorderLayout.NORTH);
    urlTextField = new JTextField("http://", 35);
    urlTextField.selectAll();
    urlTextField.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent keyEvent) {
            if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) {
                attach();
            }
        }

        public void keyReleased(KeyEvent keyEvent) {
        }

        public void keyTyped(KeyEvent keyEvent) {
        }
    });
    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.LEFT));
    p.add(new JLabel("   "));
    p.add(urlTextField);
    webPanel.add(p, BorderLayout.SOUTH);
    mainPanel.add(webPanel, BorderLayout.NORTH);

    JPanel localPanel = new JPanel();
    localPanel.setLayout(new BorderLayout());
    JRadioButton localType = new JRadioButton(Messages.getString("AttachmentJDialog.local"));
    localType.setActionCommand(LOCAL);
    localType.addActionListener(this);
    localPanel.add(localType, BorderLayout.NORTH);
    pathTextField = new JTextField(35);
    pathTextField.setEnabled(false);
    browseButton = new JButton(Messages.getString("AttachmentJDialog.browse"));
    browseButton.setToolTipText(Messages.getString("AttachmentJDialog.browseTip"));
    browseButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            JFileChooser fc = new JFileChooser();
            fc.setApproveButtonText(Messages.getString("AttachmentJDialog.attach"));
            fc.setControlButtonsAreShown(true);
            fc.setDialogTitle(Messages.getString("AttachmentJDialog.chooseAttachment"));
            fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
            int returnVal = fc.showOpenDialog(AttachmentJDialog.this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                pathTextField.setText(file.toString());
            }
        }
    });
    browseButton.setEnabled(false);
    pp = new JPanel();
    pp.setLayout(new BorderLayout());
    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.LEFT));
    p.add(new JLabel("   "));
    pp.add(p, BorderLayout.NORTH);
    p.add(pathTextField);
    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.RIGHT));
    p.add(browseButton);
    pp.add(p, BorderLayout.SOUTH);
    localPanel.add(pp, BorderLayout.SOUTH);
    attachType.add(localType);
    mainPanel.add(localPanel, BorderLayout.SOUTH);

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

    // buttons
    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.CENTER));
    JButton addButton = new JButton(Messages.getString("AttachmentJDialog.attach"));

    p.add(addButton);
    addButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            attach();
        }
    });
    JButton cancelButton = new JButton(Messages.getString("AttachmentJDialog.cancel"));
    p.add(cancelButton);
    cancelButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            AttachmentJDialog.this.dispose();
        }
    });
    getContentPane().add(p, BorderLayout.SOUTH);

    /*
     * drag and drop initialization
     */
    if (dragAndDropReference != null) {
        if (dragAndDropReference.getType() == DragAndDropReference.BROWSER_LINK) {
            urlTextField.setText(dragAndDropReference.getReference());
            localType.setSelected(false);
            webType.setSelected(true);
            enableWebTypeButtons();
        } else {
            pathTextField.setText(dragAndDropReference.getReference());
            localType.setSelected(true);
            webType.setSelected(false);
            enableLocalTypeButtons();
        }
        description.setText(dragAndDropReference.getTitle());
    }

    pack();
    Gfx.centerAndShowWindow(this);
}

From source file:org.pentaho.reporting.engine.classic.extensions.drilldown.devtools.DrillDownProfileEditor.java

protected Component createContentPane() {
    drillDownProfiles = new DefaultListModel();
    profileList = new JList(drillDownProfiles);
    profileList.setCellRenderer(new DrillDownProfileListRenderer());

    final JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5));
    buttonPane.add(new JButton(new NewAction()));
    buttonPane.add(new JButton(new EditAction()));
    buttonPane.add(new JButton(new RemoveAction()));
    buttonPane.add(Box.createHorizontalStrut(10));
    buttonPane.add(new JButton(new LoadAction()));
    buttonPane.add(new JButton(new SaveAction()));

    final JPanel contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout());
    contentPane.add(buttonPane, BorderLayout.NORTH);
    contentPane.add(new JScrollPane(profileList), BorderLayout.CENTER);
    return contentPane;
}

From source file:nz.ac.waikato.cms.supernova.gui.Supernova.java

/**
 * Creates the panel for generating a single graph.
 *
 * @return      the panel//ww  w  .  jav a 2 s .  c o m
 */
protected BasePanel createSinglePanel() {
    BasePanel result;
    JPanel params;
    JPanel left1;
    JPanel left2;
    JPanel panel;
    JPanel panel2;

    result = new BasePanel(new BorderLayout());
    panel = new JPanel(new BorderLayout());
    result.add(panel, BorderLayout.CENTER);
    m_PanelSinglePreview = new ImagePanel();
    panel.add(new BaseScrollPane(m_PanelSinglePreview), BorderLayout.CENTER);
    panel2 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    panel.add(panel2, BorderLayout.SOUTH);
    m_SingleCopy = new JButton(GUIHelper.getIcon("copy.gif"));
    m_SingleCopy.setEnabled(false);
    m_SingleCopy.addActionListener((ActionEvent e) -> copySinglePreview());
    panel2.add(m_SingleCopy);

    left1 = new JPanel(new BorderLayout());
    result.add(left1, BorderLayout.WEST);

    // params with height 2
    params = new JPanel(new GridLayout(0, 1));
    left1.add(params, BorderLayout.NORTH);

    m_SingleStatistics = new StatisticsTable();
    left1.add(new BaseScrollPane(m_SingleStatistics), BorderLayout.NORTH);

    // params with height 1
    panel = new JPanel(new BorderLayout());
    left1.add(panel, BorderLayout.CENTER);
    left2 = new JPanel(new BorderLayout());
    panel.add(left2, BorderLayout.NORTH);
    params = new JPanel(new GridLayout(0, 1));
    left2.add(params, BorderLayout.NORTH);

    // background
    m_SingleBackground = new ColorButton(Color.BLACK);
    params.add(createParameter("Background", m_SingleBackground));

    // opacity
    m_SingleOpacity = new JSpinner();
    m_SingleOpacity.setValue(10);
    ((SpinnerNumberModel) m_SingleOpacity.getModel()).setMinimum(0);
    ((SpinnerNumberModel) m_SingleOpacity.getModel()).setMaximum(100);
    ((SpinnerNumberModel) m_SingleOpacity.getModel()).setStepSize(10);
    ((JSpinner.DefaultEditor) m_SingleOpacity.getEditor()).getTextField().setColumns(5);
    params.add(createParameter("Opacity %", m_SingleOpacity));

    // margin
    m_SingleMargin = new JSpinner();
    m_SingleMargin.setValue(20);
    ((SpinnerNumberModel) m_SingleMargin.getModel()).setMinimum(0);
    ((SpinnerNumberModel) m_SingleMargin.getModel()).setMaximum(100);
    ((SpinnerNumberModel) m_SingleMargin.getModel()).setStepSize(10);
    ((JSpinner.DefaultEditor) m_SingleMargin.getEditor()).getTextField().setColumns(5);
    params.add(createParameter("Margin %", m_SingleMargin));

    // width
    m_SingleWidth = new JSpinner();
    m_SingleWidth.setValue(400);
    ((SpinnerNumberModel) m_SingleWidth.getModel()).setMinimum(1);
    ((SpinnerNumberModel) m_SingleWidth.getModel()).setStepSize(100);
    ((JSpinner.DefaultEditor) m_SingleWidth.getEditor()).getTextField().setColumns(5);
    params.add(createParameter("Width", m_SingleWidth));

    // height
    m_SingleHeight = new JSpinner();
    m_SingleHeight.setValue(400);
    ((SpinnerNumberModel) m_SingleHeight.getModel()).setMinimum(1);
    ((SpinnerNumberModel) m_SingleHeight.getModel()).setStepSize(100);
    ((JSpinner.DefaultEditor) m_SingleHeight.getEditor()).getTextField().setColumns(5);
    params.add(createParameter("Height", m_SingleHeight));

    // generator
    m_SingleGenerator = new JComboBox<>(Registry.toStringArray(Registry.getGenerators(), true));
    m_SingleGenerator.addActionListener((ActionEvent e) -> {
        updateSingleOutput();
    });
    params.add(createParameter("Generator", m_SingleGenerator));

    // center
    m_SingleCenter = new JComboBox<>(Registry.toStringArray(Registry.getCenters(), true));
    params.add(createParameter("Center", m_SingleCenter));

    // output
    m_SingleOutput = new FileChooserPanel();
    m_SingleOutput.setUseSaveDialog(true);
    m_SingleOutput.setPreferredSize(new Dimension(170, (int) m_SingleOutput.getPreferredSize().getHeight()));
    params.add(createParameter("Output", m_SingleOutput));

    // preview/generate
    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    m_SinglePreview = new JButton("Preview");
    m_SinglePreview.addActionListener((ActionEvent e) -> generateSinglePreview());
    m_SingleGenerate = new JButton("Generate");
    m_SingleGenerate.addActionListener((ActionEvent e) -> generateSingleOutput());
    panel.add(m_SinglePreview);
    panel.add(m_SingleGenerate);
    params.add(panel);

    adjustLabels();

    return result;
}

From source file:edu.virginia.iath.oxygenplugins.juel.JUELPluginMenu.java

public JUELPluginMenu(StandalonePluginWorkspace spw, LocalOptions ops) {
    super(name, true);
    ws = spw;//w  w w  . j  a v  a2 s. co m
    options = ops;

    // setup the options
    //options.readStorage();

    // Find names
    JMenuItem search = new JMenuItem("Find Name");
    search.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent selection) {
            String label = "Find Name";

            final JTextField lastName = new JTextField("", 30);
            lastName.setPreferredSize(new Dimension(350, 25));
            //JTextField projectName = new JTextField("", 30);

            final JComboBox possibleVals = new JComboBox();
            possibleVals.setEnabled(false);
            possibleVals.setPreferredSize(new Dimension(350, 25));

            JButton search = new JButton("Search");
            search.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent selection) {
                    // query the database
                    try {
                        String json = "";
                        String line;
                        URL url = new URL("http://juel.iath.virginia.edu/academical_db/people/find_people?term="
                                + lastName.getText());
                        BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
                        while ((line = in.readLine()) != null) {
                            json += line;
                        }
                        JSONArray obj = new JSONArray(json);

                        // Read the JSON and update possibleVals
                        possibleVals.removeAllItems();
                        possibleVals.setEnabled(false);

                        for (int i = 0; i < obj.length(); i++) {
                            JSONObject cur = obj.getJSONObject(i);
                            String name = cur.getString("label");
                            String id = String.format("P%05d", cur.getInt("value"));
                            possibleVals.addItem(new ComboBoxObject(name, id));
                            possibleVals.setEnabled(true);
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        possibleVals.setEnabled(false);
                    }

                    return;
                }
            });
            search.setPreferredSize(new Dimension(100, 25));

            JButton insert = new JButton("Insert");
            insert.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent sel) {
                    // Insert into the page
                    // Get the selected value, grab the ID, then insert into the document

                    // Get the editor
                    WSTextEditorPage ed = null;
                    WSEditor editorAccess = ws
                            .getCurrentEditorAccess(StandalonePluginWorkspace.MAIN_EDITING_AREA);
                    if (editorAccess != null && editorAccess.getCurrentPage() instanceof WSTextEditorPage) {
                        ed = (WSTextEditorPage) editorAccess.getCurrentPage();
                    }

                    String result = "key=\"" + ((ComboBoxObject) possibleVals.getSelectedItem()).id + "\"";

                    // Update the text in the document
                    ed.beginCompoundUndoableEdit();
                    int selectionOffset = ed.getSelectionStart();
                    ed.deleteSelection();
                    javax.swing.text.Document doc = ed.getDocument();
                    try {
                        if (selectionOffset > 0 && !doc.getText(selectionOffset - 1, 1).equals(" "))
                            result = " " + result;
                        if (selectionOffset > 0 && !doc.getText(selectionOffset, 1).equals(" ")
                                && !doc.getText(selectionOffset, 1).equals(">"))
                            result = result + " ";
                        doc.insertString(selectionOffset, result, javax.swing.text.SimpleAttributeSet.EMPTY);
                    } catch (javax.swing.text.BadLocationException b) {
                        // Okay if it doesn't work
                    }
                    ed.endCompoundUndoableEdit();

                    return;
                }
            });
            insert.setPreferredSize(new Dimension(100, 25));

            java.awt.GridLayout layoutOuter = new java.awt.GridLayout(3, 1);
            java.awt.FlowLayout layout = new java.awt.FlowLayout(FlowLayout.RIGHT); // rows, columns

            JPanel addPanel = new JPanel();
            JPanel addPanelInner = new JPanel();
            addPanel.setLayout(layoutOuter);
            addPanel.add(new JLabel("Search for last name, then choose a full name from the list below"));
            addPanelInner.setLayout(layout);
            addPanelInner.add(new JLabel("Search Last Name: "));
            addPanelInner.add(lastName);
            addPanelInner.add(search);
            addPanel.add(addPanelInner);
            addPanelInner = new JPanel();
            addPanelInner.setLayout(layout);
            addPanelInner.add(new JLabel("Narrow Search: "));
            addPanelInner.add(possibleVals);
            addPanelInner.add(insert);
            addPanel.add(addPanelInner);

            JOptionPane.showMessageDialog((java.awt.Frame) ws.getParentFrame(), addPanel, label,
                    JOptionPane.PLAIN_MESSAGE);

        }
    });
    this.add(search);

    // Find places
    search = new JMenuItem("Find Place");
    search.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent selection) {
            String label = "Find Place";

            final JTextField searchText = new JTextField("", 30);
            searchText.setPreferredSize(new Dimension(350, 25));
            //JTextField projectName = new JTextField("", 30);

            final JComboBox possibleVals = new JComboBox();
            possibleVals.setEnabled(false);
            possibleVals.setPreferredSize(new Dimension(350, 25));

            JButton search = new JButton("Search");
            search.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent selection) {
                    // query the database
                    try {
                        String json = "";
                        String line;
                        URL url = new URL(
                                "http://academical.village.virginia.edu/academical_db/places/find_places?term="
                                        + searchText.getText());
                        BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
                        while ((line = in.readLine()) != null) {
                            json += line;
                        }
                        JSONArray obj = new JSONArray(json);

                        // Read the JSON and update possibleVals
                        possibleVals.removeAllItems();
                        possibleVals.setEnabled(false);

                        for (int i = 0; i < obj.length(); i++) {
                            JSONObject cur = obj.getJSONObject(i);
                            String id = String.format("PL%04d", cur.getInt("value"));
                            String name = cur.getString("label") + " (" + id + ")";
                            possibleVals.addItem(new ComboBoxObject(name, id));
                            possibleVals.setEnabled(true);
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        possibleVals.setEnabled(false);
                    }

                    return;
                }
            });
            search.setPreferredSize(new Dimension(100, 25));

            JButton insert = new JButton("Insert");
            insert.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent sel) {
                    // Insert into the page
                    // Get the selected value, grab the ID, then insert into the document

                    // Get the editor
                    WSTextEditorPage ed = null;
                    WSEditor editorAccess = ws
                            .getCurrentEditorAccess(StandalonePluginWorkspace.MAIN_EDITING_AREA);
                    if (editorAccess != null && editorAccess.getCurrentPage() instanceof WSTextEditorPage) {
                        ed = (WSTextEditorPage) editorAccess.getCurrentPage();
                    }

                    String result = "key=\"" + ((ComboBoxObject) possibleVals.getSelectedItem()).id + "\"";

                    // Update the text in the document
                    ed.beginCompoundUndoableEdit();
                    int selectionOffset = ed.getSelectionStart();
                    ed.deleteSelection();
                    javax.swing.text.Document doc = ed.getDocument();
                    try {
                        if (selectionOffset > 0 && !doc.getText(selectionOffset - 1, 1).equals(" "))
                            result = " " + result;
                        if (selectionOffset > 0 && !doc.getText(selectionOffset, 1).equals(" ")
                                && !doc.getText(selectionOffset, 1).equals(">"))
                            result = result + " ";
                        doc.insertString(selectionOffset, result, javax.swing.text.SimpleAttributeSet.EMPTY);
                    } catch (javax.swing.text.BadLocationException b) {
                        // Okay if it doesn't work
                    }
                    ed.endCompoundUndoableEdit();

                    return;
                }
            });
            insert.setPreferredSize(new Dimension(100, 25));

            java.awt.GridLayout layoutOuter = new java.awt.GridLayout(3, 1);
            java.awt.FlowLayout layout = new java.awt.FlowLayout(FlowLayout.RIGHT); // rows, columns

            JPanel addPanel = new JPanel();
            JPanel addPanelInner = new JPanel();
            addPanel.setLayout(layoutOuter);
            addPanel.add(new JLabel("Search for a place name, then choose one from the list below"));
            addPanelInner.setLayout(layout);
            addPanelInner.add(new JLabel("Search Keyword: "));
            addPanelInner.add(searchText);
            addPanelInner.add(search);
            addPanel.add(addPanelInner);
            addPanelInner = new JPanel();
            addPanelInner.setLayout(layout);
            addPanelInner.add(new JLabel("Narrow Search: "));
            addPanelInner.add(possibleVals);
            addPanelInner.add(insert);
            addPanel.add(addPanelInner);

            JOptionPane.showMessageDialog((java.awt.Frame) ws.getParentFrame(), addPanel, label,
                    JOptionPane.PLAIN_MESSAGE);

        }
    });
    this.add(search);

    // Find corporate bodies
    search = new JMenuItem("Find Corporate Body");
    search.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent selection) {
            String label = "Find Corporate Body";

            final JTextField searchText = new JTextField("", 30);
            searchText.setPreferredSize(new Dimension(350, 25));
            //JTextField projectName = new JTextField("", 30);

            final JComboBox possibleVals = new JComboBox();
            possibleVals.setEnabled(false);
            possibleVals.setPreferredSize(new Dimension(350, 25));

            JButton search = new JButton("Search");
            search.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent selection) {
                    // query the database
                    try {
                        String json = "";
                        String line;
                        URL url = new URL(
                                "http://academical.village.virginia.edu/academical_db/corporate_bodies/find?term="
                                        + searchText.getText());
                        BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
                        while ((line = in.readLine()) != null) {
                            json += line;
                        }
                        JSONArray obj = new JSONArray(json);

                        // Read the JSON and update possibleVals
                        possibleVals.removeAllItems();
                        possibleVals.setEnabled(false);

                        for (int i = 0; i < obj.length(); i++) {
                            JSONObject cur = obj.getJSONObject(i);
                            String id = String.format("CB%04d", cur.getInt("value"));
                            String name = cur.getString("label") + " (" + id + ")";
                            possibleVals.addItem(new ComboBoxObject(name, id));
                            possibleVals.setEnabled(true);
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        possibleVals.setEnabled(false);
                    }

                    return;
                }
            });
            search.setPreferredSize(new Dimension(100, 25));

            JButton insert = new JButton("Insert");
            insert.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent sel) {
                    // Insert into the page
                    // Get the selected value, grab the ID, then insert into the document

                    // Get the editor
                    WSTextEditorPage ed = null;
                    WSEditor editorAccess = ws
                            .getCurrentEditorAccess(StandalonePluginWorkspace.MAIN_EDITING_AREA);
                    if (editorAccess != null && editorAccess.getCurrentPage() instanceof WSTextEditorPage) {
                        ed = (WSTextEditorPage) editorAccess.getCurrentPage();
                    }

                    String result = "key=\"" + ((ComboBoxObject) possibleVals.getSelectedItem()).id + "\"";

                    // Update the text in the document
                    ed.beginCompoundUndoableEdit();
                    int selectionOffset = ed.getSelectionStart();
                    ed.deleteSelection();
                    javax.swing.text.Document doc = ed.getDocument();
                    try {
                        if (selectionOffset > 0 && !doc.getText(selectionOffset - 1, 1).equals(" "))
                            result = " " + result;
                        if (selectionOffset > 0 && !doc.getText(selectionOffset, 1).equals(" ")
                                && !doc.getText(selectionOffset, 1).equals(">"))
                            result = result + " ";
                        doc.insertString(selectionOffset, result, javax.swing.text.SimpleAttributeSet.EMPTY);
                    } catch (javax.swing.text.BadLocationException b) {
                        // Okay if it doesn't work
                    }
                    ed.endCompoundUndoableEdit();

                    return;
                }
            });
            insert.setPreferredSize(new Dimension(100, 25));

            java.awt.GridLayout layoutOuter = new java.awt.GridLayout(3, 1);
            java.awt.FlowLayout layout = new java.awt.FlowLayout(FlowLayout.RIGHT); // rows, columns

            JPanel addPanel = new JPanel();
            JPanel addPanelInner = new JPanel();
            addPanel.setLayout(layoutOuter);
            addPanel.add(new JLabel("Search for a corporate body, then one from the list below"));
            addPanelInner.setLayout(layout);
            addPanelInner.add(new JLabel("Search Keyword: "));
            addPanelInner.add(searchText);
            addPanelInner.add(search);
            addPanel.add(addPanelInner);
            addPanelInner = new JPanel();
            addPanelInner.setLayout(layout);
            addPanelInner.add(new JLabel("Narrow Search: "));
            addPanelInner.add(possibleVals);
            addPanelInner.add(insert);
            addPanel.add(addPanelInner);

            JOptionPane.showMessageDialog((java.awt.Frame) ws.getParentFrame(), addPanel, label,
                    JOptionPane.PLAIN_MESSAGE);

        }
    });
    this.add(search);

    // Find Courses
    search = new JMenuItem("Find Course");
    search.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent selection) {
            String label = "Find Course";

            final JTextField searchText = new JTextField("", 30);
            searchText.setPreferredSize(new Dimension(350, 25));
            //JTextField projectName = new JTextField("", 30);

            final JComboBox possibleVals = new JComboBox();
            possibleVals.setEnabled(false);
            possibleVals.setPreferredSize(new Dimension(350, 25));

            JButton search = new JButton("Search");
            search.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent selection) {
                    // query the database
                    try {
                        String json = "";
                        String line;
                        URL url = new URL(
                                "http://academical.village.virginia.edu/academical_db/courses/find?term="
                                        + searchText.getText());
                        BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
                        while ((line = in.readLine()) != null) {
                            json += line;
                        }
                        JSONArray obj = new JSONArray(json);

                        // Read the JSON and update possibleVals
                        possibleVals.removeAllItems();
                        possibleVals.setEnabled(false);

                        for (int i = 0; i < obj.length(); i++) {
                            JSONObject cur = obj.getJSONObject(i);
                            String id = String.format("C%04d", cur.getInt("value"));
                            String name = cur.getString("label") + " (" + id + ")";
                            possibleVals.addItem(new ComboBoxObject(name, id));
                            possibleVals.setEnabled(true);
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        possibleVals.setEnabled(false);
                    }

                    return;
                }
            });
            search.setPreferredSize(new Dimension(100, 25));

            JButton insert = new JButton("Insert");
            insert.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent sel) {
                    // Insert into the page
                    // Get the selected value, grab the ID, then insert into the document

                    // Get the editor
                    WSTextEditorPage ed = null;
                    WSEditor editorAccess = ws
                            .getCurrentEditorAccess(StandalonePluginWorkspace.MAIN_EDITING_AREA);
                    if (editorAccess != null && editorAccess.getCurrentPage() instanceof WSTextEditorPage) {
                        ed = (WSTextEditorPage) editorAccess.getCurrentPage();
                    }

                    String result = "key=\"" + ((ComboBoxObject) possibleVals.getSelectedItem()).id + "\"";

                    // Update the text in the document
                    ed.beginCompoundUndoableEdit();
                    int selectionOffset = ed.getSelectionStart();
                    ed.deleteSelection();
                    javax.swing.text.Document doc = ed.getDocument();
                    try {
                        if (selectionOffset > 0 && !doc.getText(selectionOffset - 1, 1).equals(" "))
                            result = " " + result;
                        if (selectionOffset > 0 && !doc.getText(selectionOffset, 1).equals(" ")
                                && !doc.getText(selectionOffset, 1).equals(">"))
                            result = result + " ";
                        doc.insertString(selectionOffset, result, javax.swing.text.SimpleAttributeSet.EMPTY);
                    } catch (javax.swing.text.BadLocationException b) {
                        // Okay if it doesn't work
                    }
                    ed.endCompoundUndoableEdit();

                    return;
                }
            });
            insert.setPreferredSize(new Dimension(100, 25));

            java.awt.GridLayout layoutOuter = new java.awt.GridLayout(3, 1);
            java.awt.FlowLayout layout = new java.awt.FlowLayout(FlowLayout.RIGHT); // rows, columns

            JPanel addPanel = new JPanel();
            JPanel addPanelInner = new JPanel();
            addPanel.setLayout(layoutOuter);
            addPanel.add(new JLabel("Search for a course, then choose one from the list below"));
            addPanelInner.setLayout(layout);
            addPanelInner.add(new JLabel("Search Keyword: "));
            addPanelInner.add(searchText);
            addPanelInner.add(search);
            addPanel.add(addPanelInner);
            addPanelInner = new JPanel();
            addPanelInner.setLayout(layout);
            addPanelInner.add(new JLabel("Narrow Search: "));
            addPanelInner.add(possibleVals);
            addPanelInner.add(insert);
            addPanel.add(addPanelInner);

            JOptionPane.showMessageDialog((java.awt.Frame) ws.getParentFrame(), addPanel, label,
                    JOptionPane.PLAIN_MESSAGE);

        }
    });
    this.add(search);
}

From source file:org.executequery.gui.ExecuteSqlScriptPanel.java

private void init() throws Exception {

    fileNameField = WidgetFactory.createTextField();
    connectionsCombo = WidgetFactory.createComboBox();
    combosGroup = new TableSelectionCombosGroup(connectionsCombo);

    actionOnErrorCombo = WidgetFactory.createComboBox();

    ActionOnError[] actionsOnError = { ActionOnError.HALT, ActionOnError.CONTINUE };

    actionOnErrorCombo.setModel(new DefaultComboBoxModel(actionsOnError));

    outputPanel = new LoggingOutputPanel();
    statusBar = new SqlTextPaneStatusBar();
    statusBar.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 1));

    JButton button = WidgetFactory.createInlineFieldButton("Browse");
    button.setActionCommand("browse");
    button.addActionListener(this);
    button.setMnemonic('r');

    logOutputCheckBox = new JCheckBox(
            "<html>&nbsp;&nbsp;<i>Note:</i> This will slow down the process significantly </html>");

    JPanel mainPanel = new JPanel(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridy = 0;//  w  w  w .  ja v a2 s .  c  o m
    gbc.gridx = 0;
    gbc.gridheight = 1;
    gbc.insets.top = 7;
    gbc.insets.bottom = 5;
    gbc.insets.right = 5;
    gbc.insets.left = 5;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    mainPanel.add(new JLabel("Connection:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.insets.top = 5;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(connectionsCombo, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weightx = 0;
    gbc.gridwidth = 1;
    gbc.insets.top = 5;
    mainPanel.add(new JLabel("Action on Error:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets.top = 0;
    mainPanel.add(actionOnErrorCombo, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weightx = 0;
    gbc.gridwidth = 1;
    gbc.insets.top = 5;
    mainPanel.add(new JLabel("Input File:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.insets.top = 0;
    mainPanel.add(fileNameField, gbc);
    gbc.gridx = 2;
    gbc.weightx = 0;
    gbc.insets.left = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(button, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.insets.top = 5;
    gbc.insets.left = 5;
    mainPanel.add(new JLabel("Log output:"), gbc);
    gbc.gridx = 1;
    gbc.insets.top = 2;
    gbc.insets.left = 0;
    mainPanel.add(logOutputCheckBox, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weighty = 1.0;
    gbc.weightx = 1.0;
    gbc.insets.top = 5;
    gbc.insets.left = 5;
    gbc.insets.bottom = 0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.BOTH;
    mainPanel.add(outputPanel, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weighty = 0;
    gbc.insets.bottom = 5;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(statusBar, gbc);

    mainPanel.setBorder(BorderFactory.createEtchedBorder());

    int minimumButtonWidth = 85;
    startButton = new MinimumWidthActionButton(minimumButtonWidth, this, "Start", "start");
    rollbackButton = new MinimumWidthActionButton(minimumButtonWidth, this, "Commit", "commit");
    commitButton = new MinimumWidthActionButton(minimumButtonWidth, this, "Rollback", "rollback");
    stopButton = new MinimumWidthActionButton(minimumButtonWidth, this, "Stop", "stop");

    rollbackButton.setEnabled(false);
    commitButton.setEnabled(false);
    stopButton.setEnabled(false);

    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 2, 5));
    buttonPanel.add(startButton);
    buttonPanel.add(rollbackButton);
    buttonPanel.add(commitButton);
    buttonPanel.add(stopButton);

    add(mainPanel, BorderLayout.CENTER);
    add(buttonPanel, BorderLayout.SOUTH);
    setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    EventMediator.registerListener(this);
}

From source file:au.org.ala.delta.editor.ui.image.ImageSettingsDialog.java

private void createUI() {
    JPanel overlayDefaultsPanel = new JPanel();
    String overlayDefaultsTitle = _resources.getString("imageSettingsOverlayDefaults.title");
    overlayDefaultsPanel.setBorder(/*w  w  w .jav  a2  s  .c o  m*/
            new TitledBorder(null, overlayDefaultsTitle, TitledBorder.LEADING, TitledBorder.TOP, null, null));

    JPanel imagePathPanel = new JPanel();
    String imagePathTitle = _resources.getString("imageSettingsImagePath.title");
    imagePathPanel.setBorder(
            new TitledBorder(null, imagePathTitle, TitledBorder.LEADING, TitledBorder.TOP, null, null));

    JPanel overlayFontDefaultsPanel = new JPanel();
    String overlayFontTitle = _resources.getString("imageSettingsOverlayFonts.title");
    overlayFontDefaultsPanel.setBorder(
            new TitledBorder(null, overlayFontTitle, TitledBorder.LEADING, TitledBorder.TOP, null, null));

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
    GroupLayout groupLayout = new GroupLayout(getContentPane());
    groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout
            .createSequentialGroup().addContainerGap()
            .addComponent(overlayDefaultsPanel, GroupLayout.PREFERRED_SIZE, 236, GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                    .addComponent(buttonPanel, GroupLayout.DEFAULT_SIZE, 685, Short.MAX_VALUE)
                    .addComponent(overlayFontDefaultsPanel, GroupLayout.DEFAULT_SIZE, 685, Short.MAX_VALUE)
                    .addComponent(imagePathPanel, GroupLayout.DEFAULT_SIZE, 685, Short.MAX_VALUE))
            .addContainerGap()));
    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout
            .createSequentialGroup().addGap(10)
            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
                    .addComponent(overlayDefaultsPanel, 0, 0, Short.MAX_VALUE)
                    .addGroup(groupLayout.createSequentialGroup()
                            .addComponent(imagePathPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.RELATED).addComponent(overlayFontDefaultsPanel,
                                    GroupLayout.PREFERRED_SIZE, 260, GroupLayout.PREFERRED_SIZE)))
            .addPreferredGap(ComponentPlacement.RELATED).addComponent(buttonPanel, GroupLayout.PREFERRED_SIZE,
                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    btnOk = new JButton("Ok");
    buttonPanel.add(btnOk);

    btnCancel = new JButton("Cancel");
    buttonPanel.add(btnCancel);

    btnApply = new JButton("Apply");
    btnApply.setHorizontalAlignment(SwingConstants.RIGHT);
    buttonPanel.add(btnApply);

    chckbxCentreInBox = new JCheckBox();
    chckbxCentreInBox.setName("imageSettingsCentreInBox");
    chckbxIncludeComments = new JCheckBox();
    chckbxIncludeComments.setName("imageSettingsIncludeComments");
    chckbxOmitDescription = new JCheckBox();
    chckbxOmitDescription.setName("imageSettingsOmitDescription");
    chckbxUseIntegralHeight = new JCheckBox();
    chckbxUseIntegralHeight.setName("imageSettingsUseIntegralHeight");
    chckbxHotspotsPopUp = new JCheckBox();
    chckbxHotspotsPopUp.setName("imageSettingsHotspotsPopUp");
    chckbxCustomPopupColour = new JCheckBox();
    chckbxCustomPopupColour.setName("imageSettingsCustomPopupColour");
    JPanel panel = new JPanel();

    selectedColourLabel = new JLabel("");
    selectedColourLabel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
    selectedColourLabel.setPreferredSize(new Dimension(25, 25));
    selectedColourLabel.setOpaque(true);
    selectedColourLabel.setEnabled(false);

    chooseColourButton = new JButton();
    chooseColourButton.setEnabled(false);

    JLabel lblButtonAlignment = new JLabel();
    lblButtonAlignment.setName("imageSettingsButtonAlignment");
    buttonAlignmentCombo = new JComboBox();
    buttonAlignmentCombo.setModel(new ButtonAlignmentModel());
    buttonAlignmentCombo.setRenderer(new ButtonAlignmentRenderer());
    GroupLayout gl_overlayDefaultsPanel = new GroupLayout(overlayDefaultsPanel);
    gl_overlayDefaultsPanel.setHorizontalGroup(gl_overlayDefaultsPanel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_overlayDefaultsPanel.createSequentialGroup().addContainerGap()
                    .addGroup(gl_overlayDefaultsPanel.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_overlayDefaultsPanel.createSequentialGroup().addGap(6)
                                    .addComponent(lblButtonAlignment))
                            .addComponent(chckbxIncludeComments).addComponent(chckbxOmitDescription)
                            .addComponent(chckbxUseIntegralHeight).addComponent(chckbxHotspotsPopUp)
                            .addComponent(chckbxCustomPopupColour)
                            .addComponent(buttonAlignmentCombo, GroupLayout.PREFERRED_SIZE, 167,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(panel, GroupLayout.PREFERRED_SIZE, 193, GroupLayout.PREFERRED_SIZE)
                            .addComponent(chckbxCentreInBox))
                    .addContainerGap(25, Short.MAX_VALUE)));
    gl_overlayDefaultsPanel
            .setVerticalGroup(gl_overlayDefaultsPanel.createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_overlayDefaultsPanel.createSequentialGroup().addGap(10)
                            .addComponent(chckbxCentreInBox).addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(chckbxIncludeComments).addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(chckbxOmitDescription).addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(chckbxUseIntegralHeight).addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(chckbxHotspotsPopUp).addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(chckbxCustomPopupColour).addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(panel, GroupLayout.PREFERRED_SIZE, 39, GroupLayout.PREFERRED_SIZE)
                            .addGap(12).addComponent(lblButtonAlignment)
                            .addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(buttonAlignmentCombo, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(144, Short.MAX_VALUE)));
    GroupLayout gl_panel = new GroupLayout(panel);
    gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel.createSequentialGroup().addContainerGap()
                    .addComponent(selectedColourLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(chooseColourButton).addGap(68)));
    gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel.createSequentialGroup().addContainerGap()
                    .addGroup(gl_panel.createParallelGroup(Alignment.LEADING).addComponent(chooseColourButton)
                            .addComponent(selectedColourLabel, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    panel.setLayout(gl_panel);
    overlayDefaultsPanel.setLayout(gl_overlayDefaultsPanel);

    JLabel lblFontName = new JLabel();
    lblFontName.setName("imageSettingsFontName");
    JLabel lblSize = new JLabel();
    lblSize.setName("imageSettingsFontSize");
    JLabel lblBold = new JLabel();
    lblBold.setName("imageSettingsFontBold");
    JLabel lblItalic = new JLabel();
    lblItalic.setName("imageSettingsFontItalic");

    JLabel featureLabel = new JLabel();
    featureLabel.setName("imageSettingsFeatureFont");
    buttonFontCombo = new JComboBox();
    buttonFontCombo.setModel(new FontFamilyModel());

    featureSizeCombo = new JComboBox();
    featureSizeCombo.setModel(new FontSizeModel());

    buttonBoldCheckBox = new JCheckBox("");

    featureItalicCheckBox = new JCheckBox("");

    JLabel buttonLabel = new JLabel();
    buttonLabel.setName("imageSettingsButtonFont");

    featureFontCombo = new JComboBox();
    featureFontCombo.setModel(new FontFamilyModel());

    buttonSizeCombo = new JComboBox();
    buttonSizeCombo.setModel(new FontSizeModel());

    featureBoldCheckBox = new JCheckBox("");

    buttonItalicCheckBox = new JCheckBox("");

    JLabel defaultLabel = new JLabel();
    defaultLabel.setName("imageSettingsDefaultFont");
    defaultFontCombo = new JComboBox();
    defaultFontCombo.setModel(new FontFamilyModel());

    defaultSizeCombo = new JComboBox();
    defaultSizeCombo.setModel(new FontSizeModel());

    defaultBoldCheckBox = new JCheckBox("");

    defaultItalicCheckBox = new JCheckBox("");

    JLabel lblSample = new JLabel();
    lblSample.setName("imageSettingsSample");
    sampleTextField = new JTextField("");

    chckbxSaveSampleAs = new JCheckBox();
    chckbxSaveSampleAs.setSelected(true);
    chckbxSaveSampleAs.setName("imageSettingsSaveSampleAs");

    GroupLayout gl_overlayFontDefaultsPanel = new GroupLayout(overlayFontDefaultsPanel);
    gl_overlayFontDefaultsPanel.setHorizontalGroup(gl_overlayFontDefaultsPanel
            .createParallelGroup(Alignment.LEADING)
            .addGroup(gl_overlayFontDefaultsPanel.createSequentialGroup().addContainerGap()
                    .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_overlayFontDefaultsPanel.createSequentialGroup()
                                    .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.LEADING)
                                            .addComponent(defaultLabel).addComponent(featureLabel)
                                            .addComponent(buttonLabel))
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addGroup(gl_overlayFontDefaultsPanel
                                            .createParallelGroup(Alignment.TRAILING)
                                            .addComponent(lblFontName, 0, 345, Short.MAX_VALUE)
                                            .addGroup(gl_overlayFontDefaultsPanel.createSequentialGroup()
                                                    .addGroup(gl_overlayFontDefaultsPanel
                                                            .createParallelGroup(Alignment.TRAILING)
                                                            .addComponent(defaultFontCombo, Alignment.LEADING,
                                                                    0, 339, Short.MAX_VALUE)
                                                            .addComponent(featureFontCombo, 0, 339,
                                                                    Short.MAX_VALUE)
                                                            .addComponent(buttonFontCombo, 0, 339,
                                                                    Short.MAX_VALUE))
                                                    .addPreferredGap(ComponentPlacement.RELATED)))
                                    .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.LEADING)
                                            .addComponent(lblSize, 0, 94, Short.MAX_VALUE)
                                            .addComponent(defaultSizeCombo, 0, 94, Short.MAX_VALUE)
                                            .addComponent(featureSizeCombo, 0, 94, Short.MAX_VALUE)
                                            .addComponent(buttonSizeCombo, 0, 94, Short.MAX_VALUE)))
                            .addGroup(gl_overlayFontDefaultsPanel.createSequentialGroup()
                                    .addComponent(lblSample).addPreferredGap(ComponentPlacement.RELATED)
                                    .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.LEADING)
                                            .addComponent(chckbxSaveSampleAs).addComponent(sampleTextField,
                                                    GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE))))
                    .addGap(18)
                    .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.LEADING, false)
                            .addComponent(featureBoldCheckBox, GroupLayout.PREFERRED_SIZE, 40,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(defaultBoldCheckBox, GroupLayout.PREFERRED_SIZE, 40,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(buttonBoldCheckBox, GroupLayout.PREFERRED_SIZE, 40,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblBold, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.TRAILING)
                            .addComponent(buttonItalicCheckBox, Alignment.LEADING, GroupLayout.PREFERRED_SIZE,
                                    40, GroupLayout.PREFERRED_SIZE)
                            .addComponent(featureItalicCheckBox, Alignment.LEADING, GroupLayout.PREFERRED_SIZE,
                                    40, GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblItalic, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 50,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(defaultItalicCheckBox, Alignment.LEADING, GroupLayout.PREFERRED_SIZE,
                                    40, GroupLayout.PREFERRED_SIZE))
                    .addContainerGap()));
    gl_overlayFontDefaultsPanel
            .setVerticalGroup(gl_overlayFontDefaultsPanel
                    .createParallelGroup(Alignment.LEADING).addGroup(gl_overlayFontDefaultsPanel
                            .createSequentialGroup().addContainerGap().addGroup(gl_overlayFontDefaultsPanel
                                    .createParallelGroup(Alignment.BASELINE).addComponent(
                                            lblSize)
                                    .addComponent(lblFontName).addComponent(lblItalic).addComponent(lblBold))
                            .addGap(10)
                            .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.LEADING)
                                    .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(
                                            Alignment.BASELINE)
                                            .addComponent(defaultFontCombo, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                            .addComponent(defaultSizeCombo, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                            .addComponent(defaultLabel))
                                    .addComponent(defaultItalicCheckBox).addComponent(defaultBoldCheckBox))
                            .addGap(10)
                            .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.LEADING)
                                    .addGroup(gl_overlayFontDefaultsPanel
                                            .createParallelGroup(Alignment.BASELINE)
                                            .addComponent(featureFontCombo, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                            .addComponent(featureSizeCombo, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                            .addComponent(featureLabel))
                                    .addComponent(featureItalicCheckBox).addComponent(featureBoldCheckBox))
                            .addPreferredGap(ComponentPlacement.RELATED)
                            .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.LEADING)
                                    .addGroup(gl_overlayFontDefaultsPanel.createSequentialGroup()
                                            .addGroup(gl_overlayFontDefaultsPanel
                                                    .createParallelGroup(Alignment.BASELINE)
                                                    .addComponent(buttonSizeCombo, GroupLayout.PREFERRED_SIZE,
                                                            GroupLayout.DEFAULT_SIZE,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(buttonFontCombo, GroupLayout.PREFERRED_SIZE,
                                                            GroupLayout.DEFAULT_SIZE,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(buttonLabel))
                                            .addGap(18)
                                            .addGroup(gl_overlayFontDefaultsPanel
                                                    .createParallelGroup(Alignment.BASELINE)
                                                    .addComponent(sampleTextField, GroupLayout.PREFERRED_SIZE,
                                                            40, GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(lblSample))
                                            .addPreferredGap(ComponentPlacement.RELATED)
                                            .addComponent(chckbxSaveSampleAs))
                                    .addComponent(buttonItalicCheckBox).addComponent(buttonBoldCheckBox))
                            .addContainerGap(16, Short.MAX_VALUE)));
    overlayFontDefaultsPanel.setLayout(gl_overlayFontDefaultsPanel);

    imagePathTextField = new JTextField();
    imagePathTextField.setColumns(10);

    imagePathButton = new JButton("New button");
    GroupLayout gl_imagePathPanel = new GroupLayout(imagePathPanel);
    gl_imagePathPanel.setHorizontalGroup(gl_imagePathPanel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_imagePathPanel.createSequentialGroup().addContainerGap()
                    .addComponent(imagePathTextField, GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(imagePathButton)));
    gl_imagePathPanel.setVerticalGroup(gl_imagePathPanel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_imagePathPanel.createSequentialGroup().addContainerGap()
                    .addGroup(gl_imagePathPanel.createParallelGroup(Alignment.BASELINE)
                            .addComponent(imagePathTextField, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addComponent(imagePathButton))
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    imagePathPanel.setLayout(gl_imagePathPanel);
    getContentPane().setLayout(groupLayout);
}

From source file:org.pentaho.reporting.engine.classic.core.modules.gui.commonswing.ExceptionDialog.java

/**
 * Initializes the buttonpane.//  w w w  .  j ava2  s.  c o m
 *
 * @return a panel containing the 'OK' and 'Details' buttons.
 */
private JPanel createButtonPane() {
    final JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5));
    buttonPane.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    buttonPane.add(new JButton(new OKAction()));
    buttonPane.add(new JButton(detailsAction));
    return buttonPane;
}

From source file:org.echocat.velma.dialogs.AboutDialog.java

protected void createButtonBar(@Nonnull Resources resources) {
    final JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0));
    final JButton okButton = new JButton(resources.getString("ok"));
    okButton.addActionListener(getDisposeActionListener());
    panel.add(okButton);//from  ww w. ja v a  2  s  .  com
    add(panel, new CC().alignX("right"));
}

From source file:lcmc.gui.resources.EditableInfo.java

/** Creates revert button and adds it to the panel. */
protected final void addRevertButton(final JPanel panel) {
    final JPanel p = new JPanel(new FlowLayout(FlowLayout.RIGHT, 4, 0));
    p.setBackground(Browser.BUTTON_PANEL_BACKGROUND);
    p.add(revertButton);/*ww  w . j  a v a  2 s .  co  m*/
    panel.add(p, BorderLayout.CENTER);
}

From source file:netcap.JcaptureConfiguration.java

/**
 * ???/*from ww w . j  a  v  a 2 s  .c  o m*/
 * @return
 */
private JPanel getOkCanelPanel() {
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    JButton ok = ViewModules.createButton("", Command.OK.getName(), this);
    JButton cancel = ViewModules.createButton("?", Command.CANCEL.getName(), this);
    ViewModules.addComponent(buttonPanel, ok, cancel);
    return buttonPanel;
}