Example usage for javax.swing Box createHorizontalGlue

List of usage examples for javax.swing Box createHorizontalGlue

Introduction

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

Prototype

public static Component createHorizontalGlue() 

Source Link

Document

Creates a horizontal glue component.

Usage

From source file:net.sf.maltcms.chromaui.chromatogram1Dviewer.ui.Chromatogram1DViewTopComponent.java

public void initialize(final IChromAUIProject project, final List<IChromatogramDescriptor> filename,
        final ADataset1D<IChromatogram1D, IScan> ds) {
    boolean initializedSucccess = initialized.compareAndSet(false, true);
    if (initializedSucccess) {
        final Chromatogram1DViewTopComponent instance = this;
        final ProgressHandle handle = ProgressHandleFactory.createHandle("Loading chart");
        final JComponent progressComponent = ProgressHandleFactory.createProgressComponent(handle);
        final JPanel box = new JPanel();
        box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS));
        box.add(Box.createHorizontalGlue());
        box.add(progressComponent);/*from  www.  j  a v  a2 s  .c om*/
        box.add(Box.createHorizontalGlue());
        add(box, BorderLayout.CENTER);
        AProgressAwareRunnable runnable = new AProgressAwareRunnable() {
            @Override
            public void run() {
                try {
                    handle.start();
                    handle.progress("Initializing Overlays...");
                    if (project != null) {
                        ic.add(project);
                    }
                    dataset = ds;
                    annotations = new ArrayList<>(0);
                    final DefaultComboBoxModel dcbm = new DefaultComboBoxModel();
                    for (IChromatogramDescriptor descr : filename) {
                        ic.add(descr);
                        List<ChartOverlay> overlays = new LinkedList<>();
                        if (project != null) {
                            Collection<Peak1DContainer> peaks = project.getPeaks(descr);
                            for (Peak1DContainer container : peaks) {
                                Peak1DOverlay overlay = new Peak1DOverlay(descr, container.getName(),
                                        container.getDisplayName(), container.getShortDescription(), true,
                                        container);
                                ic.add(overlay);
                                overlays.add(overlay);
                            }
                        }
                        /*
                         * Virtual overlay that groups all related overlays
                         */
                        ChromatogramDescriptorOverlay cdo = new ChromatogramDescriptorOverlay(descr,
                                descr.getName(), descr.getDisplayName(), descr.getShortDescription(), true,
                                overlays);
                        ic.add(cdo);
                        // create node children for display in navigator view
                        Children children = Children.create(new ChartOverlayChildFactory(overlays), true);
                        // create the actual node for this chromatogram
                        ic.add(Charts.overlayNode(cdo, children));
                        for (int i = 0; i < ds.getSeriesCount(); i++) {
                            if (ds.getSeriesKey(i).toString().equals(descr.getDisplayName())) {
                                dcbm.addElement(new SeriesItem(cdo, ds.getSeriesKey(i), true));
                            }
                        }
                    }
                    ic.add(ds);
                    handle.progress("Initializing Settings and Properties...");
                    ic.add(new Properties());
                    sp = new SettingsPanel();
                    ic.add(sp);
                    result = Utilities.actionsGlobalContext().lookupResult(ChromatogramViewViewport.class);
                    result.addLookupListener(instance);
                    handle.progress("Creating panel...");
                    jp = new Chromatogram1DViewPanel(ic, getLookup(), ds);
                    ic.add(jp);
                    ic.add(this);
                    SwingUtilities.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            //EDT stuff
                            setDisplayName("Chromatogram View of " + new File(
                                    getLookup().lookup(IChromatogramDescriptor.class).getResourceLocation())
                                            .getName());
                            setToolTipText(
                                    getLookup().lookup(IChromatogramDescriptor.class).getResourceLocation());
                            seriesComboBox.setModel(dcbm);
                            remove(box);
                            add(new JScrollPane(jp, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                    JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER);
                            load();
                        }
                    });
                } finally {
                    handle.finish();
                }
            }
        };
        runnable.setProgressHandle(handle);
        AProgressAwareRunnable.createAndRun("Creating chart", runnable);
    }
}

