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:es.emergya.ui.plugins.LayerSelectionDialog.java

private void initOptions(final JPanel list) {
    SwingWorker<Object, Object> sw = new SwingWorker<Object, Object>() {

        @Override/*  w w w  .ja  v  a  2  s .  c o  m*/
        protected Object doInBackground() throws Exception {
            publish(new Object[0]);
            for (CapaInformacion ci : CapaConsultas.getAllOrderedByOrden()) {
                if (ci.getOpcional() && ci.getHabilitada()) {
                    layers.add(new LayerElement(ci.getNombre(), ci.getUrl(), wasVisible(ci)));
                }
            }
            return null;
        }

        @Override
        protected void process(List<Object> chunks) {
            actualizando.setIcon(es.emergya.cliente.constants.LogicConstants.getIcon("anim_actualizando"));
        }

        @Override
        protected void done() {
            super.done();
            actualizando.setIcon(null);
            list.setLayout(new BoxLayout(list, BoxLayout.Y_AXIS));
            for (LayerElement le : layers) {
                JCheckBox cb = new JCheckBox(le.name, le.active);
                cb.setBackground(Color.WHITE);
                cb.addActionListener(LayerSelectionDialog.this);
                list.add(cb);
                list.revalidate();
            }

            // self.pack();
        }
    };
    sw.execute();
}

From source file:it.unifi.rcl.chess.traceanalysis.gui.TracePanel.java

