Example usage for javax.swing Box createHorizontalBox

List of usage examples for javax.swing Box createHorizontalBox

Introduction

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

Prototype

public static Box createHorizontalBox() 

Source Link

Document

Creates a Box that displays its components from left to right.

Usage

From source file:org.forester.archaeopteryx.ControlPanel.java

void addSecondLevelJCheckBoxWithSlider(final JCheckBox jcb, final JPanel p) {
    jcb.setFocusPainted(false);//from   w w w. ja  va2  s .  com
    jcb.setFont(ControlPanel.jcb_font);
    if (!_configuration.isUseNativeUI()) {
        jcb.setBackground(ControlPanel.jcb_background_color);
        jcb.setForeground(ControlPanel.jcb_text_color);
    }
    Box box = Box.createHorizontalBox();
    p.setBackground(background_color);
    box.add(Box.createRigidArea(new Dimension(12, 0)));
    jcb.setVisible(_color_branches_cb.isSelected());
    box.add(jcb);
    buildJSlider(60, _slider_min, _slider_max);
    getColorBranchesEdplSlider().setVisible(_color_branches_cb.isSelected());
    getColorBranchesEdplSlider().setEnabled(_color_branches_edpl.isSelected());
    box.add(getColorBranchesEdplSlider());
    p.add(box, "Center");
    jcb.addActionListener(this);
}

From source file:com.diversityarrays.dal.server.AskServerParams.java

public AskServerParams(Image serverIconImage, final Window owner, String title, File www,
        DalServerPreferences prefs) {/*  ww  w .  j  a v  a 2 s . c  o m*/
    super(owner, title, ModalityType.APPLICATION_MODAL);

    this.wwwRoot = www;
    this.preferences = prefs;

    if (serverIconImage != null) {
        setIconImage(serverIconImage);
    }

    Iterator<DalDbProviderService> iter = ServiceRegistry.lookupProviders(DalDbProviderService.class);
    while (iter.hasNext()) {
        DalDbProviderService s = iter.next();
        factoryTabbedPane.addTab(s.getProviderName(), new ProviderPanel(s));
    }

    List<String> hostnames = DalServerUtil.collectHostnamesForChoice(true);
    hostnameChoice = new JComboBox<String>(hostnames.toArray(new String[hostnames.size()]));

    wwwRootPath.setText(wwwRoot.getPath());

    Box buttons = Box.createHorizontalBox();
    buttons.add(Box.createHorizontalStrut(10));
    buttons.add(okButton);
    buttons.add(Box.createHorizontalGlue());
    buttons.add(cancelButton);
    buttons.add(Box.createHorizontalStrut(10));

    getContentPane().add(BorderLayout.NORTH, initGui());
    getContentPane().add(BorderLayout.SOUTH, buttons);
    pack();

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent e) {
            removeWindowListener(this);
            if (owner != null) {
                GuiUtil.centreOnOwner(AskServerParams.this);
            } else {
                GuiUtil.centreOnScreen(AskServerParams.this);
            }
            okButton.requestFocus(); // unless it is disabled !
        }
    });
}

From source file:com.diversityarrays.kdxplore.specgroup.SpecimenGroupEditor.java

private JComponent createTopComponent(Action extraAction) {

    //      refreshSpecimenList.setEnabled(false);
    loadAction.setEnabled(true);//from w  w  w  .  j  a va  2s  .c om

    Box specimenGroupControls = Box.createHorizontalBox();
    specimenGroupControls.add(downloadGroupsButton);
    if (extraAction != null) {
        specimenGroupControls.add(new JButton(extraAction));
    }
    specimenGroupControls.add(new JSeparator(JSeparator.VERTICAL));
    //      specimenGroupControls.add(new JButton(refreshSpecimenList));
    specimenGroupControls.add(new JButton(loadAction));

    specimenGroupTableModel = new SpecimenGroupTableModel();
    specimenGroupTable = new JTable(specimenGroupTableModel);
    specimenGroupTable.setAutoCreateRowSorter(true);
    TableTransferHandler tth = TableTransferHandler.initialiseForCopySelectAll(specimenGroupTable, true);
    specimenGroupTable.setTransferHandler(tth);

    PromptScrollPane pane = new PromptScrollPane("No Specimen Groups Found");
    pane.add(specimenGroupTable);
    specimenGroupTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    specimenGroupTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                List<Specimen> list = null;
                int vrow = specimenGroupTable.getSelectedRow();
                if (vrow >= 0) {
                    int mrow = specimenGroupTable.convertRowIndexToModel(vrow);
                    if (mrow >= 0) {
                        list = specimenGroupTableModel.getSpecimensAt(mrow);
                    }
                }
                specimenTableModel.setData(list);
            }
        }
    });

    JPanel containerPanel = new JPanel(new BorderLayout());
    containerPanel.add(specimenGroupControls, BorderLayout.NORTH);
    containerPanel.add(new TitledTablePanel("Specimen Groups", specimenGroupTable, "No Specimen Groups Loaded"),
            BorderLayout.CENTER);

    return containerPanel;
}

