Example usage for javax.swing BoxLayout BoxLayout

List of usage examples for javax.swing BoxLayout BoxLayout

Introduction

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

Prototype

@ConstructorProperties({ "target", "axis" })
public BoxLayout(Container target, int axis) 

Source Link

Document

Creates a layout manager that will lay out components along the given axis.

Usage

From source file:be.ac.ua.comp.scarletnebula.gui.windows.LinkUnlinkWindow.java

private final JPanel getMainPanel() {
    final JPanel mainPanel = new JPanel(new GridBagLayout());
    mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
    final ServerList linkedServerList = new ServerList(linkedServerListModel);
    linkedServerList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    final JScrollPane linkedServerScrollPane = new JScrollPane(linkedServerList);
    linkedServerScrollPane/*w ww.  j ava2  s  . c  o  m*/
            .setBorder(BorderFactory.createTitledBorder(new EmptyBorder(5, 20, 20, 20), "Linked Servers"));
    // Doesn't matter what this is set to, as long as it's the same as the
    // one for unlinkedServerScrollPane
    linkedServerScrollPane.setPreferredSize(new Dimension(10, 10));

    final GridBagConstraints c = new GridBagConstraints();

    c.fill = GridBagConstraints.BOTH;
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0.5;
    c.weighty = 1.0;

    mainPanel.add(linkedServerScrollPane, c);

    final ServerList unlinkedServerList = new ServerList(unlinkedServerListModel);
    unlinkedServerList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    final JScrollPane unlinkedServerScrollPane = new JScrollPane(unlinkedServerList);
    unlinkedServerScrollPane
            .setBorder(BorderFactory.createTitledBorder(new EmptyBorder(5, 20, 20, 20), "Unlinked Servers"));

    // Doesn't matter what this is set to, as long as it's the same as the
    // one for unlinkedServerScrollPane
    unlinkedServerScrollPane.setPreferredSize(new Dimension(10, 10));

    final JPanel middlePanel = new JPanel();
    middlePanel.setLayout(new BoxLayout(middlePanel, BoxLayout.Y_AXIS));
    middlePanel.add(Box.createVerticalGlue());

    final JButton linkSelectionButton = new JButton("<");
    final JButton unlinkSelectionButton = new JButton(">");

    linkSelectionButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            // Move selection from unlinked to linked list
            final int selection = unlinkedServerList.getSelectedIndex();

            if (selection < 0) {
                return;
            }

            final Server server = unlinkedServerListModel.getVisibleServerAtIndex(selection);

            unlinkedServerListModel.removeServer(server);

            linkedServerListModel.addServer(server);
        }
    });

    unlinkSelectionButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            // Move selection from linked to unlinked list
            final int selection = linkedServerList.getSelectedIndex();

            if (selection < 0) {
                return;
            }

            final int answer = JOptionPane.showOptionDialog(LinkUnlinkWindow.this,
                    "You are about to unlink a server. "
                            + "Unlinking a server will permanently remove \nall data associated with "
                            + "this server, but the server will keep running. "
                            + "\n\nAre you sure you wish to continue?",
                    "Unlink Server", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null);

            if (answer != JOptionPane.YES_OPTION) {
                return;
            }

            final Server server = linkedServerListModel.getVisibleServerAtIndex(selection);

            linkedServerListModel.removeServer(server);

            unlinkedServerListModel.addServer(server);
        }
    });

    middlePanel.add(unlinkSelectionButton);
    middlePanel.add(Box.createVerticalStrut(10));
    middlePanel.add(linkSelectionButton);
    middlePanel.add(Box.createVerticalGlue());

    c.gridx = 1;
    c.gridy = 0;
    c.weightx = 0.0;
    c.weighty = 0.0;

    mainPanel.add(middlePanel, c);

    c.gridx = 2;
    c.gridy = 0;
    c.weightx = 0.5;
    c.weighty = 1.0;

    mainPanel.add(unlinkedServerScrollPane, c);
    return mainPanel;
}

From source file:sim.app.sugarscape.SugarscapeWithUIHigh.java