private void initialize() {

    this.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

    JPanel pnlInfo = new JPanel();
    JPanel pnlBound = new JPanel();
    JPanel pnlPlot = new JPanel();
    JPanel pnlPhases = new JPanel();

    pnlInfo.setLayout(new BoxLayout(pnlInfo, BoxLayout.Y_AXIS));
    pnlBound.setLayout(new BoxLayout(pnlBound, BoxLayout.Y_AXIS));
    pnlPlot.setLayout(new BoxLayout(pnlPlot, BoxLayout.Y_AXIS));
    pnlPhases.setLayout(new BoxLayout(pnlPhases, BoxLayout.Y_AXIS));

    //      pnlInfo.setBorder(BorderFactory.createLineBorder(Color.black));
    //      pnlBound.setBorder(BorderFactory.createLineBorder(Color.black));
    //      pnlPlot.setBorder(BorderFactory.createLineBorder(Color.black));
    //      pnlPhases.setBorder(BorderFactory.createLineBorder(Color.black));
    pnlInfo.setPreferredSize(new Dimension(300, 250));
    pnlBound.setPreferredSize(new Dimension(400, 250));
    pnlPlot.setPreferredSize(new Dimension(300, 250));
    pnlPhases.setPreferredSize(new Dimension(400, 250));

    pnlInfo.setBorder(new EmptyBorder(6, 6, 6, 6));
    pnlBound.setBorder(new EmptyBorder(6, 6, 6, 6));
    pnlPlot.setBorder(new EmptyBorder(6, 6, 6, 6));
    pnlPhases.setBorder(new EmptyBorder(6, 6, 6, 6));

    this.add(pnlInfo);
    this.add(pnlBound);
    this.add(pnlPlot);
    this.add(pnlPhases);

    lblInfo = new JPlainLabel("<html><b>TRACE SUMMARY</b><br/>"
            + "<em>Information about the loaded trace.</em><br/><br/></html>");
    pnlInfo.add(lblInfo);/*from  ww  w . j  a  v  a 2s.  c o m*/

    lblPoints = new JPlainLabel("#Points");
    pnlInfo.add(lblPoints);

    lblTraceName = new JPlainLabel();
    pnlInfo.add(lblTraceName);

    lblStat = new JPlainLabel();
    pnlInfo.add(lblStat);

    btnReload = new JButton("Reload");
    btnReload.addActionListener(new ButtonAction("Reload", KeyEvent.VK_L));
    pnlInfo.add(btnReload);

    btnClose = new JButton("Close");
    btnClose.addActionListener(new ButtonAction("Close", KeyEvent.VK_U));
    pnlInfo.add(btnClose);

    /* Bound evaluation */
    lblSectionBounds = new JPlainLabel("<html><b>BOUND EVALUATION</b><br/>"
            + "<em>Compute probabilistic bounds on manually selected portions of the trace.</em></html>");
    lblSectionBounds.setToolTipText("Compute probabilistic bounds on manually selected portions of the trace");
    lblSectionBounds.setFont(new Font("Dialog", Font.PLAIN, 12));
    //      lblSectionBounds.setBorder(BorderFactory.createLineBorder(Color.black));
    pnlBound.add(lblSectionBounds);

    scrollTabBounds = new JScrollPane();
    scrollTabBounds.setPreferredSize(new Dimension(400, 100));
    pnlBound.add(scrollTabBounds);

    tableBounds = new BoundsTable();
    scrollTabBounds.setViewportView(tableBounds);

    btnUpdateBoundsTable = new JButton("Update");
    btnUpdateBoundsTable.addActionListener(new ButtonAction("Update", KeyEvent.VK_U));
    pnlBound.add(btnUpdateBoundsTable);

    btnClearBoundsTable = new JButton("Clear Table");
    btnClearBoundsTable.addActionListener(new ButtonAction("Clear Table", KeyEvent.VK_C));
    pnlBound.add(btnClearBoundsTable);

    /* Plotting */
    lblSectionPlot = new JPlainLabel("<html><b>PLOTTING</b><br/>"
            + "<em>Plot the trace, together with \"dynamic\" probabilistic bounds, i.e., bounds obtained dynamically as if they were evaluated at runtime with a fixed window size.</em></html>");
    lblSectionPlot.setToolTipText("Plot the trace and dynamic bounds");
    pnlPlot.add(lblSectionPlot);

    scrollTabWSize = new JScrollPane();
    scrollTabWSize.setPreferredSize(new Dimension(400, 200));
    pnlPlot.add(scrollTabWSize);

    tableWindowSize = new JDynamicTable();
    tableWindowSize.setModel(new DefaultTableModel(new Object[][] { { 100, 0.99 }, { null, null } },
            new String[] { "WindowSize", "Confidence" }) {

        Class[] columnTypes = new Class[] { Integer.class, Double.class };

        public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
        }
    });
    tableWindowSize.setMonitoredColumn(0);
    tableWindowSize.setMonitoredColumn(1);
    tableWindowSize.getColumnModel().getColumn(0).setPreferredWidth(10);
    tableWindowSize.getColumnModel().getColumn(1).setPreferredWidth(10);
    scrollTabWSize.setViewportView(tableWindowSize);

    btnPlot = new JButton("Plot");
    btnPlot.addActionListener(new ButtonAction("Plot", KeyEvent.VK_P));
    pnlPlot.add(btnPlot);

    btnBoundExport = new JButton("Export");
    btnBoundExport.addActionListener(new ButtonAction("Export", KeyEvent.VK_E));
    pnlPlot.add(btnBoundExport);

    btnCompareAll = new JButton("Compare All Traces");
    btnCompareAll.addActionListener(new ButtonAction("Compare All Traces", KeyEvent.VK_A));
    pnlPlot.add(btnCompareAll);

    btnClearWSizeTable = new JButton("Clear Table");
    btnClearWSizeTable.addActionListener(new ButtonAction("Clear Table", KeyEvent.VK_C));
    pnlPlot.add(btnClearWSizeTable);

    /* Phases analysis */
    lblSectionPhases = new JPlainLabel("<html><b>PHASES ANALYSIS</b><br/>"
            + "<em>Detect phases in the trace having different probabilistic properties.</em></html>.");
    lblSectionPhases.setToolTipText("Detect phases in the trace having different probabilistic properties");
    pnlPhases.add(lblSectionPhases);

    scrollTabPhases = new JScrollPane();
    scrollTabPhases.setPreferredSize(new Dimension(200, 150));
    pnlPhases.add(scrollTabPhases);

    tablePhases = new JTable();
    tablePhases.setModel(new DefaultTableModel(new Object[][] { { null, null, null, null } },
            new String[] { "Start", "End", "Distribution*", "Bound*" }) {

        Class[] columnTypes = new Class[] { Integer.class, Integer.class, String.class, String.class };

        public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
        }

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    });
    tablePhases.getColumnModel().getColumn(0).setPreferredWidth(10);
    tablePhases.getColumnModel().getColumn(1).setPreferredWidth(10);
    tablePhases.getColumnModel().getColumn(2).setPreferredWidth(100);
    tablePhases.getColumnModel().getColumn(3).setPreferredWidth(100);
    scrollTabPhases.setViewportView(tablePhases);

    lblPhasesCoverage = new JPlainLabel("Coverage: ");
    pnlPhases.add(lblPhasesCoverage);
    txtPhasesCoverage = new JTextField("0.99");
    pnlPhases.add(txtPhasesCoverage);

    lblPhasesWSize = new JPlainLabel("Window Size: ");
    pnlPhases.add(lblPhasesWSize);
    txtPhasesWSize = new JTextField("20");
    pnlPhases.add(txtPhasesWSize);

    btnPhaseDetection = new JButton("Phases Analysis");
    ;
    btnPhaseDetection.addActionListener(new ButtonAction("PhasesAnalysis", KeyEvent.VK_P));
    pnlPhases.add(btnPhaseDetection);
}

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  w w  w  .  j  a va2  s. co  m*/
        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.db4o.sync4o.ui.Db4oSyncSourceConfigPanel.java