From source file:io.heming.accountbook.ui.MainFrame.java

private void initStatusBar() {
    statusBar = Box.createHorizontalBox();
    statusBar.setPreferredSize(new Dimension(getWidth(), 26));
    statusBar.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0),
            BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)));

    ImageIcon loading = new ImageIcon(getClass().getResource("stopped-loader.png"));
    statusLabel = new JLabel("", loading, JLabel.LEFT);
    statusLabel.setHorizontalAlignment(SwingConstants.LEFT);

    statusBar.add(statusLabel);// ww w . jav a  2 s.c om
    statusBar.add(Box.createHorizontalGlue());

    infoLabel = new JLabel();
    infoLabel.setForeground(Color.GRAY);
    infoLabel.setPreferredSize(new Dimension(270, 20));
    infoLabel.setMaximumSize(infoLabel.getPreferredSize());
    statusBar.add(infoLabel);
    statusBar.add(Box.createHorizontalStrut(20));

    pageLabel = new JLabel();
    pageLabel.setForeground(Color.GRAY);
    pageLabel.setPreferredSize(new Dimension(80, 20));
    pageLabel.setMaximumSize(pageLabel.getPreferredSize());
    statusBar.add(pageLabel);

    Insets insets = new Insets(2, 10, 2, 10);
    firstPageButton = new JButton();
    firstPageButton.setMargin(insets);
    firstPageButton.setActionCommand("");
    firstPageButton.setToolTipText("");
    firstPageButton.setIcon(new ImageIcon(getClass().getResource("go-first.png")));
    firstPageButton.addActionListener(e -> firstPage());

    prevPageButton = new JButton();
    prevPageButton.setMargin(insets);
    prevPageButton.setActionCommand("?");
    prevPageButton.setToolTipText("?");
    prevPageButton.setIcon(new ImageIcon(getClass().getResource("go-previous-2.png")));
    prevPageButton.addActionListener(e -> prevPage());

    nextPageButton = new JButton();
    nextPageButton.setMargin(insets);
    nextPageButton.setActionCommand("");
    nextPageButton.setToolTipText("");
    nextPageButton.setIcon(new ImageIcon(getClass().getResource("go-next-2.png")));
    nextPageButton.addActionListener(e -> nextPage());

    lastPageButton = new JButton();
    lastPageButton.setMargin(insets);
    lastPageButton.setActionCommand("");
    lastPageButton.setToolTipText("");
    lastPageButton.setIcon(new ImageIcon(getClass().getResource("go-last.png")));
    lastPageButton.addActionListener(e -> lastPage());

    statusBar.add(firstPageButton);
    statusBar.add(prevPageButton);
    statusBar.add(nextPageButton);
    statusBar.add(lastPageButton);

    add(statusBar, BorderLayout.SOUTH);
}

From source file:com.diversityarrays.kdxplore.specgroup.SpecimenGroupEditor.java