void addChartPanel(Controller c, Sugarscape model) {
    charts = new Charts(model);
    ChartPanel ginipanel = null;/*from w w  w.  ja v a2 s.c  o  m*/
    ChartPanel wealthpanel = null;
    ChartPanel agentspanel = null;
    ChartPanel agepanel = null;
    ChartPanel evolutionpanel = null;
    ChartPanel culturetagpanel = null;
    ChartPanel tradepanel = null;

    if (model.gini_chart_on) {
        ginipanel = new ChartPanel(charts.createGiniChart());
    }
    if (model.wealth_chart_on) {
        wealthpanel = new ChartPanel(charts.createChart4());
    }
    if (model.population_chart_on) {
        agentspanel = new ChartPanel(charts.createAgentsChart());
    }
    if (model.age_chart_on) {
        agepanel = new ChartPanel(charts.createAgeHistoChart());
    }
    if (model.evolution_chart_on) {
        evolutionpanel = new ChartPanel(charts.createEvolution());
    }
    if (model.culture_tag_chart_on) {
        culturetagpanel = new ChartPanel(charts.createCultureTagChart());
    }
    if (model.trade_chart_on) {
        tradepanel = new ChartPanel(charts.createTradeChart());
    }
    if ((!model.gini_chart_on) && (!model.wealth_chart_on) && (!model.population_chart_on)
            && (!model.age_chart_on) && (!model.evolution_chart_on) && (!model.culture_tag_chart_on)
            && (!model.trade_chart_on)) {
        return;
    }
    // create the chart frame
    chartFrame = new JFrame();
    chartFrame.setResizable(true);
    Container cp = chartFrame.getContentPane();
    cp.setLayout(new BoxLayout(cp, BoxLayout.Y_AXIS));
    if (agepanel != null) {
        cp.add(agepanel);
        cp.add(Box.createRigidArea(new Dimension(0, 6)));
    }
    if (tradepanel != null) {
        cp.add(tradepanel);
        cp.add(Box.createRigidArea(new Dimension(0, 6)));
    }
    if (ginipanel != null) {
        cp.add(ginipanel);
        cp.add(Box.createRigidArea(new Dimension(0, 6)));
    }
    if (wealthpanel != null) {
        cp.add(wealthpanel);
        cp.add(Box.createRigidArea(new Dimension(0, 6)));
    }
    if (agentspanel != null) {
        cp.add(agentspanel);
        cp.add(Box.createRigidArea(new Dimension(0, 6)));
    }
    if (culturetagpanel != null) {
        cp.add(culturetagpanel);
        cp.add(Box.createRigidArea(new Dimension(0, 6)));
    }
    if (evolutionpanel != null) {
        cp.add(evolutionpanel);
        cp.add(Box.createRigidArea(new Dimension(0, 6)));
    }

    //cp.add(chartPanel2);
    //cp.add(Box.createRigidArea(new Dimension(0,6)));
    //cp.add(chartPanel3);
    chartFrame.setTitle("Live Agent Statistics");
    chartFrame.pack();
    // register the chartFrame so it appears in the "Display" list
    c.registerFrame(chartFrame);
    // make the frame visible
    chartFrame.setVisible(true);
}

From source file:org.obiba.onyx.jade.instrument.summitdoppler.VantageABIInstrumentRunner.java

protected JPanel buildMeasureCountSubPanel() {
    // Add the results sub panel.
    JPanel panel = new JPanel();

    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));

    panel.add(measureCountLabel = new MeasureCountLabel());

    panel.setAlignmentX(Component.LEFT_ALIGNMENT);

    return (panel);
}

From source file:gg.pistol.sweeper.gui.component.DecoratedPanel.java

private void addCloseButton() {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    panel.add(Box.createHorizontalGlue());
    JButton button = new JButton(i18n.getString(I18n.BUTTON_CLOSE_ID));
    panel.add(button);//from  ww  w .j a  v a 2s .c om
    panel.add(Box.createHorizontalGlue());
    button.addActionListener(closeAction());

    panel.setBorder(BorderFactory.createEmptyBorder(border, 0, 0, 0));
    add(panel, BorderLayout.SOUTH);
}

From source file:gtu._work.ui.DirectoryCompareUI.java