From source file:com.diversityarrays.kdxplore.heatmap.HeatMapParamsDialog.java

public HeatMapParamsDialog(VisualisationTool vtool, CurationContext ctx,
        //         PlotInfoProvider pip,
        SelectedValueStore svs, Map<TraitInstance, SimpleStatistics<?>> numericStatsByTraitInstance,
        Map<JFrame, HeatMapPanelParameters> heatMapPanelParamsByFrame, VisToolOpenClose vtoc,
        SuppressionHandler suppressionHandler) {
    super(ctx.getDialogOwnerWindow(), Msg.TOOLNAME_HEATMAP(), ModalityType.MODELESS);

    this.suppressionHandler = suppressionHandler;
    this.visualisationTool = vtool;
    this.context = ctx;
    this.selectedValueStore = svs;
    //      this.plotInfoProvider = pip;
    this.heatMapPanelParamsByFrame = heatMapPanelParamsByFrame;
    this.visToolOpenClose = vtoc;

    //      this.heatMapFrameByPane = new HashMap<JFrame, HeatMapPane>();

    List<ValueRetriever<?>> positionAndPlotRetrievers = new ArrayList<>();
    Trial trial = context.getTrial();//w  w w .ja v a 2 s  .  c  o m
    positionAndPlotRetrievers.addAll(ValueRetrieverFactory.getPlotIdentValueRetrievers(trial));

    Map<PlotAttribute, Set<String>> attributesAndValues = context.getPlotAttributesAndValues();

    for (PlotAttribute pa : attributesAndValues.keySet()) {
        positionAndPlotRetrievers.add(new PlotAttributeValueRetriever(pa, attributesAndValues.get(pa)));
    }

    pnatPanel = new AskForPositionNamesAndTraitInstancePanel(2, // positionNames 
            1, // traitInstances
            positionAndPlotRetrievers, numericStatsByTraitInstance, enableActionNotifier, context);

    createHeatMapAction.setEnabled(false);

    Box buttons = Box.createHorizontalBox();
    buttons.add(Box.createHorizontalGlue());
    buttons.add(new JButton(createHeatMapAction));

    getContentPane().add(pnatPanel, BorderLayout.CENTER);
    getContentPane().add(buttons, BorderLayout.SOUTH);

    pack();
}

From source file:org.jcurl.demo.editor.EditorApp.java

public EditorApp() {
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            EditorApp.this.cmdExit();
        }//from w w w  . j av a2s . c  om
    });
    master = new RockEditDisplay();
    master.setPos(mod_locations);
    master.setSpeed(mod_speeds);
    final PositionDisplay pnl2 = new PositionDisplay();
    pnl2.setPos(mod_locations);
    pnl2.setZoom(Zoomer.HOG2HACK);

    final Container con = getContentPane();

    con.add(master, "Center");
    con.add(new SumWaitDisplay(mod_locations), "West");
    con.add(new SumShotDisplay(mod_locations), "East");
    {
        final Box b0 = Box.createVerticalBox();
        final Box b1 = Box.createHorizontalBox();
        b1.add(Box.createRigidArea(new Dimension(0, 75)));
        b1.add(pnl2);
        b0.add(b1);
        b0.add(new JSlider(0, 100, 0));
        final Box b2 = Box.createHorizontalBox();
        b2.add(Box.createHorizontalGlue());
        b2.add(bStart = this.newButton("Start", this, "cmdRunStart"));
        b2.add(bPause = this.newButton("Pause", this, "cmdRunPause"));
        b2.add(bStop = this.newButton("Stop", this, "cmdRunStop"));
        b2.add(Box.createHorizontalGlue());
        b0.add(b2);
        con.add(b0, "South");
    }
    bStop.getAction().actionPerformed(null);

    setJMenuBar(createMenu());
    refreshTitle();
    this.setSize(900, 400);

    new SpeedController(mod_locations, mod_speeds, master);
    new LocationController(mod_locations, pnl2);
    lastSaved = mod_locations.getLastChanged();
}

