Example usage for javax.swing Box createVerticalStrut

List of usage examples for javax.swing Box createVerticalStrut

Introduction

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

Prototype

public static Component createVerticalStrut(int height) 

Source Link

Document

Creates an invisible, fixed-height component.

Usage

From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.FileSelectionTable.java

/**
 * Returns the component hosting the collection of files to import.
 * /*from  w  w  w.ja  v  a  2s .co m*/
 * @return See above.
 */
private JPanel buildTablePane() {
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.PAGE_AXIS));
    p.add(Box.createVerticalStrut(5));
    p.add(new JScrollPane(table));
    return p;
}

From source file:net.sf.maltcms.chromaui.msviewer.ui.panel.MassSpectrumPanel.java

public void addIdentification() {
    // Create a custom NotifyDescriptor, specify the panel instance as a parameter + other params
    NotifyDescriptor nd = new NotifyDescriptor(ddp, // instance of your panel
            "Select Databases and Settings", // title of the dialog
            NotifyDescriptor.OK_CANCEL_OPTION, // it is Yes/No dialog ...
            NotifyDescriptor.PLAIN_MESSAGE, // ... of a question type => a question mark icon
            null, // we have specified YES_NO_OPTION => can be null, options specified by L&F,
            // otherwise specify options as:
            //     new Object[] { NotifyDescriptor.YES_OPTION, ... etc. },
            NotifyDescriptor.OK_OPTION // default option is "Yes"
    );/*  w  w  w. j  a v  a 2s.  com*/
    ddp.updateView();
    // let's display the dialog now...
    if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) {
        if (ddp.getSelectedDatabases().isEmpty()) {
            return;
        }
        Runnable r = new Runnable() {
            @Override
            public void run() {
                IQuery<IScan> query = Lookup.getDefault().lookup(IQueryFactory.class).createQuery(
                        ddp.getSelectedDatabases(), ddp.getRetentionIndexCalculator(),
                        ddp.getSelectedMetabolitePredicate(), ddp.getMatchThreshold(), ddp.getMaxNumberOfHits(),
                        ddp.getRIWindow(), seriesToScan.values().toArray(new IScan[seriesToScan.size()]));
                try {
                    List<QueryResultList<IScan>> results = query.call();
                    Box outerBox = Box.createVerticalBox();
                    for (QueryResultList<IScan> mdqrl : results) {
                        for (IQueryResult<IScan> result : mdqrl) {
                            Box vbox = Box.createVerticalBox();
                            JLabel label = new JLabel("Results for scan " + result.getScan().getScanIndex()
                                    + " at " + result.getScan().getScanAcquisitionTime() + " with ri: "
                                    + result.getRetentionIndex());
                            JLabel dbLabel = new JLabel(
                                    "DB: " + result.getDatabaseDescriptor().getResourceLocation());
                            vbox.add(label);
                            vbox.add(dbLabel);
                            JLabel parameterLabel = new JLabel("Minimum Score: " + ddp.getMatchThreshold()
                                    + "; Maximum #Hits Returned: " + ddp.getMaxNumberOfHits());
                            vbox.add(parameterLabel);
                            DefaultTableModel dlm = new DefaultTableModel(
                                    new String[] { "Score", "RI", "Name", "ID", "MW", "Formula", "Max Mass" },
                                    0);
                            for (IMetabolite metabolite : result.getMetabolites()) {
                                String name = metabolite.getName();
                                if (name.lastIndexOf("_") != -1) {
                                    name = name.substring(name.lastIndexOf("_") + 1);
                                }
                                dlm.addRow(new Object[] { result.getScoreFor(metabolite),
                                        result.getRiFor(metabolite), name, metabolite.getID(),
                                        metabolite.getMW(), metabolite.getFormula(), metabolite.getMaxMass() });
                            }
                            JTable jl = new JTable(dlm);
                            JScrollPane resultScrollPane = new JScrollPane(jl);
                            jl.setAutoCreateRowSorter(true);
                            jl.setUpdateSelectionOnSort(true);
                            vbox.add(resultScrollPane);
                            outerBox.add(vbox);
                            outerBox.add(Box.createVerticalStrut(10));
                        }
                    }
                    JScrollPane jsp = new JScrollPane(outerBox);
                    NotifyDescriptor nd = new NotifyDescriptor(jsp, // instance of your panel
                            "Database Search Results", // title of the dialog
                            NotifyDescriptor.OK_CANCEL_OPTION, // it is Yes/No dialog ...
                            NotifyDescriptor.PLAIN_MESSAGE, // ... of a question type => a question mark icon
                            null, // we have specified YES_NO_OPTION => can be null, options specified by L&F,
                            // otherwise specify options as:
                            //     new Object[] { NotifyDescriptor.YES_OPTION, ... etc. },
                            NotifyDescriptor.OK_OPTION // default option is "Yes"
                    );
                    if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) {
                    }
                    //DBConnectionManager.close();
                } catch (Exception ex) {
                    Exceptions.printStackTrace(ex);
                }
            }
        };
        RequestProcessor.getDefault().post(r);

    }
}

From source file:org.proteomecommons.tranche.modules.advancedsearch.AdvancedSearchPanel.java