private JComponent createBottomComponent() {
    // =========/*from w ww.j  a  va2s  . c o m*/
    specimenTableModel = new SpecimenTableModel(null);
    specimenTableModel.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            exportSpecimenList.setEnabled(specimenTableModel.getRowCount() > 0);
        }
    });
    specimenTable = new JTable(specimenTableModel);

    specimenTable.setAutoCreateRowSorter(true);
    specimenTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                deleteSpecimenFromList.setEnabled(specimenTable.getSelectedRowCount() > 0);
            }
        }
    });
    //      specimenTableModel.addTableModelListener(new TableModelListener() {
    //            @Override
    //            public void tableChanged(TableModelEvent e) {
    //                fileDropTarget.setVisible(specimenTableModel.getRowCount() > 0);
    //            }
    //        });
    CompoundBorder border = new CompoundBorder(new LineBorder(Color.DARK_GRAY), new EmptyBorder(4, 2, 4, 2));
    fileDropTarget.setBorder(border);
    fileDropTarget.setBackground(Color.LIGHT_GRAY);
    //      fileDropTarget.setVisible(false);
    deleteSpecimenFromList.setEnabled(false);

    TitledTablePanel specimenTablePanel = new TitledTablePanel("Specimen", specimenTable,
            "Download from database,\n  Drag/drop Specimens or Drag/drop CSV File above");

    //      saveAction.setEnabled(false);
    //      downloadSpecimenList.setEnabled(false);
    exportSpecimenList.setEnabled(false);

    Box otherBox = Box.createHorizontalBox();
    otherBox.add(downloadSpecimensButton);
    otherBox.add(fileDropTarget);
    otherBox.add(Box.createHorizontalGlue());

    otherBox.add(new JButton(exportSpecimenList));
    otherBox.add(Box.createHorizontalGlue());
    otherBox.add(new JLabel("(local)"));
    otherBox.add(new JButton(deleteSpecimenFromList));

    JPanel containerPanel2 = new JPanel(new BorderLayout());
    containerPanel2.add(otherBox, BorderLayout.NORTH);
    containerPanel2.add(specimenTablePanel, BorderLayout.CENTER);

    fileDropTarget.setTransferHandler(flth);

    //        TableTransferHandler tth2 = TableTransferHandler.initialiseForCopySelectAll(specimenTable, true);
    //        ChainingTransferHandler cth = new ChainingTransferHandler(flth, genotypeTransferHandler, tth2);

    TransferHandler cth = genotypeTransferHandler;
    //        ChainingTH cth = new ChainingTH(genotypeTransferHandler, tth2);

    specimenTablePanel.scrollPane.setTransferHandler(cth);

    specimenTablePanel.setTransferHandler(cth);
    specimenTable.setTransferHandler(cth);
    specimenTable.setDragEnabled(true);

    return containerPanel2;
}

From source file:com.diversityarrays.kdxplore.trials.TrialExplorerPanel.java