From source file:org.photovault.swingui.PhotoInfoDlg.java

/**
   Creates the UI components needed for this dialog.
*//*  w  w w  . java  2  s.c om*/
protected void createUI() {
    Container parentView = getParentController().getView();
    Window wnd = SwingUtilities.getWindowAncestor(parentView);
    dialogWindow = new JDialog((Frame) wnd);
    editor = new PhotoInfoEditor(this);
    addView(editor);
    dialogWindow.getContentPane().add(editor, BorderLayout.NORTH);
    final PhotoInfoDlg staticThis = this;

    registerAction("save_close", new DataAccessAction("OK") {
        public void actionPerformed(ActionEvent actionEvent, org.hibernate.Session currentSession) {
            save();
            dialogWindow.setVisible(false);
        }

    });
    registerAction("discard_close", new DataAccessAction("Cancel") {
        public void actionPerformed(ActionEvent actionEvent, org.hibernate.Session currentSession) {
            discard();
            dialogWindow.setVisible(false);
        }

    });

    JButton okBtn = new JButton(this.getActionAdapter("save_close"));
    //   okBtn.addActionListener( new ActionListener() {
    //            public void actionPerformed( ActionEvent e ) {
    //                try {
    //                    ChangePhotoInfoCommand cmd = ctrl.getChangeCommand();
    //                    masterCtrl.getCommandHandler().executeCommand( cmd );
    //                    photoChanged = true;
    //                    setVisible( false );
    //                } catch ( Exception ex ) {
    //                    JOptionPane.showMessageDialog(
    //                            staticThis,
    //                            "Error while saving changes: \n" + ex.getMessage(),
    //                            "Error saving changes",
    //                            JOptionPane.ERROR_MESSAGE,
    //                            null );
    //                    log.warn( "problem while saving changes: " + ex.getMessage() );
    //                }
    //            }
    //        } );

    JButton applyBtn = new JButton(getActionAdapter("save"));
    //        applyBtn.addActionListener( new ActionListener() {
    //            public void actionPerformed( ActionEvent e ) {
    //                try {
    //                    ChangePhotoInfoCommand cmd = ctrl.getChangeCommand();
    //                    masterCtrl.getCommandHandler().executeCommand( cmd );
    //                    photoChanged = true;
    //                } catch ( Exception ex ) {
    //                    JOptionPane.showMessageDialog(
    //                            staticThis,
    //                            "Error while saving changes: \n" + ex.getMessage(),
    //                            "Error saving changes",
    //                            JOptionPane.ERROR_MESSAGE,
    //                            null );
    //                    log.warn( "problem while saving changes: " + ex.getMessage() );
    //                }
    //            }
    //        } );

    JButton discardBtn = new JButton(getActionAdapter("discard"));
    //        discardBtn.addActionListener( new ActionListener() {
    //            public void actionPerformed( ActionEvent e ) {
    //                ctrl.discard();
    //            }
    //        } );

    JButton closeBtn = new JButton(getActionAdapter("discard_close"));
    //        closeBtn.addActionListener( new ActionListener() {
    //            public void actionPerformed( ActionEvent e ) {
    //                ctrl.discard();
    //                setVisible( false );
    //            }
    //        } );

    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));
    buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    buttonPane.add(Box.createHorizontalGlue());
    buttonPane.add(okBtn);
    buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonPane.add(applyBtn);
    buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonPane.add(discardBtn);
    buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonPane.add(closeBtn);
    dialogWindow.getContentPane().add(buttonPane, BorderLayout.SOUTH);

    dialogWindow.getRootPane().setDefaultButton(applyBtn);

    dialogWindow.pack();
}

From source file:org.ut.biolab.medsavant.client.view.component.SelectableListView.java