public AdvancedSearchPanel(AdvancedGUI main) {

    this.main = main;
    this.setBackground(Color.WHITE);

    this.setBorder(Styles.BORDER_NONE);

    // Set the layout for the outer container
    this.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();

    // Set the layout for the inner container
    scrollablePanel.setLayout(new GridBagLayout());
    scrollablePanel.setBackground(Color.WHITE);

    // Aids correct word wrap
    this.setSize(RECOMMENDED_DIMENSION);

    // Key words text
    {//from w w w.  j  a v  a  2 s  . c o m
        JLabel l = new JLabel("Keywords:");
        l.setFont(Styles.FONT_11PT_BOLD);

        gbc.gridwidth = 1;
        gbc.anchor = gbc.FIRST_LINE_START;
        gbc.weightx = 0;
        gbc.weighty = 0;
        gbc.fill = gbc.NONE;
        gbc.insets = new Insets(MARGIN * 2, MARGIN, 0, 0);
        gbc.gridx = 0; // <-- Cell
        gbc.gridy = rowPtr; // <-- Row

        scrollablePanel.add(l, gbc);

        keywordText = new JTextField();

        gbc.gridwidth = gbc.REMAINDER;
        gbc.anchor = gbc.FIRST_LINE_START;
        gbc.weightx = 1.0;
        gbc.weighty = 0;
        gbc.fill = gbc.HORIZONTAL;
        gbc.insets = new Insets(MARGIN * 2 - (5), MARGIN, 0, MARGIN);
        gbc.gridx = 1; // <-- Cell
        gbc.gridy = rowPtr; // <-- Row

        scrollablePanel.add(keywordText, gbc);

        rowPtr++;
    }

    // Journal drop down
    {
        JLabel l = new JLabel("Journal:");
        l.setFont(Styles.FONT_11PT);

        gbc.gridwidth = 1;
        gbc.anchor = gbc.FIRST_LINE_START;
        gbc.weightx = 0;
        gbc.weighty = 0;
        gbc.fill = gbc.NONE;
        gbc.insets = new Insets(MARGIN, MARGIN, 0, 0);
        gbc.gridx = 0; // <-- Cell
        gbc.gridy = rowPtr; // <-- Row

        scrollablePanel.add(l, gbc);

        journalDropDown = new JComboBox(journalOptions);
        journalDropDown.setSelectedIndex(0);
        journalDropDown.setBackground(Color.WHITE);

        gbc.gridwidth = gbc.REMAINDER;
        gbc.anchor = gbc.FIRST_LINE_START;
        gbc.weightx = 1.0;
        gbc.weighty = 0;
        gbc.fill = gbc.HORIZONTAL;
        gbc.insets = new Insets(MARGIN - (5), MARGIN, 0, MARGIN);
        gbc.gridx = 1; // <-- Cell
        gbc.gridy = rowPtr; // <-- Row

        scrollablePanel.add(journalDropDown, gbc);
        rowPtr++;
    }

    // Research/Institute text
    {
        JLabel l = new JLabel("Researcher/Institute:");
        l.setFont(Styles.FONT_11PT);

        gbc.gridwidth = 1;
        gbc.anchor = gbc.FIRST_LINE_START;
        gbc.weightx = 0;
        gbc.weighty = 0;
        gbc.fill = gbc.NONE;
        gbc.insets = new Insets(MARGIN, MARGIN, 0, 0);
        gbc.gridx = 0; // <-- Cell
        gbc.gridy = rowPtr; // <-- Row

        scrollablePanel.add(l, gbc);

        researcherText = new JTextField();

        gbc.gridwidth = gbc.REMAINDER;
        gbc.anchor = gbc.FIRST_LINE_START;
        gbc.weightx = 1.0;
        gbc.weighty = 0;
        gbc.fill = gbc.HORIZONTAL;
        gbc.insets = new Insets(MARGIN - (5), MARGIN, 0, MARGIN);
        gbc.gridx = 1; // <-- Cell
        gbc.gridy = rowPtr; // <-- Row

        scrollablePanel.add(researcherText, gbc);

        rowPtr++;
    }

    // Organism text
    {
        JLabel l = new JLabel("Organism:");
        l.setFont(Styles.FONT_11PT);

        gbc.gridwidth = 1;
        gbc.anchor = gbc.FIRST_LINE_START;
        gbc.weightx = 0;
        gbc.weighty = 0;
        gbc.fill = gbc.NONE;
        gbc.insets = new Insets(MARGIN, MARGIN, 0, 0);
        gbc.gridx = 0; // <-- Cell
        gbc.gridy = rowPtr; // <-- Row

        scrollablePanel.add(l, gbc);

        organismText = new JTextField();

        gbc.gridwidth = gbc.REMAINDER;
        gbc.anchor = gbc.FIRST_LINE_START;
        gbc.weightx = 1.0;
        gbc.weighty = 0;
        gbc.fill = gbc.HORIZONTAL;
        gbc.insets = new Insets(MARGIN - (5), MARGIN, 0, MARGIN);
        gbc.gridx = 1; // <-- Cell
        gbc.gridy = rowPtr; // <-- Row

        scrollablePanel.add(organismText, gbc);

        rowPtr++;
    }

    // Ion source drop down
    {
        JLabel l = new JLabel("Ion Source:");
        l.setFont(Styles.FONT_11PT);

        gbc.gridwidth = 1;
        gbc.anchor = gbc.FIRST_LINE_START;
        gbc.weightx = 0;
        gbc.weighty = 0;
        gbc.fill = gbc.NONE;
        gbc.insets = new Insets(MARGIN, MARGIN, 0, 0);
        gbc.gridx = 0; // <-- Cell
        gbc.gridy = rowPtr; // <-- Row

        scrollablePanel.add(l, gbc);

        ionSourceDropDown = new JComboBox(ionSourceOptions);
        ionSourceDropDown.setSelectedIndex(0);
        ionSourceDropDown.setBackground(Color.WHITE);

        gbc.gridwidth = gbc.REMAINDER;
        gbc.anchor = gbc.FIRST_LINE_START;
        gbc.weightx = 1.0;
        gbc.weighty = 0;
        gbc.fill = gbc.HORIZONTAL;
        gbc.insets = new Insets(MARGIN - (5), MARGIN, 0, MARGIN);
        gbc.gridx = 1; // <-- Cell
        gbc.gridy = rowPtr; // <-- Row

        scrollablePanel.add(ionSourceDropDown, gbc);
        rowPtr++;
    }

    // Instrument drop down
    {
        JLabel l = new JLabel("Instrument:");
        l.setFont(Styles.FONT_11PT);

        gbc.gridwidth = 1;
        gbc.anchor = gbc.FIRST_LINE_START;
        gbc.weightx = 0;
        gbc.weighty = 0;
        gbc.fill = gbc.NONE;
        gbc.insets = new Insets(MARGIN, MARGIN, 0, 0);
        gbc.gridx = 0; // <-- Cell
        gbc.gridy = rowPtr; // <-- Row

        scrollablePanel.add(l, gbc);

        instrumentDropDown = new JComboBox(instrumentOptions);
        instrumentDropDown.setSelectedIndex(0);
        instrumentDropDown.setBackground(Color.WHITE);

        gbc.gridwidth = gbc.REMAINDER;
        gbc.anchor = gbc.FIRST_LINE_START;
        gbc.weightx = 1.0;
        gbc.weighty = 0;
        gbc.fill = gbc.HORIZONTAL;
        gbc.insets = new Insets(MARGIN - (5), MARGIN, 0, MARGIN);
        gbc.gridx = 1; // <-- Cell
        gbc.gridy = rowPtr; // <-- Row

        scrollablePanel.add(instrumentDropDown, gbc);
        rowPtr++;
    }

    // "Only return results with online data" check box
    {
        onlineResultsOnlyBox = new JCheckBox("Only return results with online data");
        onlineResultsOnlyBox.setSelected(true);
        onlineResultsOnlyBox.setBackground(Color.WHITE);

        gbc.gridwidth = gbc.REMAINDER;
        gbc.anchor = gbc.FIRST_LINE_START;
        gbc.weightx = 1.0;
        gbc.weighty = 0;
        gbc.fill = gbc.HORIZONTAL;
        gbc.insets = new Insets(MARGIN, MARGIN, 0, MARGIN);
        gbc.gridx = 0; // <-- Cell
        gbc.gridy = rowPtr; // <-- Row

        scrollablePanel.add(onlineResultsOnlyBox, gbc);

        rowPtr++;
    }

    // Search button
    {
        searchButton = new JButton("Search");
        searchButton.setFont(Styles.FONT_12PT_BOLD);

        gbc.gridwidth = gbc.REMAINDER;
        gbc.anchor = gbc.FIRST_LINE_START;
        gbc.weightx = 1.0;
        gbc.weighty = 0;
        gbc.fill = gbc.HORIZONTAL;
        gbc.insets = new Insets((MARGIN * 2), MARGIN, MARGIN, MARGIN);
        gbc.gridx = 0; // <-- Cell
        gbc.gridy = rowPtr; // <-- Row

        scrollablePanel.add(searchButton, gbc);

        rowPtr++;
        // Set the reset pointer so consequitive searches are layed out correctly.
        RESET_ROW_PTR = rowPtr;
    }

    // Create our first ephemeral component -- a vertical strut!
    {
        Component strut = Box.createVerticalStrut(1);

        gbc.gridwidth = gbc.REMAINDER;
        gbc.anchor = gbc.FIRST_LINE_START;
        gbc.weightx = 1.0;
        gbc.weighty = 1.0;
        gbc.fill = gbc.BOTH;
        gbc.insets = new Insets(0, 0, 0, 0);
        gbc.gridx = 0; // <-- Cell
        gbc.gridy = rowPtr; // <-- Row

        this.addEphemeralComponent(strut, gbc);
    }

    // Add scrollable panel to this
    GridBagConstraints scrollc = new GridBagConstraints();
    scrollc.gridwidth = gbc.REMAINDER;
    scrollc.anchor = gbc.FIRST_LINE_START;
    scrollc.weightx = 1.0;
    scrollc.weighty = 1.0;
    scrollc.fill = gbc.BOTH;
    scrollc.insets = new Insets(0, 0, 0, 0);
    scrollc.gridx = 0; // <-- Cell
    scrollc.gridy = 0; // <-- Row
    this.add(new JScrollPane(scrollablePanel), scrollc);

    // Listeners
    searchButton.addActionListener(this);
    keywordText.addActionListener(this);
    researcherText.addActionListener(this);
    organismText.addActionListener(this);
}