private void initGUI() {
    try {/*w  w w .  j  ava2s. co  m*/
        BorderLayout thisLayout = new BorderLayout();
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(thisLayout);
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                BorderLayout jPanel1Layout = new BorderLayout();
                jPanel1.setLayout(jPanel1Layout);
                jTabbedPane1.addTab("jPanel1", null, jPanel1, null);
                {
                    jPanel2 = new JPanel();
                    BoxLayout jPanel2Layout = new BoxLayout(jPanel2, javax.swing.BoxLayout.X_AXIS);
                    jPanel2.setLayout(jPanel2Layout);
                    jPanel1.add(jPanel2, BorderLayout.NORTH);
                    jPanel2.setPreferredSize(new java.awt.Dimension(660, 36));
                    {
                        leftDirText = new JTextArea();
                        leftDirText.setPreferredSize(leftDirText.getPreferredSize());
                        leftDirText.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                        JCommonUtil.jTextFieldSetFilePathMouseEvent(leftDirText, true);
                        leftDirText.getDocument()
                                .addDocumentListener(JCommonUtil.getDocumentListener(new HandleDocumentEvent() {
                                    @Override
                                    public void process(DocumentEvent event) {
                                    }
                                }));
                        jPanel2.add(leftDirText);
                        JTextFieldUtil.setupDragDropFilePath(leftDirText, null);
                    }
                    {
                        rightDirText = new JTextArea();
                        rightDirText.setPreferredSize(rightDirText.getPreferredSize());
                        rightDirText.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                        JCommonUtil.jTextFieldSetFilePathMouseEvent(rightDirText, true);
                        rightDirText.getDocument()
                                .addDocumentListener(JCommonUtil.getDocumentListener(new HandleDocumentEvent() {
                                    @Override
                                    public void process(DocumentEvent event) {
                                    }
                                }));
                        jPanel2.add(rightDirText);
                        JTextFieldUtil.setupDragDropFilePath(rightDirText, null);
                    }
                    {
                        executeBtn = new JButton();
                        jPanel2.add(executeBtn);
                        jPanel2.add(getResetBtn());
                        executeBtn.setText("\u958b\u59cb\u6bd4\u5c0d");
                        executeBtn.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                compareStart();
                            }
                        });
                    }
                }
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel1.add(jScrollPane1, BorderLayout.CENTER);
                    jScrollPane1.setPreferredSize(new java.awt.Dimension(660, 362));
                    {
                        dirCompareTable = new JTable();
                        // JTableUtil.defaultSetting(dirCompareTable);
                        JTableUtil.defaultSetting_AutoResize(dirCompareTable);
                        jScrollPane1.setViewportView(dirCompareTable);
                        dirCompareTable.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                dirCompareTableMouseClicked(evt);
                            }
                        });
                        dirCompareTable.setModel(getDefaultTableModel());
                    }
                }
                {
                    jPanel3 = new JPanel();
                    FlowLayout jPanel3Layout = new FlowLayout();
                    jPanel3Layout.setAlignOnBaseline(true);
                    jPanel1.add(jPanel3, BorderLayout.SOUTH);
                    jPanel3.setLayout(jPanel3Layout);
                    jPanel3.setPreferredSize(new java.awt.Dimension(843, 62));
                    {
                        jLabel1 = new JLabel();
                        jPanel3.add(jLabel1);
                        jLabel1.setText("\u526f\u6a94\u540d");
                    }
                    {
                        DefaultComboBoxModel extensionNameComboBoxModel = new DefaultComboBoxModel();
                        extensionNameComboBox = new JComboBox();
                        jPanel3.add(extensionNameComboBox);
                        jPanel3.add(getDiffToolComboBox());
                        jPanel3.add(getJLabel2());
                        jPanel3.add(getSearchText());
                        jPanel3.add(getCompareStyleComboBox());
                        jPanel3.add(getResetQueryBtn());
                        addDiffMergeChkBox();
                        extensionNameComboBox.setModel(extensionNameComboBoxModel);
                        {
                            panel = new JPanel();
                            jTabbedPane1.addTab("New tab", null, panel, null);
                            panel.setLayout(new FormLayout(
                                    new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC,
                                            FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC,
                                            ColumnSpec.decode("default:grow"), },
                                    new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                                            FormFactory.DEFAULT_ROWSPEC, }));
                            {
                                lblCustomCommand = new JLabel("custom command");
                                panel.add(lblCustomCommand, "2, 2, right, default");
                            }
                            {
                                customCompareText = new JTextField();
                                customCompareText.setText(
                                        "\"C:\\Program Files\\TortoiseGit\\bin\\TortoiseGitMerge.exe\"   /base:\"%s\" /theirs:\"%s\"");
                                panel.add(customCompareText, "4, 2, fill, default");
                                customCompareText.setColumns(10);
                            }
                            {
                                configSaveBtn = new JButton("");
                                configSaveBtn.addActionListener(new ActionListener() {
                                    public void actionPerformed(ActionEvent e) {
                                        try {
                                            boolean configChange = false;
                                            String customCompareUrl = customCompareText.getText();
                                            if (StringUtils.isNotBlank(customCompareUrl)) {
                                                configBean.getConfigProp().setProperty(CUSTOM_COMPARE_URL_KEY,
                                                        customCompareUrl);
                                                configChange = true;
                                            }
                                            if (configChange) {
                                                configBean.store();
                                                JCommonUtil._jOptionPane_showMessageDialog_info(
                                                        "?!");
                                            }
                                        } catch (Exception ex) {
                                            JCommonUtil.handleException(ex);
                                        }
                                    }
                                });
                                panel.add(configSaveBtn, "2, 36");
                            }
                        }
                        extensionNameComboBox.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                totalScanFiles(null);
                            }
                        });
                    }
                }
            }
        }
        pack();
        this.setSize(864, 563);

        JCommonUtil.setJFrameIcon(getOwner(), "images/ico/file_merge.ico");

        initConfigBean();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:io.github.jeremgamer.editor.panels.Labels.java