private void setupControls() {

    // Layout and setup UI components...

    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    add(_namePanel);/* ww  w  .  jav a 2s. com*/
    _namePanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(_fieldsPanel);
    _fieldsPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(_classConfigsTree);
    _classConfigsTree.setAlignmentX(Component.LEFT_ALIGNMENT);
    _classConfigsTree.setPreferredSize(new Dimension(300, 300));
    add(_buttonsPanel);
    _buttonsPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    JLabel l;

    // Admin UI Management Panels use a title
    // (in a particular "title font") to identify themselves
    l = new JLabel("Edit Db4oSyncSource Configuration", SwingConstants.CENTER);
    l.setBorder(new TitledBorder(""));
    l.setFont(titlePanelFont);
    _namePanel.add(l);

    GridBagConstraints labelConstraints = new GridBagConstraints();
    labelConstraints.gridwidth = 1;
    labelConstraints.fill = GridBagConstraints.NONE;
    labelConstraints.weightx = 0.0;
    labelConstraints.gridx = 0;
    labelConstraints.gridy = 0;
    labelConstraints.anchor = GridBagConstraints.EAST;

    GridBagConstraints fieldConstraints = new GridBagConstraints();
    fieldConstraints.gridwidth = 2;
    fieldConstraints.fill = GridBagConstraints.HORIZONTAL;
    fieldConstraints.weightx = 1.0;
    fieldConstraints.gridx = 1;
    fieldConstraints.gridy = 0;

    _fieldsPanel.add(new JLabel("Source URI: "), labelConstraints);
    _fieldsPanel.add(_sourceUriValue, fieldConstraints);

    labelConstraints.gridy = GridBagConstraints.RELATIVE;
    fieldConstraints.gridy = GridBagConstraints.RELATIVE;

    _fieldsPanel.add(new JLabel("Name: "), labelConstraints);
    _fieldsPanel.add(_nameValue, fieldConstraints);

    fieldConstraints.gridwidth = 1;

    _fieldsPanel.add(new JLabel("db4o File: "), labelConstraints);
    _fieldsPanel.add(_dbFileValue, fieldConstraints);

    _dbFileValue.setEditable(false);

    fieldConstraints.gridwidth = 2;

    GridBagConstraints buttonConstraints = new GridBagConstraints();
    buttonConstraints.gridwidth = 1;
    buttonConstraints.fill = GridBagConstraints.NONE;
    buttonConstraints.gridx = 2;
    buttonConstraints.gridy = 3;
    _dbFileLocateButton.setText("...");
    _fieldsPanel.add(_dbFileLocateButton, buttonConstraints);

    buttonConstraints.gridwidth = 3;
    buttonConstraints.fill = GridBagConstraints.NONE;
    buttonConstraints.gridx = 0;
    buttonConstraints.gridy = GridBagConstraints.RELATIVE;
    buttonConstraints.anchor = GridBagConstraints.CENTER;

    // Ensure all the controls use the Admin UI standard font
    Component[] components = _fieldsPanel.getComponents();
    for (int i = 0; i < components.length; i++) {

        Component c = components[i];
        c.setFont(defaultFont);

    }

    _confirmButton.setText("Add");
    _buttonsPanel.add(_confirmButton);

}