From source file:diet.gridr.g5k.gui.ClusterInfoPanel.java

/**
 * This method initializes jPanel1/*from w  ww .j  a  v  a2s  .  co m*/
 *
 * @return javax.swing.JPanel
 */
private JPanel getJPanel1() {
    if (jPanel1 == null) {
        jPanel1 = new JPanel();
        jPanel1.setLayout(new BoxLayout(jPanel1, BoxLayout.X_AXIS));
        jPanel1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        JPanel intermediaryPanel = new JPanel();
        intermediaryPanel.setLayout(new BoxLayout(intermediaryPanel, BoxLayout.Y_AXIS));
        nodesTable = new JTable();
        nodesModel = new ClusterNodesSummaryModel();
        nodesTable.setModel(nodesModel);
        JLabel nodesTableTitle = new JLabel("Nodes status");
        nodesTableTitle.setAlignmentX(JLabel.CENTER_ALIGNMENT);
        nodesTableTitle.setFont(new Font("Dialog", Font.BOLD, 14));
        intermediaryPanel.add(Box.createVerticalStrut(5));
        intermediaryPanel.add(nodesTableTitle);
        intermediaryPanel.add(Box.createVerticalStrut(10));
        intermediaryPanel.add(nodesTable.getTableHeader());
        intermediaryPanel.add(nodesTable);
        intermediaryPanel.add(Box.createVerticalStrut(10));
        intermediaryPanel.add(new JSeparator(JSeparator.HORIZONTAL));
        jPanel1.add(Box.createHorizontalGlue());
        jPanel1.add(intermediaryPanel);
        jPanel1.add(Box.createHorizontalGlue());
        LoggingManager.log(Level.FINER, LoggingManager.RESOURCESTOOL, this.getClass().getName(), "getJPanel1",
                "Cluster nodes summary table added");
    }
    return jPanel1;
}

From source file:org.apache.jmeter.protocol.http.gui.HTTPFileArgsPanel.java

/**
 * Initialize the components and layout of this component.
 *//*from w ww. j  a  v  a 2  s . c  o  m*/
private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
    JPanel p = this;

    p.setLayout(new BorderLayout());

    // retro compatibility, will be removed in the next version
    if (tableLabel != null) {
        p.add(makeLabelPanel(), BorderLayout.NORTH);
    }
    p.add(makeMainPanel(), BorderLayout.CENTER);
    // Force a minimum table height of 70 pixels
    p.add(Box.createVerticalStrut(70), BorderLayout.WEST);
    p.add(makeButtonPanel(), BorderLayout.SOUTH);

    table.revalidate();
    sizeColumns(table);
}

From source file:cellularAutomata.analysis.PricingDistributionAnalysis.java

/**
 * Create the panel used to display the pricing statistics.
 *//*w  w w  . j  av a  2s. c o  m*/