public Labels(final JFrame frame, final LabelPanel lp, final PanelSave ps) {
    this.frame = frame;

    this.setBorder(BorderFactory.createTitledBorder(""));
    JButton add = null;//  w w  w.jav  a2 s.  c  om
    try {
        add = new JButton(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("add.png"))));
    } catch (IOException e) {
        e.printStackTrace();
    }
    add.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                JOptionPane jop = new JOptionPane();
                @SuppressWarnings("static-access")
                String name = jop.showInputDialog((JFrame) SwingUtilities.windowForComponent(labelList),
                        "Nommez le label :", "Crer un label", JOptionPane.QUESTION_MESSAGE);

                if (name != null) {
                    for (int i = 0; i < data.getSize(); i++) {
                        if (data.get(i).equals(name)) {
                            name += "1";
                        }
                    }
                    data.addElement(name);
                    new LabelSave(name);
                    ActionPanel.updateLists();
                    OtherPanel.updateLists();
                    PanelsPanel.updateLists();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }

        }

    });

    JButton remove = null;
    try {
        remove = new JButton(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png"))));
    } catch (IOException e) {
        e.printStackTrace();
    }
    remove.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                if (labelList.getSelectedValue() != null) {
                    File file = new File("projects/" + Editor.getProjectName() + "/labels/"
                            + labelList.getSelectedValue() + ".rbd");
                    JOptionPane jop = new JOptionPane();
                    @SuppressWarnings("static-access")
                    int option = jop.showConfirmDialog((JFrame) SwingUtilities.windowForComponent(labelList),
                            "tes-vous sr de vouloir supprimer ce label?", "Avertissement",
                            JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);

                    if (option == JOptionPane.OK_OPTION) {
                        File dir = new File("projects/" + Editor.getProjectName() + "/panels");
                        for (File f : FileUtils.listFilesAndDirs(dir, TrueFileFilter.INSTANCE,
                                TrueFileFilter.INSTANCE)) {
                            if (!f.isDirectory()) {
                                try {
                                    ps.load(f);
                                } catch (IOException e) {
                                    e.printStackTrace();
                                }
                                for (String section : ps
                                        .getSectionsContaining(labelList.getSelectedValue() + " (Label)")) {
                                    ps.removeSection(section);
                                    try {
                                        ps.save(f);
                                    } catch (IOException e) {
                                        e.printStackTrace();
                                    }
                                }
                            }
                        }
                        if (labelList.getSelectedValue().equals(lp.getFileName())) {
                            lp.setFileName("");
                        }
                        lp.hide();
                        file.delete();
                        data.remove(labelList.getSelectedIndex());
                        ActionPanel.updateLists();
                        OtherPanel.updateLists();
                        PanelsPanel.updateLists();
                    }
                }
            } catch (NullPointerException npe) {
                npe.printStackTrace();
            }

        }

    });

    JPanel buttons = new JPanel();
    buttons.setLayout(new BoxLayout(buttons, BoxLayout.LINE_AXIS));
    buttons.add(add);
    buttons.add(remove);

    updateList();
    labelList.addMouseListener(new MouseAdapter() {
        @SuppressWarnings("unchecked")
        public void mouseClicked(MouseEvent evt) {
            JList<String> list = (JList<String>) evt.getSource();
            if (evt.getClickCount() == 2) {
                int index = list.locationToIndex(evt.getPoint());
                if (isOpen == false) {
                    lp.show();
                    lp.load(new File("projects/" + Editor.getProjectName() + "/labels/"
                            + list.getModel().getElementAt(index) + ".rbd"));
                    previousSelection = list.getSelectedValue();
                    isOpen = true;
                } else {
                    try {
                        if (previousSelection.equals(list.getModel().getElementAt(index))) {
                            lp.hide();
                            previousSelection = list.getSelectedValue();
                            list.clearSelection();
                            isOpen = false;
                        } else {
                            lp.hideThenShow();
                            previousSelection = list.getSelectedValue();
                            lp.load(new File("projects/" + Editor.getProjectName() + "/labels/"
                                    + list.getModel().getElementAt(index) + ".rbd"));
                        }
                    } catch (NullPointerException npe) {
                        lp.hide();
                        list.clearSelection();
                    }
                }
            } else if (evt.getClickCount() == 3) {
                int index = list.locationToIndex(evt.getPoint());
                if (isOpen == false) {
                    lp.show();
                    lp.load(new File("projects/" + Editor.getProjectName() + "/labels/"
                            + list.getModel().getElementAt(index) + ".rbd"));
                    previousSelection = list.getSelectedValue();
                    isOpen = true;
                } else {
                    try {
                        if (previousSelection.equals(list.getModel().getElementAt(index))) {
                            lp.hide();
                            previousSelection = list.getSelectedValue();
                            list.clearSelection();
                            isOpen = false;
                        } else {
                            lp.hideThenShow();
                            previousSelection = list.getSelectedValue();
                            lp.load(new File("projects/" + Editor.getProjectName() + "/labels/"
                                    + list.getModel().getElementAt(index) + ".rbd"));
                        }
                    } catch (NullPointerException npe) {
                        lp.hide();
                        list.clearSelection();
                    }
                }
            }
        }
    });
    JScrollPane listPane = new JScrollPane(labelList);
    listPane.getVerticalScrollBar().setUnitIncrement(Editor.SCROLL_SPEED);
    this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    this.add(buttons);
    this.add(listPane);

}