From source file:AccessibleScrollDemo.java

public AccessibleScrollDemo() {
    //Load the photograph into an image icon.
    ImageIcon david = new ImageIcon("images/youngdad.jpeg");
    david.setDescription("Photograph of David McNabb in his youth.");

    //Create the row and column headers
    columnView = new Rule(Rule.HORIZONTAL, true);
    columnView.setPreferredWidth(david.getIconWidth());
    columnView.getAccessibleContext().setAccessibleName("Column Header");
    columnView.getAccessibleContext()//www .  j  a v  a  2  s .  c om
            .setAccessibleDescription("Displays horizontal ruler for " + "measuring scroll pane client.");
    rowView = new Rule(Rule.VERTICAL, true);
    rowView.setPreferredHeight(david.getIconHeight());
    rowView.getAccessibleContext().setAccessibleName("Row Header");
    rowView.getAccessibleContext()
            .setAccessibleDescription("Displays vertical ruler for " + "measuring scroll pane client.");

    //Create the corners
    JPanel buttonCorner = new JPanel();
    isMetric = new JToggleButton("cm", true);
    isMetric.setFont(new Font("SansSerif", Font.PLAIN, 11));
    isMetric.setMargin(new Insets(2, 2, 2, 2));
    isMetric.addItemListener(new UnitsListener());
    isMetric.setToolTipText("Toggles rulers' unit of measure " + "between inches and centimeters.");
    buttonCorner.add(isMetric); //Use the default FlowLayout
    buttonCorner.getAccessibleContext().setAccessibleName("Upper Left Corner");

    String desc = "Fills the corner of a scroll pane " + "with color for aesthetic reasons.";
    Corner lowerLeft = new Corner();
    lowerLeft.getAccessibleContext().setAccessibleName("Lower Left Corner");
    lowerLeft.getAccessibleContext().setAccessibleDescription(desc);

    Corner upperRight = new Corner();
    upperRight.getAccessibleContext().setAccessibleName("Upper Right Corner");
    upperRight.getAccessibleContext().setAccessibleDescription(desc);

    //Set up the scroll pane
    picture = new ScrollablePicture(david, columnView.getIncrement());
    picture.setToolTipText(david.getDescription());
    picture.getAccessibleContext().setAccessibleName("Scroll pane client");

    JScrollPane pictureScrollPane = new JScrollPane(picture);
    pictureScrollPane.setPreferredSize(new Dimension(300, 250));
    pictureScrollPane.setViewportBorder(BorderFactory.createLineBorder(Color.black));

    pictureScrollPane.setColumnHeaderView(columnView);
    pictureScrollPane.setRowHeaderView(rowView);

    pictureScrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, buttonCorner);
    pictureScrollPane.setCorner(JScrollPane.LOWER_LEFT_CORNER, lowerLeft);
    pictureScrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, upperRight);

    //Put it in this panel
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    add(pictureScrollPane);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}