private void createDisplayPanel() {
    int displayWidth = CAFrame.tabbedPaneDimension.width;
    int displayHeight = 600 + (100 * numberOfStates);

    // create the display panel
    if (displayPanel == null) {
        displayPanel = new JPanel(new GridBagLayout());
        displayPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        displayPanel.setPreferredSize(new Dimension(displayWidth, displayHeight));
    } else {
        displayPanel.removeAll();
    }

    if (isCompatibleRule && (numberOfStates <= MAX_NUMBER_OF_STATES)) {
        // create a panel that displays messages
        JPanel messagePanel = createMessagePanel();

        // create the labels for the display
        createDataDisplayLabels();
        JLabel generationLabel = new JLabel("Generation:   ");
        JLabel stateLabel = new JLabel("State:");
        JLabel numStateLabel = new JLabel("Number:");
        JLabel percentOccupiedLabel = new JLabel("Kurtosis:");

        // create boxes for each column of the display (a Box uses the
        // BoxLayout, so it is handy for laying out components)
        Box boxOfStateLabels = Box.createVerticalBox();
        Box boxOfNumberLabels = Box.createVerticalBox();
        Box boxOfPercentLabels = Box.createVerticalBox();

        // the amount of vertical space to put between components
        int verticalSpace = 5;

        // add the states to the first vertical box
        boxOfStateLabels.add(stateLabel);
        boxOfStateLabels.add(Box.createVerticalStrut(verticalSpace));
        for (int state = 0; state < numberOfStates; state++) {
            boxOfStateLabels.add(new JLabel("" + state));
            boxOfStateLabels.add(Box.createVerticalStrut(verticalSpace));
        }

        // add the numbers (in each state) to the second vertical box
        boxOfNumberLabels.add(numStateLabel);
        boxOfNumberLabels.add(Box.createVerticalStrut(verticalSpace));
        for (int i = 0; i < numberOfStates; i++) {
            boxOfNumberLabels.add(numberOccupiedByStateDataLabel[i]);
            boxOfNumberLabels.add(Box.createVerticalStrut(verticalSpace));
        }

        // add the percents (in each state) to the third vertical box
        boxOfPercentLabels.add(percentOccupiedLabel);
        boxOfPercentLabels.add(Box.createVerticalStrut(verticalSpace));
        for (int i = 0; i < numberOfStates; i++) {
            boxOfPercentLabels.add(percentOccupiedByStateDataLabel[i]);
            boxOfPercentLabels.add(Box.createVerticalStrut(verticalSpace));
        }

        // create another box that holds all of the label boxes
        Box boxOfLabels = Box.createHorizontalBox();
        boxOfLabels.add(boxOfStateLabels);
        boxOfLabels.add(boxOfNumberLabels);
        boxOfLabels.add(boxOfPercentLabels);
        boxOfLabels.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7));

        // put the boxOfLabels in a scrollPane -- with many states, will get
        // very large
        JScrollPane stateScroller = new JScrollPane(boxOfLabels);
        int scrollPaneWidth = (int) (displayWidth * 0.8);
        int scrollPaneHeight = displayHeight / 4;
        stateScroller.setPreferredSize(new Dimension(scrollPaneWidth, scrollPaneHeight));
        stateScroller.setMinimumSize(new Dimension(scrollPaneWidth, scrollPaneHeight));
        stateScroller.setMaximumSize(new Dimension(scrollPaneWidth, scrollPaneHeight));
        stateScroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

        // create a "plot zero state" check box
        plotZeroStateCheckBox = new JCheckBox(PLOT_ZERO_STATE);
        plotZeroStateCheckBox.setSelected(true);
        plotZeroStateCheckBox.setToolTipText(PLOT_ZERO_STATE_TOOLTIP);
        plotZeroStateCheckBox.setActionCommand(PLOT_ZERO_STATE);
        plotZeroStateCheckBox.addActionListener(this);
        JPanel plotZeroStatePanel = new JPanel(new BorderLayout());
        plotZeroStatePanel.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7));
        plotZeroStatePanel.add(BorderLayout.CENTER, plotZeroStateCheckBox);

        // create a "save data" check box
        saveDataCheckBox = new JCheckBox(SAVE_DATA);
        saveDataCheckBox.setToolTipText(SAVE_DATA_TOOLTIP);
        saveDataCheckBox.setActionCommand(SAVE_DATA);
        saveDataCheckBox.addActionListener(this);
        JPanel saveDataPanel = new JPanel(new BorderLayout());
        saveDataPanel.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7));
        saveDataPanel.add(BorderLayout.CENTER, saveDataCheckBox);

        // create a panel that plots the data
        plot = new SimplePlot();

        // add all the components to the panel
        int row = 0;
        displayPanel.add(messagePanel, new GBC(1, row).setSpan(4, 1).setFill(GBC.BOTH).setWeight(1.0, 1.0)
                .setAnchor(GBC.WEST).setInsets(1));

        row++;
        displayPanel.add(plot, new GBC(1, row).setSpan(4, 1).setFill(GBC.BOTH).setWeight(10.0, 10.0)
                .setAnchor(GBC.WEST).setInsets(1));

        row++;
        for (int i = 0; i < numberOfStates; i++) {
            timeSeriesPlot[i] = new SimplePlot();
            displayPanel.add(timeSeriesPlot[i], new GBC(1, row).setSpan(4, 1).setFill(GBC.BOTH)
                    .setWeight(10.0, 10.0).setAnchor(GBC.WEST).setInsets(1));

            row++;
        }
        displayPanel.add(plotZeroStatePanel, new GBC(1, row).setSpan(4, 1).setFill(GBC.NONE).setWeight(1.0, 1.0)
                .setAnchor(GBC.CENTER).setInsets(1));

        row++;
        displayPanel.add(generationLabel, new GBC(1, row).setSpan(1, 1).setFill(GBC.NONE).setWeight(1.0, 1.0)
                .setAnchor(GBC.EAST).setInsets(1));
        displayPanel.add(generationDataLabel, new GBC(2, row).setSpan(1, 1).setFill(GBC.NONE)
                .setWeight(1.0, 1.0).setAnchor(GBC.WEST).setInsets(1));

        row++;
        displayPanel.add(stateScroller, new GBC(1, row).setSpan(4, 1).setFill(GBC.BOTH).setWeight(1.0, 1.0)
                .setAnchor(GBC.WEST).setInsets(1));

        row++;
        displayPanel.add(saveDataPanel, new GBC(1, row).setSpan(4, 1).setFill(GBC.NONE).setWeight(1.0, 1.0)
                .setAnchor(GBC.CENTER).setInsets(1));

    } else {
        int row = 0;
        displayPanel.add(createWarningMessagePanel(), new GBC(1, row).setSpan(4, 1).setFill(GBC.BOTH)
                .setWeight(1.0, 1.0).setAnchor(GBC.WEST).setInsets(1));
    }

}

From source file:com.archivas.clienttools.arcmover.gui.panels.ProfilePanel.java