From source file:mergedoc.ui.PreferencePanel.java

/**
 * ??????//  w  ww. j  a  v  a  2  s . c  om
 * @return ??
 * @throws MergeDocException ????????
 */
private JComponent createLowerPanel() throws MergeDocException {

    // ???
    JPanel checkPanel = new JPanel();
    checkPanel.setLayout(new BoxLayout(checkPanel, BoxLayout.Y_AXIS));
    List<ReplaceEntry> list = ConfigManager.getInstance().getGlobalEntries();
    for (ReplaceEntry entry : list) {
        EntryCheckBox cb = new EntryCheckBox(entry);
        cb.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                previewScrollPane.updatePreview(entryCheckList);
            }
        });
        checkPanel.add(cb);
        entryCheckList.add(cb);
    }
    JScrollPane checkScrollPane = ComponentFactory.createScrollPane(checkPanel);
    checkScrollPane.getVerticalScrollBar().setUnitIncrement(10);

    // ?
    previewScrollPane = new PreviewScrollPane();

    // ??
    splitPane.setBorder(BorderFactory.createEmptyBorder());
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPane.setContinuousLayout(true);
    splitPane.setTopComponent(checkScrollPane);
    splitPane.setBottomComponent(previewScrollPane);
    JPanel splitPanel = new JPanel();
    splitPanel.setLayout(new BoxLayout(splitPanel, BoxLayout.X_AXIS));
    splitPanel.add(splitPane);

    // ??
    JPanel panel = new TitledPanel("");
    panel.setMaximumSize(ComponentFactory.createMaxDimension());
    panel.add(splitPanel);

    // ???
    Persister psst = Persister.getInstance();
    int loc = psst.getInt(Persister.DETAIL_PANEL_HEIGHT, 88);
    splitPane.setDividerLocation(loc);

    // ???
    String[] pDescs = psst.getStrings(Persister.REPLACE_DESCRIPTION_ARRAY);
    for (EntryCheckBox ecb : entryCheckList) {
        ReplaceEntry entry = ecb.getReplaceEntry();
        String desc = entry.getDescription();
        for (String pDesc : pDescs) {
            if (desc.equals(pDesc)) {
                ecb.setSelected(true);
                break;
            }
        }
    }
    previewScrollPane.updatePreview(entryCheckList);

    return panel;
}