From source file:e3fraud.gui.MainWindow.java

public MainWindow() {
    super(new BorderLayout(5, 5));

    extended = false;//from   w  w w . j  a  v a  2  s  . c  o m

    //Create the log first, because the action listeners
    //need to refer to it.
    log = new JTextArea(10, 50);
    log.setMargin(new Insets(5, 5, 5, 5));
    log.setEditable(false);
    logScrollPane = new JScrollPane(log);
    DefaultCaret caret = (DefaultCaret) log.getCaret();
    caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);

    //        create the progress bar
    progressBar = new JProgressBar(0, 100);
    progressBar.setValue(progressBar.getMinimum());
    progressBar.setVisible(false);
    progressBar.setStringPainted(true);
    //Create the settings pane
    generationSettingLabel = new JLabel("Generate:");
    SpinnerModel collusionsSpinnerModel = new SpinnerNumberModel(1, 0, 3, 1);
    collusionSettingsPanel = new JPanel(new FlowLayout()) {
        @Override
        public Dimension getMaximumSize() {
            return getPreferredSize();
        }
    };
    // collusionSettingsPanel.setLayout(new BoxLayout(collusionSettingsPanel, BoxLayout.X_AXIS));
    collusionsButton = new JSpinner(collusionsSpinnerModel);
    collusionsLabel = new JLabel("collusion(s)");
    collusionSettingsPanel.add(collusionsButton);
    collusionSettingsPanel.add(collusionsLabel);

    rankingSettingLabel = new JLabel("Rank by:");
    lossButton = new JRadioButton("loss");
    lossButton.setToolTipText("Sort sub-ideal models based on loss for Target of Assessment (high -> low)");
    gainButton = new JRadioButton("gain");
    gainButton.setToolTipText(
            "Sort sub-ideal models based on gain of any actor except Target of Assessment (high -> low)");
    lossGainButton = new JRadioButton("loss + gain");
    lossGainButton.setToolTipText(
            "Sort sub-ideal models based on loss for Target of Assessment and, if equal, on gain of any actor except Target of Assessment");
    //gainLossButton = new JRadioButton("gain + loss");
    lossGainButton.setSelected(true);
    rankingGroup = new ButtonGroup();
    rankingGroup.add(lossButton);
    rankingGroup.add(gainButton);
    rankingGroup.add(lossGainButton);
    //rankingGroup.add(gainLossButton);
    groupingSettingLabel = new JLabel("Group by:");
    groupingButton = new JCheckBox("collusion");
    groupingButton.setToolTipText(
            "Groups sub-ideal models based on the pair of actors colluding before ranking them");
    groupingButton.setSelected(false);
    refreshButton = new JButton("Refresh");
    refreshButton.addActionListener(this);

    settingsPanel = new JPanel();
    settingsPanel.setLayout(new BoxLayout(settingsPanel, BoxLayout.PAGE_AXIS));
    settingsPanel.add(Box.createRigidArea(new Dimension(0, 5)));
    settingsPanel.add(generationSettingLabel);
    collusionSettingsPanel.setAlignmentX(LEFT_ALIGNMENT);
    settingsPanel.add(Box.createRigidArea(new Dimension(0, 5)));
    settingsPanel.add(collusionSettingsPanel);
    settingsPanel.add(Box.createRigidArea(new Dimension(0, 5)));
    rankingSettingLabel.setAlignmentY(TOP_ALIGNMENT);
    settingsPanel.add(rankingSettingLabel);
    settingsPanel.add(lossButton);
    settingsPanel.add(gainButton);
    settingsPanel.add(lossGainButton);
    //settingsPanel.add(gainLossButton);
    settingsPanel.add(Box.createRigidArea(new Dimension(0, 5)));
    settingsPanel.add(groupingSettingLabel);
    settingsPanel.add(groupingButton);
    settingsPanel.add(Box.createRigidArea(new Dimension(0, 5)));
    settingsPanel.add(refreshButton);
    settingsPanel.add(Box.createRigidArea(new Dimension(0, 20)));
    progressBar.setPreferredSize(
            new Dimension(settingsPanel.getSize().width, progressBar.getPreferredSize().height));
    settingsPanel.add(progressBar);

    //Create the result tree
    root = new DefaultMutableTreeNode("No models to display");
    treeModel = new DefaultTreeModel(root);
    tree = new JTree(treeModel);
    //tree.setUI(new CustomTreeUI());
    tree.setCellRenderer(new CustomTreeCellRenderer(tree));
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setLargeModel(true);
    resultScrollPane = new JScrollPane(tree);
    tree.addTreeSelectionListener(treeSelectionListener);

    //tree.setShowsRootHandles(true);
    //Create a file chooser for saving
    sfc = new JFileChooser();
    FileFilter jpegFilter = new FileNameExtensionFilter("JPEG image", new String[] { "jpg", "jpeg" });
    sfc.addChoosableFileFilter(jpegFilter);
    sfc.setFileFilter(jpegFilter);

    //Create a file chooser for loading
    fc = new JFileChooser();
    FileFilter rdfFilter = new FileNameExtensionFilter("RDF file", "RDF");
    fc.addChoosableFileFilter(rdfFilter);
    fc.setFileFilter(rdfFilter);

    //Create the open button.  
    openButton = new JButton("Load model", createImageIcon("images/Open24.png"));
    openButton.addActionListener(this);
    openButton.setToolTipText("Load a e3value model");

    //Create the ideal graph button. 
    idealGraphButton = new JButton("Show ideal graph", createImageIcon("images/Plot.png"));
    idealGraphButton.setToolTipText("Display ideal profitability graph");
    idealGraphButton.addActionListener(this);

    Dimension thinButtonDimension = new Dimension(15, 420);

    //Create the expand subideal graph button. 
    expandButton = new JButton(">");
    expandButton.setPreferredSize(thinButtonDimension);
    expandButton.setMargin(new Insets(0, 0, 0, 0));
    expandButton.setToolTipText("Expand to show non-ideal profitability graph for selected model");
    expandButton.addActionListener(this);

    //Create the collapse sub-ideal graph button. 
    collapseButton = new JButton("<");
    collapseButton.setPreferredSize(thinButtonDimension);
    collapseButton.setMargin(new Insets(0, 0, 0, 0));
    collapseButton.setToolTipText("Collapse non-ideal profitability graph for selected model");
    collapseButton.addActionListener(this);

    //Create the generation button. 
    generateButton = new JButton("Generate sub-ideal models", createImageIcon("images/generate.png"));
    generateButton.addActionListener(this);
    generateButton.setToolTipText("Generate sub-ideal models for the e3value model currently loaded");

    //Create the chart panel
    chartPane = new JPanel();
    chartPane.setLayout(new FlowLayout(FlowLayout.LEFT));
    chartPane.add(expandButton);

    //For layout purposes, put the buttons in a separate panel
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    buttonPanel.add(openButton);
    buttonPanel.add(Box.createRigidArea(new Dimension(20, 0)));
    buttonPanel.add(generateButton);
    buttonPanel.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonPanel.add(idealGraphButton);

    //Add the buttons, the ranking options, the result list and the log to this panel.
    add(buttonPanel, BorderLayout.PAGE_START);
    add(settingsPanel, BorderLayout.LINE_START);
    add(resultScrollPane, BorderLayout.CENTER);

    add(logScrollPane, BorderLayout.PAGE_END);
    add(chartPane, BorderLayout.LINE_END);
    //and make a nice border around it
    setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10));
}

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