private void initGuiComponents() {
    fileListModel = new FileListTableModel();
    fileList = new FileListTable(fileListModel);
    fileList.addKeyListener(new KeyAdapter() {
        @Override/*w  w w . j a v a 2 s  .  c  o m*/
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                openSelectedFile();
                e.consume();
            }
        }
    });
    fileList.setAutoCreateColumnsFromModel(true);
    fileList.setDropMode(DropMode.ON_OR_INSERT_ROWS);
    fileList.setFillsViewportHeight(true);
    fileList.setGridColor(new Color(-1));

    fileListScrollPane = new JScrollPane(fileList);
    fileListScrollPane.setAutoscrolls(false);
    fileListScrollPane.setBackground(UIManager.getColor("TableHeader.background"));
    fileListScrollPane.setPreferredSize(new Dimension(100, 128));
    fileListScrollPane.setEnabled(false);

    //
    // toolbar
    //

    final JToolBar toolBar1 = new JToolBar();
    toolBar1.setBorderPainted(false);
    toolBar1.setFloatable(false);
    toolBar1.setRollover(true);
    toolBar1.putClientProperty("JToolBar.isRollover", Boolean.TRUE);

    homeDirectoryButton = new JButton();
    homeDirectoryButton.setHorizontalAlignment(2);
    homeDirectoryButton.setIcon(GUIHelper.HOME_ICON);
    homeDirectoryButton.setMargin(new Insets(3, 3, 3, 3));
    homeDirectoryButton.setText("");
    homeDirectoryButton.setToolTipText("Go to home directory");
    homeDirectoryButton.setEnabled(false);
    toolBar1.add(homeDirectoryButton);

    refreshButton = new JButton();
    refreshButton.setHorizontalAlignment(2);
    refreshButton.setIcon(new ImageIcon(getClass().getResource("/images/refresh.gif")));
    refreshButton.setMargin(new Insets(3, 3, 3, 3));
    refreshButton.setText("");
    refreshButton.setToolTipText("Refresh current directory listing");
    refreshButton.setEnabled(false);
    toolBar1.add(refreshButton);

    upDirectoryButton = new JButton();
    upDirectoryButton.setHideActionText(false);
    upDirectoryButton.setHorizontalAlignment(2);
    upDirectoryButton.setIcon(GUIHelper.UP_DIR_ICON);
    upDirectoryButton.setMargin(new Insets(3, 3, 3, 3));
    upDirectoryButton.setToolTipText("Up");
    upDirectoryButton.setEnabled(false);
    toolBar1.add(upDirectoryButton);

    browseDirectoryButton = new JButton();
    browseDirectoryButton.setHideActionText(false);
    browseDirectoryButton.setHorizontalAlignment(2);
    browseDirectoryButton.setIcon(GUIHelper.DIRECTORY_ICON);
    browseDirectoryButton.setMargin(new Insets(3, 3, 3, 3));
    browseDirectoryButton.setToolTipText(BROWSE_LFS_TEXT);
    browseDirectoryButton.setEnabled(false);
    toolBar1.add(browseDirectoryButton);

    profileModel = new ProfileComboBoxModel();
    profileSelectionCombo = new JComboBox(profileModel);
    profileSelectionCombo.setEnabled(false);
    profileSelectionCombo.setToolTipText("Select a namespace profile");
    profileSelectionCombo.setPrototypeDisplayValue("#");

    pathCombo = new JComboBox();
    pathCombo.setEditable(false);
    pathCombo.setEnabled(false);
    pathCombo.setToolTipText("Current directory path");
    pathCombo.setPrototypeDisplayValue("#");

    sslButton = new JButton();
    sslButton.setAlignmentY(0.0f);
    sslButton.setBorderPainted(false);
    sslButton.setHorizontalAlignment(2);
    sslButton.setHorizontalTextPosition(11);
    sslButton.setIcon(new ImageIcon(getClass().getResource("/images/lockedstate.gif")));
    sslButton.setMargin(new Insets(0, 0, 0, 0));
    sslButton.setMaximumSize(new Dimension(20, 20));
    sslButton.setMinimumSize(new Dimension(20, 20));
    sslButton.setPreferredSize(new Dimension(20, 20));
    sslButton.setText("");
    sslButton.setToolTipText("View certificate");
    sslButton.setEnabled(false);

    //
    // profile and toolbar buttons
    //
    JPanel profileAndToolbarPanel = new FixedHeightPanel();
    profileAndToolbarPanel.setLayout(new BoxLayout(profileAndToolbarPanel, BoxLayout.X_AXIS));
    profileAndToolbarPanel.add(profileSelectionCombo);
    profileAndToolbarPanel.add(Box.createHorizontalStrut(25));
    profileAndToolbarPanel.add(toolBar1);

    //
    // Path & SSLCert button
    //
    JPanel pathPanel = new FixedHeightPanel();
    pathPanel.setLayout(new BoxLayout(pathPanel, BoxLayout.X_AXIS));
    pathCombo.setAlignmentY(CENTER_ALIGNMENT);
    pathPanel.add(pathCombo);
    pathPanel.add(Box.createHorizontalStrut(5));
    sslButton.setAlignmentY(CENTER_ALIGNMENT);
    pathPanel.add(sslButton);

    //
    // Put it all together
    //
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(profileAndToolbarPanel);
    add(Box.createVerticalStrut(5));
    add(pathPanel);
    add(Box.createVerticalStrut(5));
    add(fileListScrollPane);
    setBorder(new EmptyBorder(12, 12, 12, 12));
}

From source file:org.isatools.isacreator.wizard.GeneralCreationAlgorithm.java