public TrialExplorerPanel(KdxApp app, KdxPluginInfo pluginInfo, KDXDeviceService deviceService,
        TrialExplorerManager manager, OfflineData offlineData, DriverType dType, ImageIcon barcodeIcon,
        ClientUrlChanger clientUrlChanger, Consumer<Void> trialsChangedConsumer,
        Consumer<Collection<Trait>> traitRemovalHandler) {
    super(new BorderLayout());

    this.kdxApp = app;
    this.messagePrinter = pluginInfo.getMessagePrinter();
    this.messageLogger = pluginInfo.getMessageLogger();
    this.windowOpener = pluginInfo.getWindowOpener();
    this.backgroundRunner = pluginInfo.getBackgroundRunner();
    this.clientProvider = pluginInfo.getClientProvider();
    this.userDataFolder = pluginInfo.getUserDataFolder();

    this.kdxDeviceService = deviceService;
    this.trialsChangedConsumer = trialsChangedConsumer;
    this.traitRemovalHandler = traitRemovalHandler;

    Predicate<SeedPrepHarvestService> onHarvestFound = new Predicate<SeedPrepHarvestService>() {
        @Override/*from w w  w .  j  av a  2 s .co m*/
        public boolean test(SeedPrepHarvestService t) {
            seedPrepHarvestService = t;
            return false;
        }
    };

    Shared.detectServices(SeedPrepHarvestService.class, onHarvestFound,
            SEEDPREP_HARVEST_SERVICE_IMPL_CLASSNAME);
    if (this.seedPrepHarvestService != null) {
        PreferenceCollection pc = seedPrepHarvestService.getPreferenceCollection(kdxApp);
        if (pc != null) {
            KdxplorePreferences.getInstance().addPreferenceCollection(pc);
        }
    }

    PreferenceCollection pc = BarcodePreferences.getInstance().getPreferenceCollection(app, "Barcode");
    if (pc != null) {
        KdxplorePreferences.getInstance().addPreferenceCollection(pc);
    }

    this.trialExplorerManager = manager;
    this.clientUrlChanger = clientUrlChanger;
    this.driverType = dType;
    this.offlineData = offlineData;
    this.pluginInfo = pluginInfo;

    this.trialOverviewPanel = new TrialOverviewPanel("Trials Available", offlineData, trialExplorerManager,
            flth, messagePrinter, onTrialSelected);

    this.trialDetailsPanel = new TrialDetailsPanel(windowOpener, messagePrinter, backgroundRunner, offlineData,
            editTrialAction, seedPrepAction, harvestAction, uploadTrialAction, refreshTrialInfoAction,
            barcodeIcon, checkIfEditorActive, onTraitInstancesRemoved);

    //        addTrialsAction.setEnabled(false);

    currentTrialCardPanel.add( // NOTE: the null introduces a spacer
            new JustLabelPanel(new String[] { Msg.HTML_NO_TRIALS_LOADED() }, addTrialsAction),
            CARD_NO_TRIALS_LOADED);
    currentTrialCardPanel.add(new JustLabelPanel(new String[] { Msg.HTML_NO_TRIAL_SELECTED() }),
            CARD_NO_TRIAL_SELECTED);
    currentTrialCardPanel.add(trialDetailsPanel, CARD_TRIAL);
    currentTrialCardPanel.add(errorsGettingTrialData, CARD_ERRORS_GETTING_TRIAL_DATA);

    offlineData.addOfflineDataChangeListener(offlineDataChangeListener);

    // KDClientUtils.initAction(ImageId.EXPAND_ALL, expandAllAction,
    // "Expand All");
    // KDClientUtils.initAction(ImageId.COLLAPSE_ALL, collapseAllAction,
    // "Collapse All");

    KDClientUtils.initAction(ImageId.TRASH_24, removeTrialAction,
            "<HTML>Remove Trial from Offline storage<BR>(Shift-Click to also remove Traits)"); // TODO i18n
    removeTrialAction.setEnabled(false);

    KDClientUtils.initAction(ImageId.ADD_TRIALS_24, addTrialsAction, ADD_TRIALS);
    addDatabaseTrialsButton = new JButton(addTrialsAction);

    KDClientUtils.initAction(ImageId.EDIT_BLUE_24, editTrialAction, "Edit current Trial"); // TODO i18n
    editTrialAction.setEnabled(false);

    KDClientUtils.initAction(ImageId.UPLOAD_24, uploadTrialAction, "Store Trial in Database"); // TODO i18n
    uploadTrialAction.setEnabled(false);

    KDClientUtils.initAction(ImageId.GET_TRIALINFO_24, refreshTrialInfoAction,
            REFRESH_TRIAL_INFO + " from Database"); // TODO
                                                                                                                               // i18n
    refreshTrialInfoAction.setEnabled(false);

    KdxploreConfig config = KdxploreConfig.getInstance();

    KDClientUtils.initAction(ImageId.SEED_PREP_24, seedPrepAction,
            "Seed Preparation Wizard" + AbstractMsg.BETA_SUFFIX); // TODO
                                                                                                                                 // i18n
    seedPrepAction.setEnabled(0 != (CONFIG_FLAG_SEEDPREP & config.getFlags()));

    KDClientUtils.initAction(ImageId.HARVEST_WHEAT_24, harvestAction,
            "Harvest Wizard" + AbstractMsg.BETA_SUFFIX); // TODO i18n
    harvestAction.setEnabled(0 != (CONFIG_FLAG_HARVEST & config.getFlags()));

    @SuppressWarnings("rawtypes")
    DartEntityFeature[] descriptors = DartEntityBeanRegistry.TRIAL_BEAN_INFO.findDescriptors(
            Trial.COLNAME_TRIAL_NAME, Trial.COLNAME_TRIAL_ACRONYM, Trial.COLNAME_ORGANISM_TYPE,
            Trial.COLNAME_TRIAL_LAYOUT);

    // trialOverviewPanel.initialiseStructure(descriptors);

    trialOverviewPanel.setTransferHandler(flth);

    trialOverviewPanel.addActionListener(trialOverviewActionListener);

    trialOverviewPanel.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                updateCurrentTrial();
            }
        }
    });

    // trialListSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
    // new JScrollPane(trialOverviewPanel),
    // currentTrialCardPanel);
    // trialListSplit.setResizeWeight(0.7);
    // trialListSplit.setOneTouchExpandable(true);

    Box leftButtons = Box.createHorizontalBox();
    leftButtons.add(addDatabaseTrialsButton);

    leftButtons.add(Box.createHorizontalGlue());

    leftButtons.add(new JButton(removeTrialAction));

    // TODO enable this after fixing the
    // use of SampleGroup in the wizard
    // importCsvAction.setEnabled(false);
    // leftButtons.add(new JButton(importCsvAction));
    // leftButtons.add(Box.createHorizontalGlue());

    JPanel left = new JPanel(new BorderLayout());
    left.add(leftButtons, BorderLayout.NORTH);
    left.add(trialOverviewPanel, BorderLayout.CENTER);

    // trialTable.setDefaultRenderer(Integer.class, new
    // NumberCellRenderer());
    // trialTable.setDefaultRenderer(String.class, new
    // StringCellRenderer(trialTableModel));

    lrSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, createCurrentTrialPanel());
    lrSplitPane.setResizeWeight(0.5);
    lrSplitPane.setOneTouchExpandable(true);

    add(lrSplitPane, BorderLayout.CENTER);

    // GuiUtil.setVisibleRowCount(todoTable, 6);

}