protected final void initContentPanel() {

    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();

    if (availableValues == null) {
        JTextArea label = new JTextArea("There are too many values to display.");
        label.setOpaque(false);//  w  w  w. j  a  va 2 s  .  c om
        label.setLineWrap(true);
        label.setWrapStyleWord(true);

        gbc.weightx = 1.0;
        gbc.weighty = 1.0;
        gbc.fill = GridBagConstraints.BOTH;
        gbc.insets = new Insets(3, 3, 3, 3);
        add(label, gbc);
        return;
    }

    AbstractListModel model = new SelectableListView.SimpleListModel();

    field = new QuickListFilterField(model);
    field.setHintText("Type here to filter options");

    // the width of the field has to be less than the width
    // provided to the filter, otherwise, it will push the grid wider
    // and components will be inaccessible
    field.setPreferredSize(new Dimension(FIELD_WIDTH, 22));

    filterableList = new FilterableCheckBoxList(field.getDisplayListModel()) {
        @Override
        public int getNextMatch(String prefix, int startIndex, Position.Bias bias) {
            return -1;
        }

        @Override
        public boolean isCheckBoxEnabled(int index) {
            return true;
        }
    };
    filterableList.getCheckBoxListSelectionModel()
            .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    if (model.getSize() > 0) {
        filterableList.setPrototypeCellValue(model.getElementAt(0)); // Makes it much faster to determine the view's preferred size.
    }

    SearchableUtils.installSearchable(filterableList);

    setAllSelected(true);

    JScrollPane jsp = new JScrollPane(filterableList) {
        @Override
        public Dimension getPreferredSize() {
            Dimension result = super.getPreferredSize();
            result = new Dimension(Math.min(result.width, SelectableListView.this.getWidth() - 20),
                    result.height);
            return result;
        }
    };

    selectAll = ViewUtil.createHyperLinkButton("Select All");
    selectAll.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setAllSelected(true);
        }
    });

    JButton selectNone = ViewUtil.createHyperLinkButton("Select None");

    selectNone.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setAllSelected(false);
        }
    });

    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(3, 15, 3, 15);
    add(field, gbc);

    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(3, 3, 3, 3);
    add(jsp, gbc);

    gbc.gridwidth = 1;
    gbc.weightx = 0.0;
    gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;

    JPanel bottom = new JPanel();
    ViewUtil.applyHorizontalBoxLayout(bottom);

    bottom.add(selectAll);
    bottom.add(selectNone);
    bottom.add(Box.createHorizontalGlue());

    JButton applyButton = new JButton("Apply");
    applyButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            saveSelections();
        }

    });
    bottom.add(applyButton);
    add(bottom, gbc);
}

From source file:com.apatar.ui.JFeatureRequestHelpDialog.java

private void createDialog() {
    setLayout(new BorderLayout(5, 5));

    setSize(400, 400);// w  w  w .  ja v a  2s  .c o  m

    JPanel textPanel = new JPanel(new BorderLayout(5, 5));
    textPanel.setBorder(new EmptyBorder(10, 5, 5, 5));
    text.setLineWrap(true);
    text.setWrapStyleWord(true);
    text.setFont(UiUtils.NORMAL_SIZE_12_FONT);

    textPanel.add(new JLabel("What new Apatar features would you like to request? Please describe them:"),
            BorderLayout.NORTH);
    textPanel.add(new JScrollPane(text), BorderLayout.CENTER);

    JPanel contactPanel = new JPanel();
    contactPanel.setLayout(new BoxLayout(contactPanel, BoxLayout.Y_AXIS));

    JPanel firstNamePanel = new JPanel();
    firstNamePanel.setLayout(new BoxLayout(firstNamePanel, BoxLayout.X_AXIS));
    firstNamePanel.add(new JLabel("Your First Name:"));
    firstNamePanel.add(Box.createHorizontalStrut(5));
    firstNamePanel.add(firstNameField);

    JPanel lastNamePanel = new JPanel();
    lastNamePanel.setLayout(new BoxLayout(lastNamePanel, BoxLayout.X_AXIS));
    lastNamePanel.add(new JLabel("Your Last Name:"));
    lastNamePanel.add(Box.createHorizontalStrut(5));
    lastNamePanel.add(lastNameField);

    JPanel emailPanel = new JPanel();
    emailPanel.setLayout(new BoxLayout(emailPanel, BoxLayout.X_AXIS));
    emailPanel.add(new JLabel("Your E-mail:"));
    emailPanel.add(Box.createHorizontalStrut(28));
    emailPanel.add(emailField);

    contactPanel.add(firstNamePanel);
    contactPanel.add(Box.createVerticalStrut(5));
    contactPanel.add(lastNamePanel);
    contactPanel.add(Box.createVerticalStrut(5));
    contactPanel.add(emailPanel);

    textPanel.add(contactPanel, BorderLayout.SOUTH);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    buttonPanel.add(Box.createHorizontalGlue());
    buttonPanel.add(sendButton);
    buttonPanel.add(Box.createHorizontalStrut(5));
    buttonPanel.add(cancel);
    buttonPanel.add(Box.createHorizontalStrut(5));
    buttonPanel.setBorder(new EmptyBorder(0, 0, 5, 0));

    getContentPane().add(textPanel, BorderLayout.CENTER);
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);
}