From source file:drusy.ui.panels.WifiStatePanel.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Kevin Renella
    headerPanel = new JPanel();
    label1 = new JLabel();
    mainPanel = new JPanel();

    //======== this ========

    setLayout(new BorderLayout());

    //======== headerPanel ========
    {//w w w. j  av a 2  s . co  m
        headerPanel.setLayout(new BorderLayout());

        //---- label1 ----
        label1.setText("This panel shows you the users connected on the Wi-Fi");
        label1.setHorizontalAlignment(SwingConstants.CENTER);
        headerPanel.add(label1, BorderLayout.CENTER);
    }
    add(headerPanel, BorderLayout.NORTH);

    //======== mainPanel ========
    {
        mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    }
    add(mainPanel, BorderLayout.CENTER);
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:org.streamspinner.harmonica.application.CQGraphTerminal.java

private JPanel getJContentPane() {
    if (jContentPane == null) {
        jContentPane = new JPanel();
        jContentPane.setLayout(new BoxLayout(jContentPane, BoxLayout.LINE_AXIS));
        jContentPane.add(getJPanel0());//from   ww  w. ja v a  2  s.  com
        jContentPane.add(getJPanel());
        /*
        jContentPane.setLayout(null);      
        jContentPane.add(getJScrollPane(), null);                  
        jContentPane.add(getJScrollPane1(), null);                  
        jContentPane.add(getJButton(), null);
        jContentPane.add(getJButton1(), null);            
        jContentPane.add(getJPanel(), null);
        */
    }
    return jContentPane;
}

From source file:BRHInit.java

public void showVPSPrompt(JSONArray vps) throws Exception {
    vps_list = vps;/*from ww w .  j  a va  2s . c o m*/

    if (vps_list_window == null) {
        vps_list_window = new JFrame("BRH Console");
        vps_list_window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JPanel top_panel = new JPanel();
        vps_list_window.getContentPane().add(top_panel);

        top_panel.setLayout(new BoxLayout(top_panel, BoxLayout.Y_AXIS));
        top_panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

        Vector values = new Vector();
        for (int idx = 0; idx < vps_list.length(); ++idx) {
            JSONArray row = vps_list.getJSONArray(idx);
            values.addElement(row.getString(1));
        }

        vps_list_box = new JList(values);
        top_panel.add(new JScrollPane(vps_list_box));

        vps_list_box.setVisibleRowCount(10);

        JPanel p = new JPanel();
        p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

        JPanel col_panel = new JPanel();
        p.add(col_panel);
        col_panel.setLayout(new BoxLayout(col_panel, BoxLayout.Y_AXIS));

        col_panel.add(new JLabel("email"));
        col_panel.add(Box.createRigidArea(new Dimension(0, 5)));
        col_panel.add(new JLabel("password"));

        p.add(Box.createRigidArea(new Dimension(5, 0)));

        col_panel = new JPanel();
        p.add(col_panel);
        col_panel.setLayout(new BoxLayout(col_panel, BoxLayout.Y_AXIS));

        col_panel.add(email = new JTextField(20));
        col_panel.add(Box.createRigidArea(new Dimension(0, 5)));
        col_panel.add(password = new JPasswordField());

        top_panel.add(Box.createRigidArea(new Dimension(0, 10)));

        p = new JPanel();
        top_panel.add(p);
        p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

        p.add(Box.createHorizontalGlue());
        p.add(vps_list_ok = new JButton("OK"));
        p.add(Box.createRigidArea(new Dimension(5, 0)));
        p.add(vps_list_cancel = new JButton("Cancel"));
        p.add(Box.createHorizontalGlue());

        vps_list_ok.addActionListener(this);
        vps_list_cancel.addActionListener(this);

        vps_list_window.pack();
    }

    vps_list_window.setVisible(true);
}