public JPanel instantiatePanel() {
    final JPanel generalQuestionCont = new JPanel();
    generalQuestionCont.setLayout(new BoxLayout(generalQuestionCont, BoxLayout.PAGE_AXIS));
    generalQuestionCont.setBackground(UIHelper.BG_COLOR);

    JLabel info = new JLabel("<html><b>" + assay.getMeasurementEndpoint() + "</b> using <b>"
            + assay.getTechnologyType() + "</b></html>", JLabel.LEFT);
    UIHelper.renderComponent(info, UIHelper.VER_12_PLAIN, UIHelper.GREY_COLOR, false);

    if (assay.getTechnologyType().equals("")) {
        info.setText("<html><b>" + assay.getMeasurementEndpoint() + "</html>");
    }/*  w  ww .  ja v a2 s.co  m*/

    info.setPreferredSize(new Dimension(300, 40));

    JPanel infoPanel = new JPanel(new GridLayout(1, 1));
    infoPanel.setBackground(UIHelper.BG_COLOR);

    infoPanel.add(info);

    generalQuestionCont.add(infoPanel);

    JPanel labelPanel = new JPanel(new GridLayout(1, 2));
    labelPanel.setBackground(UIHelper.BG_COLOR);

    labelCapture = new LabelCapture("Label");
    labelCapture.setVisible(false);

    labelUsed = new JCheckBox("Label used?", false);
    UIHelper.renderComponent(labelUsed, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, UIHelper.BG_COLOR);

    labelUsed.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            labelCapture.setVisible(labelUsed.isSelected());

        }
    });

    labelPanel.add(labelUsed);
    labelPanel.add(labelCapture);

    generalQuestionCont.add(labelPanel);

    final JPanel extractPanel = new JPanel(new GridLayout(2, 2));
    extractPanel.setBackground(UIHelper.BG_COLOR);

    extractDetails.clear();

    JLabel extractsUsedLab = UIHelper.createLabel("Sample(s) used *");
    extractsUsedLab.setHorizontalAlignment(JLabel.LEFT);
    extractsUsedLab.setVerticalAlignment(JLabel.TOP);

    final JPanel extractNameContainer = new JPanel();
    extractNameContainer.setLayout(new BoxLayout(extractNameContainer, BoxLayout.PAGE_AXIS));
    extractNameContainer.setBackground(UIHelper.BG_COLOR);

    extract = new ExtractDetailsCapture("Sample " + (extractDetails.size() + 1),
            ApplicationManager.getUserInterfaceForISASection(study).getDataEntryEnvironment());

    extractDetails.add(extract);
    extractNameContainer.add(extract);

    JLabel addButton = new JLabel("add sample", addRecordIcon, JLabel.RIGHT);
    UIHelper.renderComponent(addButton, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, false);

    addButton.setVerticalAlignment(JLabel.TOP);
    addButton.addMouseListener(new MouseAdapter() {

        public void mousePressed(MouseEvent event) {
            extract = new ExtractDetailsCapture("Sample " + (extractDetails.size() + 1),
                    ApplicationManager.getUserInterfaceForISASection(study).getDataEntryEnvironment());
            extractDetails.add(extract);
            extractNameContainer.add(extract);

            extractNameContainer.revalidate();
            generalQuestionCont.revalidate();
        }

    });

    addButton.setToolTipText(
            "<html><b>add new sample</b><p>add another sample (e.g. Liver, Heart, Urine, Blood)</p></html>");

    JLabel removeButton = new JLabel("remove sample", removeIcon, JLabel.RIGHT);
    removeButton.setVerticalAlignment(JLabel.TOP);
    UIHelper.renderComponent(removeButton, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, false);
    removeButton.addMouseListener(new MouseAdapter() {

        public void mousePressed(MouseEvent event) {
            if (extractDetails.size() > 1) {
                extract = extractDetails.get(extractDetails.size() - 1);
                extractDetails.remove(extract);
                extractNameContainer.remove(extract);
                generalQuestionCont.revalidate();
            }
        }

    });
    removeButton.setToolTipText(
            "<html><b>remove previously added sample</b><p>remove the sample field last added</p></html>");

    extractPanel.add(extractsUsedLab);
    extractPanel.add(extractNameContainer);

    JPanel buttonContainer = new JPanel(new GridLayout(1, 2));
    buttonContainer.setBackground(UIHelper.BG_COLOR);

    buttonContainer.add(addButton);
    buttonContainer.add(removeButton);

    extractPanel.add(new JLabel());
    extractPanel.add(buttonContainer);

    generalQuestionCont.add(extractPanel);

    generalQuestionCont.add(Box.createVerticalStrut(5));
    generalQuestionCont.add(Box.createHorizontalGlue());

    generalQuestionCont.setBorder(new TitledBorder(new RoundedBorder(UIHelper.DARK_GREEN_COLOR, 9),
            assay.getAssayReference(), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
            UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR));

    return generalQuestionCont;
}

From source file:org.genedb.jogra.plugins.TermRationaliser.java

/**
 * Return a new JFrame which is the main interface to the Rationaliser.
 *//*from  www. ja  va 2  s . c  o  m*/