From source file:com.apatar.ui.JSubmitHelpDialog.java

private void createDialog() {
    setLayout(new BorderLayout(5, 5));

    setSize(400, 400);//from  www  .ja  v a2 s.  com

    JPanel textPanel = new JPanel(new BorderLayout(5, 5));
    textPanel.setBorder(new EmptyBorder(10, 5, 5, 5));
    text.setLineWrap(true);
    text.setWrapStyleWord(true);
    text.setFont(UiUtils.NORMAL_SIZE_12_FONT);

    textPanel.add(new JLabel("If you found a bug, please submit it here:"), BorderLayout.NORTH);
    textPanel.add(new JScrollPane(text), BorderLayout.CENTER);

    JPanel contactPanel = new JPanel();
    contactPanel.setLayout(new BoxLayout(contactPanel, BoxLayout.Y_AXIS));

    JPanel firstNamePanel = new JPanel();
    firstNamePanel.setLayout(new BoxLayout(firstNamePanel, BoxLayout.X_AXIS));
    firstNamePanel.add(new JLabel("Your First Name:"));
    firstNamePanel.add(Box.createHorizontalStrut(5));
    firstNamePanel.add(firstNameField);

    JPanel lastNamePanel = new JPanel();
    lastNamePanel.setLayout(new BoxLayout(lastNamePanel, BoxLayout.X_AXIS));
    lastNamePanel.add(new JLabel("Your Last Name:"));
    lastNamePanel.add(Box.createHorizontalStrut(5));
    lastNamePanel.add(lastNameField);

    JPanel emailPanel = new JPanel();
    emailPanel.setLayout(new BoxLayout(emailPanel, BoxLayout.X_AXIS));
    emailPanel.add(new JLabel("Your E-mail:"));
    emailPanel.add(Box.createHorizontalStrut(28));
    emailPanel.add(emailField);

    contactPanel.add(firstNamePanel);
    contactPanel.add(Box.createVerticalStrut(5));
    contactPanel.add(lastNamePanel);
    contactPanel.add(Box.createVerticalStrut(5));
    contactPanel.add(emailPanel);

    textPanel.add(contactPanel, BorderLayout.SOUTH);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    buttonPanel.add(Box.createHorizontalGlue());
    buttonPanel.add(sendButton);
    buttonPanel.add(Box.createHorizontalStrut(5));
    buttonPanel.add(cancel);
    buttonPanel.add(Box.createHorizontalStrut(5));
    buttonPanel.setBorder(new EmptyBorder(0, 0, 5, 0));

    getContentPane().add(textPanel, BorderLayout.CENTER);
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);
}

From source file:org.zaproxy.zap.extension.quickstart.AttackPanel.java