/**
 * Create a UI panel to show export progress
 *//*from   w  w  w  .ja v  a 2 s .c o m*/
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);
}

From source file:gdt.jgui.entity.index.JIndexPanel.java

/**
 * The default constructor./*from w  ww .  j a v  a 2  s.c om*/
 */
public JIndexPanel() {
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    scrollPane = new JScrollPane();
    add(scrollPane);

}

From source file:medsavant.uhn.cancer.AddNewCommentDialog.java

private JPanel getOntologyTermsForThisVariant() {
    try {/* ww  w.jav a  2 s.  co  m*/
        JPanel ontologyTermPanel = new JPanel();
        ontologyTermPanel.setLayout(new BoxLayout(ontologyTermPanel, BoxLayout.Y_AXIS));

        String sessID = LoginController.getSessionID();
        String refName = ReferenceController.getInstance().getCurrentReferenceName();
        if (refName == null) {
            DialogUtils.displayError("Error",
                    "Couldn't obtain name of current reference genome - please login again.");
            dispose();
            return null;
        }
        GeneSet geneSet = MedSavantClient.GeneSetManager.getGeneSet(sessID, refName);
        if (geneSet == null) {
            DialogUtils.displayError("Error",
                    "Couldn't find a gene set for reference " + refName + ". Please check project settings.");
            dispose();
            return null;
        }

        Gene[] genesOverlappingVariant = MedSavantClient.GeneSetManager.getGenesInRegion(sessID, geneSet,
                variantRecord.getChrom(), variantRecord.getStartPosition().intValue(),
                variantRecord.getEndPosition().intValue());
        if (genesOverlappingVariant == null || genesOverlappingVariant.length < 1) {
            //TODO: Here we could allow the user to choose from a list of ALL hpo terms, not just those
            //that are already associated with the variant.
            DialogUtils.displayError("No genes were found associated with this variant " + variantRecord
                    + " in geneSet " + geneSet);
            dispose();
            return null;
        }
        Set<OntologyTerm> ontologyTermSet = new TreeSet<OntologyTerm>();
        for (Gene gene : genesOverlappingVariant) {
            OntologyTerm[] ontologyTerms = MedSavantClient.OntologyManager.getTermsForGene(sessID,
                    UserCommentApp.getDefaultOntologyType(), gene.getName());
            if (ontologyTerms != null && ontologyTerms.length > 0) {
                ontologyTermSet.addAll(Arrays.asList(ontologyTerms));
            }
        }

        selectableOntologyTerms = new SelectableOntologyTerm[ontologyTermSet.size()];
        int i = 0;
        for (OntologyTerm ontologyTerm : ontologyTermSet) {
            selectableOntologyTerms[i] = new SelectableOntologyTerm(ontologyTerm);
            ontologyTermPanel.add(selectableOntologyTerms[i]);
            ++i;
        }
        JScrollPane jsp = new JScrollPane(ontologyTermPanel);
        JPanel p = new JPanel();
        p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
        p.setPreferredSize(new Dimension(mainPanelWidth, mainPanelHeight / 2));
        p.add(jsp);
        return p;
    } catch (Exception ex) {
        ex.printStackTrace();
        LOG.error("Error: ", ex);
        DialogUtils.displayException("Error", ex.getMessage(), ex);
        dispose();
        return null;
    }
}

From source file:com.raceup.fsae.test.TesterGui.java

/**
 * Shows gui to start a test//from   w w  w .j a v  a2  s . c o m
 */
private void openQuestionsPanel() {
    currentSubmissionTimer = new ClockTimer("Current submission time"); // start timer
    currentSubmissionTimer.start();
    totalTestTimer.start();

    shuffleQuestions();
    testPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10) // title border
    );

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));

    panel.add(Box.createVerticalStrut(20));
    panel.add(new JScrollPane(testPanel));

    panel.add(createTimersPanel());
    panel.add(createMonitorPanel());
    setContentPane(panel); // scroll pane with questions

    setPreferredSize(new Dimension(400, 600));
    pack();
    repaint();
    setLocationRelativeTo(null);
}