public JFrame getMainPanel() {

    /* JFRAME */
    frame.setTitle(WINDOW_TITLE);
    frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
    frame.setLayout(new BorderLayout());

    /* MENU */
    JMenuBar menuBar = new JMenuBar();

    JMenu actions_menu = new JMenu("Actions");
    JMenuItem actions_mitem_1 = new JMenuItem("Refresh lists");
    actions_mitem_1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            initModels();
        }
    });
    actions_menu.add(actions_mitem_1);

    JMenu about_menu = new JMenu("About");
    JMenuItem about_mitem_1 = new JMenuItem("About");
    about_mitem_1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            JOptionPane.showMessageDialog(null,
                    "Term Rationaliser \n" + "Wellcome Trust Sanger Institute, UK \n" + "2009",
                    "Term Rationaliser", JOptionPane.PLAIN_MESSAGE);
        }
    });
    about_menu.add(about_mitem_1);

    menuBar.add(about_menu);
    menuBar.add(actions_menu);
    frame.add(menuBar, BorderLayout.NORTH);

    /* MAIN BOX */
    Box center = Box.createHorizontalBox(); //A box that displays contents from left to right
    center.add(Box.createHorizontalStrut(5)); //Invisible fixed-width component

    /* FROM LIST AND PANEL */
    fromList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); //Allow multiple products to be selected 
    fromList.addKeyListener(new KeyListener() {
        @Override
        public void keyPressed(KeyEvent arg0) {
            if (arg0.getKeyCode() == KeyEvent.VK_RIGHT) {
                synchroniseLists(fromList, toList); //synchronise from left to right
            }
        }

        @Override
        public void keyReleased(KeyEvent arg0) {
        }

        @Override
        public void keyTyped(KeyEvent arg0) {
        }
    });

    Box fromPanel = this.createRationaliserPanel(FROM_LIST_NAME, fromList); //Box on left hand side
    fromPanel.add(Box.createVerticalStrut(55)); //Add some space
    center.add(fromPanel); //Add to main box
    center.add(Box.createHorizontalStrut(3)); //Add some space

    /* MIDDLE PANE */
    Box middlePane = Box.createVerticalBox();

    ClassLoader classLoader = this.getClass().getClassLoader(); //Needed to access the images later on
    ImageIcon leftButtonIcon = new ImageIcon(classLoader.getResource("left_arrow.gif"));
    ImageIcon rightButtonIcon = new ImageIcon(classLoader.getResource("right_arrow.gif"));

    leftButtonIcon = new ImageIcon(leftButtonIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH)); //TODO: Investigate simpler way to resize an icon!
    rightButtonIcon = new ImageIcon(rightButtonIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH)); //TODO: Investigate simpler way to resize an icon!

    JButton rightSynch = new JButton(rightButtonIcon);
    rightSynch.setToolTipText("Synchronise TO list. \n Shortcut: Right-arrow key");

    rightSynch.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            synchroniseLists(fromList, toList);
        }
    });

    JButton leftSynch = new JButton(leftButtonIcon);
    leftSynch.setToolTipText("Synchronise FROM list. \n Shortcut: Left-arrow key");

    leftSynch.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            synchroniseLists(toList, fromList);
        }
    });

    middlePane.add(rightSynch);
    middlePane.add(leftSynch);

    center.add(middlePane); //Add middle pane to main box
    center.add(Box.createHorizontalStrut(3));

    /* TO LIST AND PANEL */
    toList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); //Single product selection in TO list
    toList.addKeyListener(new KeyListener() {
        @Override
        public void keyPressed(KeyEvent arg0) {
            if (arg0.getKeyCode() == KeyEvent.VK_LEFT) {
                synchroniseLists(toList, fromList); //synchronise from right to left
            }
        }

        @Override
        public void keyReleased(KeyEvent arg0) {
        }

        @Override
        public void keyTyped(KeyEvent arg0) {
        }
    });

    Box toPanel = this.createRationaliserPanel(TO_LIST_NAME, toList);

    Box newTerm = Box.createVerticalBox();

    textField = new JTextArea(1, 1); //textfield to let the user edit the name of an existing term
    textField.setMaximumSize(new Dimension(Toolkit.getDefaultToolkit().getScreenSize().height, 10));

    textField.setForeground(Color.BLUE);
    JScrollPane jsp = new JScrollPane(textField); //scroll pane so that there is a horizontal scrollbar
    jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    newTerm.add(jsp);
    TitledBorder editBorder = BorderFactory.createTitledBorder("Edit term name");
    editBorder.setTitleColor(Color.DARK_GRAY);
    newTerm.setBorder(editBorder);
    toPanel.add(newTerm); //add textfield to panel

    center.add(toPanel); //add panel to main box
    center.add(Box.createHorizontalStrut(5));

    frame.add(center); //add the main panel to the frame

    initModels(); //load the lists with data

    /* BOTTOM HALF OF FRAME */
    Box main = Box.createVerticalBox();
    TitledBorder border = BorderFactory.createTitledBorder("Information");
    border.setTitleColor(Color.DARK_GRAY);

    /* INFORMATION BOX */
    Box info = Box.createVerticalBox();

    Box scope = Box.createHorizontalBox();
    scope.add(Box.createHorizontalStrut(5));
    scope.add(scopeLabel); //label showing the scope of the terms
    scope.add(Box.createHorizontalGlue());

    Box productCount = Box.createHorizontalBox();
    productCount.add(Box.createHorizontalStrut(5));
    productCount.add(productCountLabel); //display the label showing the number of terms
    productCount.add(Box.createHorizontalGlue());

    info.add(scope);
    info.add(productCount);
    info.setBorder(border);

    /* ACTION BUTTONS */
    Box actionButtons = Box.createHorizontalBox();
    actionButtons.add(Box.createHorizontalGlue());
    actionButtons.add(Box.createHorizontalStrut(10));

    JButton findFix = new JButton(new FindClosestMatchAction());
    actionButtons.add(findFix);
    actionButtons.add(Box.createHorizontalStrut(10));

    RationaliserAction ra = new RationaliserAction();
    // RationaliserAction2 ra2 = new RationaliserAction2();
    JButton go = new JButton(ra);
    actionButtons.add(go);
    actionButtons.add(Box.createHorizontalGlue());

    /* MORE INFORMATION TOGGLE */
    Box buttonBox = Box.createHorizontalBox();
    final JButton toggle = new JButton("Hide information <<");

    buttonBox.add(Box.createHorizontalStrut(5));
    buttonBox.add(toggle);
    buttonBox.add(Box.createHorizontalGlue());

    Box textBox = Box.createHorizontalBox();

    final JScrollPane scrollPane = new JScrollPane(information);
    scrollPane.setPreferredSize(new Dimension(frame.getWidth(), 100));
    scrollPane.setVisible(true);
    textBox.add(Box.createHorizontalStrut(5));
    textBox.add(scrollPane);

    ActionListener actionListener = new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            if (toggle.getText().equals("Show information >>")) {
                scrollPane.setVisible(true);
                toggle.setText("Hide information <<");
                frame.setPreferredSize(new Dimension(frame.getWidth(), frame.getHeight() + 100));
                frame.pack();
            } else if (toggle.getText().equals("Hide information <<")) {
                scrollPane.setVisible(false);
                toggle.setText("Show information >>");
                frame.setPreferredSize(new Dimension(frame.getWidth(), frame.getHeight() - 100));
                frame.pack();
            }
        }
    };
    toggle.addActionListener(actionListener);

    main.add(Box.createVerticalStrut(5));
    main.add(info);
    main.add(Box.createVerticalStrut(5));
    main.add(Box.createVerticalStrut(5));
    main.add(actionButtons);
    main.add(Box.createVerticalStrut(10));
    main.add(buttonBox);
    main.add(textBox);

    frame.add(main, BorderLayout.SOUTH);
    frame.pack();
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    frame.setVisible(true);
    //initModels();

    return frame;
}

From source file:org.isatools.isacreator.wizard.MicroarrayCreationAlgorithm.java