@Override
public JPanel getContentPanel() {
    if (contentPanel == null) {
        contentPanel = new JPanel(new GridBagLayout());
        contentPanel.setBackground(Color.WHITE);
        int formPanelY = 0;

        contentPanel.add(new JLabel(Constant.messages.getString("quickstart.label.attackurl")),
                LayoutHelper.getGBC(1, formPanelY, 1, 0.0D, DisplayUtils.getScaledInsets(5, 5, 5, 5)));

        JPanel urlSelectPanel = new JPanel(new GridBagLayout());
        selectButton = new JButton(Constant.messages.getString("all.button.select"));
        selectButton.setIcon(//w  ww  .  ja va  2 s.co  m
                DisplayUtils.getScaledIcon(new ImageIcon(View.class.getResource("/resource/icon/16/094.png")))); // Globe
        // icon
        selectButton.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent e) {
                NodeSelectDialog nsd = new NodeSelectDialog(View.getSingleton().getMainFrame());
                SiteNode node = null;
                try {
                    node = Model.getSingleton().getSession().getSiteTree()
                            .findNode(new URI(getUrlField().getSelectedItem().toString(), false));
                } catch (Exception e2) {
                    // Ignore
                }
                node = nsd.showDialog(node);
                if (node != null && node.getHistoryReference() != null) {
                    try {
                        getUrlField().setSelectedItem(node.getHistoryReference().getURI().toString());
                    } catch (Exception e1) {
                        // Ignore
                    }
                }
            }
        });

        urlSelectPanel.add(this.getUrlField(), LayoutHelper.getGBC(0, 0, 1, 0.5D));
        urlSelectPanel.add(selectButton, LayoutHelper.getGBC(1, 0, 1, 0.0D));
        contentPanel.add(urlSelectPanel, LayoutHelper.getGBC(2, formPanelY, 3, 0.25D));

        contentPanel.add(new JLabel(Constant.messages.getString("quickstart.label.tradspider")),
                LayoutHelper.getGBC(1, ++formPanelY, 1, 0.0D, DisplayUtils.getScaledInsets(5, 5, 5, 5)));
        contentPanel.add(getSpiderCheckBox(),
                LayoutHelper.getGBC(2, formPanelY, 1, 0.0D, DisplayUtils.getScaledInsets(5, 5, 5, 5)));

        plugableSpiderY = ++formPanelY;

        JPanel buttonPanel = QuickStartHelper.getHorizontalPanel();
        buttonPanel.add(this.getAttackButton());
        buttonPanel.add(this.getStopButton());
        buttonPanel.add(Box.createHorizontalGlue());
        contentPanel.add(buttonPanel, LayoutHelper.getGBC(2, ++formPanelY, 1, 1.0D));

        contentPanel.add(new JLabel(Constant.messages.getString("quickstart.label.progress")),
                LayoutHelper.getGBC(1, ++formPanelY, 1, 0.0D, DisplayUtils.getScaledInsets(5, 5, 5, 5)));

        contentPanel.add(getProgressLabel(), LayoutHelper.getGBC(2, formPanelY, 1, 1.0D));

        paddingY = ++formPanelY;
        this.replacePadding();
    }

    return contentPanel;
}

From source file:uk.nhs.cfh.dsp.srth.desktop.modules.queryresultspanel.QueryResultsPanel.java

/**
 * Inits the components.//w  w w . j  a v  a2  s . c o m
 */