From source file:org.biojava.bio.view.MotifAnalyzer.java

private Box getControlBox(SequencePanel seqPanel, String seqName) {
    JSlider scale;/*w  w  w .  jav  a 2  s .c om*/
    Box controlBox = null;
    if (controlBox == null) {
        controlBox = Box.createHorizontalBox();
        scale = new JSlider(SwingConstants.HORIZONTAL, 1, 100, INITIAL_SCALE);

        controlBox.add(new JLabel(seqName));
        controlBox.add(Box.createHorizontalGlue());
        controlBox.add(Box.createHorizontalStrut(10));
        controlBox.add(Box.createHorizontalGlue());
        controlBox.add(new JLabel("Scale"));
        controlBox.add(Box.createHorizontalStrut(5));
        controlBox.add(scale);
        controlBox.add(Box.createHorizontalGlue());

        scale.addChangeListener(new SliderListener(seqPanel));
    }
    return controlBox;
}

From source file:net.sourceforge.squirrel_sql.client.preferences.UpdatePreferencesPanel.java

private JPanel createUpdateSitePanel() {
    JPanel pnl = new JPanel(new GridBagLayout());
    pnl.setBorder(BorderFactory.createTitledBorder(i18n.UPDATE_SITE_BORDER_LABEL));

    ItemListener urlUpdateItemListener = new UrlItemListener();
    DocumentListener urlDocumentListener = new UrlDocumentListener();
    final GridBagConstraints gbc = new GridBagConstraints();

    setSeparatorConstraints(gbc, 0);/*from  w  ww  .  j  a  va  2  s  .  com*/
    gbc.gridwidth = 1;
    gbc.weightx = 0;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.EAST;
    siteTypeLabel = new JLabel(i18n.SITE_TYPE_LABEL, JLabel.RIGHT);
    pnl.add(siteTypeLabel, gbc);

    // Site type

    setSeparatorConstraints(gbc, 0);
    gbc.gridx = 1;
    gbc.gridwidth = 1;
    gbc.fill = GridBagConstraints.NONE;
    pnl.add(getSiteTypePanel(), gbc);

    setSeparatorConstraints(gbc, 1);
    pnl.add(getSep(), gbc);

    // Update server name

    setLabelConstraints(gbc, 2);
    _serverLabel = new JLabel(i18n.SERVER, SwingConstants.RIGHT);
    pnl.add(_serverLabel, gbc);

    setFieldConstraints(gbc, 2);
    _updateServerName.getDocument().addDocumentListener(urlDocumentListener);
    pnl.add(_updateServerName, gbc);

    // Update server port

    setLabelConstraints(gbc, 3);
    _portLabel = new JLabel(i18n.PORT, SwingConstants.RIGHT);
    pnl.add(_portLabel, gbc);

    setFieldConstraints(gbc, 3);
    _updateServerPort.getDocument().addDocumentListener(urlDocumentListener);
    pnl.add(_updateServerPort, gbc);

    // Path to release.xml

    setLabelConstraints(gbc, 4);
    _pathLabel = new JLabel(i18n.PATH, SwingConstants.RIGHT);
    pnl.add(_pathLabel, gbc);

    setFieldConstraints(gbc, 4);
    _updateServerPath.getDocument().addDocumentListener(urlDocumentListener);
    pnl.add(_updateServerPath, gbc);

    // Channnel combo-box

    setLabelConstraints(gbc, 5);
    _channelLabel = new JLabel(i18n.CHANNEL, SwingConstants.RIGHT);
    pnl.add(_channelLabel, gbc);

    setFieldConstraints(gbc, 5);
    gbc.fill = GridBagConstraints.NONE;
    _updateServerChannel.addItemListener(urlUpdateItemListener);
    pnl.add(_updateServerChannel, gbc);

    // URL text field

    setLabelConstraints(gbc, 6);
    _urlLabel = new JLabel(i18n.URL, SwingConstants.RIGHT);
    pnl.add(_urlLabel, gbc);

    setFieldConstraints(gbc, 6);
    updateUrl();
    pnl.add(_updateUrl, gbc);

    setFieldConstraints(gbc, 7);
    JLabel lblProxy = new JLabel(s_stringMgr.getString("UpdatePreferencesPanel.proxyHintHtml"));
    lblProxy.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    lblProxy.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            _prefrenceTabActvivationListener.activateTabForClass(ProxyPreferenceTabComponent.class);
        }
    });
    pnl.add(lblProxy, gbc);

    // Test Connection Button Panel (Both the button and the status label

    setFieldConstraints(gbc, 8);

    Box buttonBox = Box.createHorizontalBox();
    buttonBox.add(_testConnectionButton);
    buttonBox.add(Box.createHorizontalStrut(20));
    buttonBox.add(_testConnectionStatusLabel);
    _testConnectionButton.addActionListener(new TestConnectionButtonListener());
    pnl.add(buttonBox, gbc);

    // Separator

    setSeparatorConstraints(gbc, 9);
    pnl.add(getSep(), gbc);

    // Local update directory

    setLabelConstraints(gbc, 10);
    _localPathLabel = new JLabel(i18n.LOCAL_PATH, SwingConstants.RIGHT);
    pnl.add(_localPathLabel, gbc);

    setFieldConstraints(gbc, 10);
    pnl.add(_localPath, gbc);
    return pnl;
}