private JPanel instantiatePanel() {
    final JPanel microArrayQuestionCont = new JPanel();
    microArrayQuestionCont.setLayout(new BoxLayout(microArrayQuestionCont, BoxLayout.PAGE_AXIS));
    microArrayQuestionCont.setOpaque(false);

    StringBuilder text = new StringBuilder("<html><b>" + assay.getMeasurementEndpoint() + "</b> using <b>"
            + assay.getTechnologyType() + "</b>");

    if (!StringUtils.isEmpty(assay.getAssayPlatform())) {
        text.append(" on <b>").append(assay.getAssayPlatform()).append("</b>");
    }/*from w  w  w. j  ava  2  s . c o m*/

    JLabel info = new JLabel(text.append("</html>").toString(), JLabel.LEFT);

    UIHelper.renderComponent(info, UIHelper.VER_12_PLAIN, UIHelper.GREY_COLOR, false);
    info.setPreferredSize(new Dimension(300, 40));

    JPanel infoPanel = new JPanel(new GridLayout(1, 1));
    infoPanel.setOpaque(false);

    infoPanel.add(info);

    microArrayQuestionCont.add(infoPanel);

    // create reference sample used checkbox

    JPanel labelPanel = new JPanel(new GridLayout(2, 2));
    labelPanel.setBackground(UIHelper.BG_COLOR);

    final DataEntryForm studyUISection = ApplicationManager.getUserInterfaceForISASection(study);
    System.out.println("Study user interface is null? " + (studyUISection == null));
    System.out
            .println("Study user interface dep is null? " + (studyUISection.getDataEntryEnvironment() == null));

    label1Capture = new LabelCapture("Label (e.g. Cy3)");
    label2Capture = new LabelCapture("Label (e.g. Cy5)");
    label2Capture.setVisible(false);

    // create dye swap check box
    dyeSwapUsed = new JCheckBox("dye-swap performed?", false);
    UIHelper.renderComponent(dyeSwapUsed, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, false);

    dyeSwapUsed.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            label2Capture.setVisible(dyeSwapUsed.isSelected());

        }
    });

    labelPanel.add(UIHelper.createLabel("Label(s) used"));
    labelPanel.add(label1Capture);
    labelPanel.add(dyeSwapUsed);
    labelPanel.add(label2Capture);

    microArrayQuestionCont.add(labelPanel);

    final JPanel extractPanel = new JPanel(new GridLayout(2, 2));
    extractPanel.setOpaque(false);

    extractDetails.clear();

    JLabel extractsUsedLab = UIHelper.createLabel("sample(s) used *");
    extractsUsedLab.setHorizontalAlignment(JLabel.LEFT);
    extractsUsedLab.setVerticalAlignment(JLabel.TOP);

    final JPanel extractNameContainer = new JPanel();
    extractNameContainer.setLayout(new BoxLayout(extractNameContainer, BoxLayout.PAGE_AXIS));
    extractNameContainer.setOpaque(false);

    extract = new ExtractDetailsCapture("Sample " + (extractDetails.size() + 1),
            studyUISection.getDataEntryEnvironment());

    extractDetails.add(extract);
    extractNameContainer.add(extract);

    JLabel addExtractButton = new JLabel("add sample", addRecordIcon, JLabel.RIGHT);
    UIHelper.renderComponent(addExtractButton, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, false);

    addExtractButton.setVerticalAlignment(JLabel.TOP);
    addExtractButton.addMouseListener(new MouseAdapter() {

        public void mousePressed(MouseEvent event) {
            extract = new ExtractDetailsCapture("Sample " + (extractDetails.size() + 1),
                    studyUISection.getDataEntryEnvironment());
            extractDetails.add(extract);
            extractNameContainer.add(extract);

            extractNameContainer.revalidate();
            microArrayQuestionCont.revalidate();
        }
    });

    addExtractButton.setToolTipText(
            "<html><b>add new sample</b><p>add another sample (e.g. Liver, Heart, Urine, Blood)</p></html>");

    JLabel removeExtractButton = new JLabel("remove sample", removeIcon, JLabel.RIGHT);
    removeExtractButton.setVerticalAlignment(JLabel.TOP);
    UIHelper.renderComponent(removeExtractButton, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, false);
    removeExtractButton.addMouseListener(new MouseAdapter() {

        public void mousePressed(MouseEvent event) {
            if (extractDetails.size() > 1) {
                extract = extractDetails.get(extractDetails.size() - 1);
                extractDetails.remove(extract);
                extractNameContainer.remove(extract);
                microArrayQuestionCont.revalidate();
            }
        }
    });
    removeExtractButton.setToolTipText(
            "<html><b>remove previously added sample</b><p>remove the array design field last added</p></html>");

    extractPanel.add(extractsUsedLab);
    extractPanel.add(extractNameContainer);

    JPanel extractButtonContainer = new JPanel(new GridLayout(1, 2));
    extractButtonContainer.setOpaque(false);

    extractButtonContainer.add(addExtractButton);
    extractButtonContainer.add(removeExtractButton);

    extractPanel.add(new JLabel());
    extractPanel.add(extractButtonContainer);

    microArrayQuestionCont.add(extractPanel);

    // ask for array designs used...
    // create array designs panel
    final JPanel arrayDesignPanel = new JPanel(new GridLayout(2, 2));
    arrayDesignPanel.setOpaque(false);

    arrayDesignsUsed.clear();

    JLabel arrayDesignLab = UIHelper.createLabel("array design(s) used *");
    arrayDesignLab.setVerticalAlignment(JLabel.TOP);
    // the array designs container must adjust to an unknown number of fields. therefore, a JPanel with a BoxLayout
    // will be used since it is flexible!
    final JPanel arrayDesignsContainer = new JPanel();
    arrayDesignsContainer.setLayout(new BoxLayout(arrayDesignsContainer, BoxLayout.PAGE_AXIS));
    arrayDesignsContainer.setOpaque(false);

    newArrayDesign = new AutoFilterCombo(arrayDesigns, true);

    UIHelper.renderComponent(newArrayDesign, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false);
    newArrayDesign.setPreferredSize(new Dimension(70, 30));

    arrayDesignsContainer.add(newArrayDesign);
    arrayDesignsUsed.add(newArrayDesign);

    JLabel addButton = new JLabel("add design", addRecordIcon, JLabel.RIGHT);

    UIHelper.renderComponent(addButton, UIHelper.VER_10_PLAIN, UIHelper.DARK_GREEN_COLOR, false);
    addButton.setVerticalAlignment(JLabel.TOP);
    addButton.addMouseListener(new MouseAdapter() {

        public void mousePressed(MouseEvent event) {
            newArrayDesign = new AutoFilterCombo(arrayDesigns, true);
            UIHelper.renderComponent(newArrayDesign, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false);
            newArrayDesign.setPreferredSize(new Dimension(70, 30));
            arrayDesignsUsed.add(newArrayDesign);
            arrayDesignsContainer.add(newArrayDesign);
            arrayDesignsContainer.revalidate();
            microArrayQuestionCont.revalidate();
        }

    });
    addButton.setToolTipText("<html><b>add new array design</b><p>add another array design</p></html>");

    JLabel removeButton = new JLabel("remove design", removeIcon, JLabel.RIGHT);
    removeButton.setVerticalAlignment(JLabel.TOP);
    UIHelper.renderComponent(removeButton, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, false);
    removeButton.addMouseListener(new MouseAdapter() {

        public void mousePressed(MouseEvent event) {
            if (arrayDesignsUsed.size() > 1) {
                newArrayDesign = arrayDesignsUsed.get(arrayDesignsUsed.size() - 1);
                arrayDesignsUsed.remove(newArrayDesign);
                arrayDesignsContainer.remove(newArrayDesign);
                arrayDesignPanel.revalidate();
                microArrayQuestionCont.validate();
            }
        }

    });
    removeButton.setToolTipText(
            "<html><b>remove previously added array design</b><p>remove the array design field last added</p></html>");

    arrayDesignPanel.add(arrayDesignLab);
    arrayDesignPanel.add(arrayDesignsContainer);

    JPanel buttonContainer = new JPanel(new GridLayout(1, 2));
    buttonContainer.setOpaque(false);

    buttonContainer.add(addButton);
    buttonContainer.add(removeButton);

    arrayDesignPanel.add(new JLabel());
    arrayDesignPanel.add(buttonContainer);

    microArrayQuestionCont.add(arrayDesignPanel);

    microArrayQuestionCont.add(Box.createVerticalStrut(5));
    microArrayQuestionCont.add(Box.createHorizontalGlue());

    microArrayQuestionCont.setBorder(new TitledBorder(new RoundedBorder(UIHelper.DARK_GREEN_COLOR, 9),
            assay.getAssayReference(), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
            UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR));

    return microArrayQuestionCont;
}