public synchronized void initComponents() {

    while (activeFrame != null) {
        if (applicationService != null && applicationService.getFrameView() != null) {
            activeFrame = applicationService.getFrameView().getActiveFrame();
        }
    }

    resultCountLabel = new JXLabel(QUERY_COUNT_PREFIX + resultSetCount + QUERY_COUNT_SUFFIX);
    resultCountLabel.setHorizontalTextPosition(SwingConstants.LEFT);
    queryTimeLabel = new JXLabel(QUERY_TIME_PREFIX + 0 + QUERY_TIME_SUFFIX);
    queryTimeLabel.setHorizontalTextPosition(SwingConstants.LEFT);
    displayDistinctResultsCheckBox = new JCheckBox(
            new AbstractAction("" + "Display only unique patient count") {

                public void actionPerformed(ActionEvent e) {
                    renderQueryCountLabels();
                }
            });
    displayDistinctResultsCheckBox.setHorizontalAlignment(SwingConstants.LEFT);

    // create panels and add labels
    JPanel countPanel = new JPanel();
    countPanel.setLayout(new BoxLayout(countPanel, BoxLayout.LINE_AXIS));
    countPanel.add(resultCountLabel);
    countPanel.add(Box.createHorizontalGlue());
    JPanel timePanel = new JPanel();
    timePanel.setLayout(new BoxLayout(timePanel, BoxLayout.LINE_AXIS));
    timePanel.add(Box.createHorizontalGlue());
    timePanel.add(queryTimeLabel);
    timePanel.add(Box.createHorizontalGlue());
    timePanel.add(displayDistinctResultsCheckBox);

    JPanel labelsPanel = new JPanel();
    labelsPanel.setBorder(BorderFactory.createEmptyBorder(borderSize, borderSize, borderSize, borderSize));
    labelsPanel.setLayout(new BoxLayout(labelsPanel, BoxLayout.PAGE_AXIS));
    labelsPanel.add(countPanel);
    labelsPanel.add(timePanel);

    resultSetTableModel = new ResultSetTableModel();
    resultsTable = new JXTable(resultSetTableModel);

    // set cell renderer for columns in table
    setCellRenderer();
    resultsTable.setColumnControlVisible(true);
    resultsTable.setHighlighters(HighlighterFactory.createAlternateStriping());
    resultsTable.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            // get row at click point
            int row = resultsTable.rowAtPoint(e.getPoint());
            if (row > -1) {
                // check if double click
                if (e.getClickCount() == 2) {
                    // get id at row
                    String patientId = resultSetTableModel.getValueAt(row, 0).toString();
                    logger.debug("Value of patientId : " + patientId);
                    // set as active constraint
                    patientPanel.setPatient(patientId);
                    patientDialog.setTitle("Patient - " + patientId);
                    patientDialog.setVisible(true);
                }
            }
        }
    });

    JPanel lowerPanel = new JPanel(new BorderLayout());
    lowerPanel.setBorder(BorderFactory.createTitledBorder("Query Results"));
    lowerPanel.add(labelsPanel, BorderLayout.NORTH);
    lowerPanel.add(new JScrollPane(resultsTable), BorderLayout.CENTER);
    // set components for view
    setLayout(new BorderLayout());
    add(lowerPanel, BorderLayout.CENTER);

    // create patient panel
    createPatientDialog();
}

From source file:edu.virginia.speclab.juxta.author.view.export.WebServiceExportDialog.java

/**
 * Create a UI panel to show export progress
 *//*w  w  w.j  a va2  s  .  c om*/
private void createStatusPane() {
    this.statusPanel = new JPanel();
    this.statusPanel.setBackground(Color.white);
    this.statusPanel.setLayout(new BorderLayout(5, 5));
    this.statusPanel.setBorder(BorderFactory.createEmptyBorder(15, 0, 0, 0));

    JPanel content = new JPanel();
    content.setBackground(Color.white);
    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
    content.add(Box.createVerticalStrut(30));
    JLabel l = new JLabel("Status", SwingConstants.CENTER);
    l.setAlignmentX(CENTER_ALIGNMENT);
    l.setFont(JuxtaUserInterfaceStyle.LARGE_FONT);
    content.add(l);
    content.add(Box.createVerticalStrut(10));
    this.statusLabel = new JLabel("", SwingConstants.CENTER);
    this.statusLabel.setAlignmentX(CENTER_ALIGNMENT);
    this.setFont(JuxtaUserInterfaceStyle.NORMAL_FONT);
    content.add(this.statusLabel);
    this.statusPanel.add(content, BorderLayout.CENTER);

    JPanel p = new JPanel();
    p.setBackground(Color.white);
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    p.add(Box.createHorizontalGlue());
    this.workAnimation = new JLabel();
    this.workAnimation.setIcon(JuxtaUserInterfaceStyle.WORKING_ANIMATION);
    p.add(this.workAnimation);
    p.add(Box.createHorizontalGlue());
    this.statusPanel.add(p, BorderLayout.NORTH);
}