From source file:org.apache.jmeter.protocol.amf.visualizers.RenderAsXPathAMF.java

/**
 * Create the XPath task pane/*ww  w  .  j  a v  a2 s  .c om*/
 *
 * @return XPath task pane
 */
private JPanel createXpathExtractorTasksPanel() {
    Box xpathActionPanel = Box.createVerticalBox();

    Box selectorAndButton = Box.createHorizontalBox();

    Border margin = new EmptyBorder(5, 5, 0, 5);
    xpathActionPanel.setBorder(margin);
    xpathExpressionField = new JLabeledTextField(JMeterUtils.getResString("xpath_tester_field")); // $NON-NLS-1$

    JButton xpathTester = new JButton(JMeterUtils.getResString("xpath_tester_button_test")); // $NON-NLS-1$
    xpathTester.setActionCommand(XPATH_TESTER_COMMAND);
    xpathTester.addActionListener(this);

    selectorAndButton.add(xpathExpressionField);
    selectorAndButton.add(xpathTester);

    xpathActionPanel.add(selectorAndButton);
    xpathActionPanel.add(xmlConfPanel);
    xpathActionPanel.add(getFragment);

    xpathResultField = new JTextArea();
    xpathResultField.setEditable(false);
    xpathResultField.setLineWrap(true);
    xpathResultField.setWrapStyleWord(true);

    JPanel xpathTasksPanel = new JPanel(new BorderLayout(0, 5));
    xpathTasksPanel.add(xpathActionPanel, BorderLayout.NORTH);
    xpathTasksPanel.add(GuiUtils.makeScrollPane(xpathResultField), BorderLayout.CENTER);

    return xpathTasksPanel;
}

From source file:org.colombbus.tangara.update.SoftwareUpdateDialog.java

private void addButtonPane() {
    Box box = Box.createHorizontalBox();
    box.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    box.add(Box.createGlue());//from   w ww . ja  va  2 s. c  o m
    String closeLabel = bundle.getString("SoftwareUpdateDialog.close"); //$NON-NLS-1$
    closeButton = new JButton(closeLabel);
    closeButton.addActionListener(this);
    box.add(closeButton);
    add(box, BorderLayout.SOUTH);
}