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.nbheaven.sqe.codedefects.history.controlcenter.panels.SQEHistoryPanel.java

/** Creates new form SQEHistoryPanel */
public SQEHistoryPanel() {
    historyChart = org.jfree.chart.ChartFactory.createStackedXYAreaChart(null, "Snapshot", "CodeDefects",
            perProjectDataSet, PlotOrientation.VERTICAL, false, true, false);
    historyChart.setBackgroundPaint(Color.WHITE);
    historyChart.getXYPlot().setRangeGridlinePaint(Color.BLACK);
    historyChart.getXYPlot().setDomainGridlinePaint(Color.BLACK);
    historyChart.getXYPlot().setBackgroundPaint(Color.WHITE);

    XYPlot plot = historyChart.getXYPlot();
    plot.setForegroundAlpha(0.7f);/*from  w  w  w . ja  va2  s.c  o m*/
    //        plot.getRenderer();

    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    LogarithmicAxis rangeAxis = new LogarithmicAxis("CodeDefects");
    rangeAxis.setStrictValuesFlag(false);
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    plot.setRangeAxis(rangeAxis);

    StackedXYAreaRenderer2 categoryItemRenderer = new StackedXYAreaRenderer2(); //3D();
    categoryItemRenderer.setSeriesPaint(0, Color.RED);
    categoryItemRenderer.setSeriesPaint(1, Color.ORANGE);
    categoryItemRenderer.setSeriesPaint(2, Color.YELLOW);

    plot.setRenderer(categoryItemRenderer);

    ChartPanel historyChartPanel = new ChartPanel(historyChart);
    historyChartPanel.setBorder(null);
    historyChartPanel.setPreferredSize(new Dimension(150, 200));
    historyChartPanel.setBackground(Color.WHITE);
    initComponents();

    historyView.setLayout(new BorderLayout());
    historyView.add(historyChartPanel, BorderLayout.CENTER);

    JPanel selectorPanel = new JPanel();
    selectorPanel.setOpaque(false);

    GroupLayout layout = new GroupLayout(selectorPanel);
    selectorPanel.setLayout(layout);

    // Turn on automatically adding gaps between components
    layout.setAutocreateGaps(true);

    // Turn on automatically creating gaps between components that touch
    // the edge of the container and the container.
    layout.setAutocreateContainerGaps(true);

    ParallelGroup horizontalParallelGroup = layout.createParallelGroup(GroupLayout.LEADING);
    SequentialGroup verticalSequentialGroup = layout.createSequentialGroup();

    layout.setHorizontalGroup(layout.createSequentialGroup().add(horizontalParallelGroup));

    layout.setVerticalGroup(verticalSequentialGroup);

    clearHistoryButton = new JButton();
    clearHistoryButton.setEnabled(false);
    clearHistoryButton.setIcon(ImageUtilities
            .image2Icon(ImageUtilities.loadImage("org/nbheaven/sqe/codedefects/history/resources/trash.png")));
    clearHistoryButton.setOpaque(false);
    clearHistoryButton.setFocusPainted(false);
    clearHistoryButton.setToolTipText(
            NbBundle.getBundle("org/nbheaven/sqe/codedefects/history/controlcenter/panels/Bundle")
                    .getString("HINT_clear_button"));
    horizontalParallelGroup.add(clearHistoryButton);
    verticalSequentialGroup.add(clearHistoryButton);
    clearHistoryButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (null != activeHistory) {
                activeHistory.clear();
            }
        }

    });

    Component createVerticalStrut = Box.createVerticalStrut(10);

    horizontalParallelGroup.add(createVerticalStrut);
    verticalSequentialGroup.add(createVerticalStrut);

    for (final QualityProvider provider : SQEUtilities.getProviders()) {
        final JToggleButton providerButton = new JToggleButton();
        providerButton.setIcon(provider.getIcon());
        providerButton.setOpaque(false);
        providerButton.setFocusPainted(false);
        horizontalParallelGroup.add(providerButton);
        verticalSequentialGroup.add(providerButton);
        ActionListener listener = new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (providerButton.isSelected()) {
                    addSelectedProvider(provider);
                } else {
                    removeSelectedProvider(provider);
                }
                updateView();
            }
        };
        providerButton.addActionListener(listener);
        addSelectedProvider(provider);
        providerButton.setSelected(true);
    }

    historyView.add(selectorPanel, BorderLayout.EAST);
}

From source file:components.FrameDemo2.java

protected JComponent createOptionControls() {
    JLabel label1 = new JLabel("Decoration options for subsequently created frames:");
    ButtonGroup bg1 = new ButtonGroup();
    JLabel label2 = new JLabel("Icon options:");
    ButtonGroup bg2 = new ButtonGroup();

    //Create the buttons
    JRadioButton rb1 = new JRadioButton();
    rb1.setText("Look and feel decorated");
    rb1.setActionCommand(LF_DECORATIONS);
    rb1.addActionListener(this);
    rb1.setSelected(true);//from   w ww  .  j a  v a  2  s . c o  m
    bg1.add(rb1);
    //
    JRadioButton rb2 = new JRadioButton();
    rb2.setText("Window system decorated");
    rb2.setActionCommand(WS_DECORATIONS);
    rb2.addActionListener(this);
    bg1.add(rb2);
    //
    JRadioButton rb3 = new JRadioButton();
    rb3.setText("No decorations");
    rb3.setActionCommand(NO_DECORATIONS);
    rb3.addActionListener(this);
    bg1.add(rb3);
    //
    //
    JRadioButton rb4 = new JRadioButton();
    rb4.setText("Default icon");
    rb4.setActionCommand(DEFAULT_ICON);
    rb4.addActionListener(this);
    rb4.setSelected(true);
    bg2.add(rb4);
    //
    JRadioButton rb5 = new JRadioButton();
    rb5.setText("Icon from a JPEG file");
    rb5.setActionCommand(FILE_ICON);
    rb5.addActionListener(this);
    bg2.add(rb5);
    //
    JRadioButton rb6 = new JRadioButton();
    rb6.setText("Painted icon");
    rb6.setActionCommand(PAINT_ICON);
    rb6.addActionListener(this);
    bg2.add(rb6);

    //Add everything to a container.
    Box box = Box.createVerticalBox();
    box.add(label1);
    box.add(Box.createVerticalStrut(5)); //spacer
    box.add(rb1);
    box.add(rb2);
    box.add(rb3);
    //
    box.add(Box.createVerticalStrut(15)); //spacer
    box.add(label2);
    box.add(Box.createVerticalStrut(5)); //spacer
    box.add(rb4);
    box.add(rb5);
    box.add(rb6);

    //Add some breathing room.
    box.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    return box;
}

From source file:org.colombbus.tangara.AboutWindow.java

/**
 * Sets the image zone of the about window,
 *
 * @param backgroundImg/*from   w ww  .j  a v a2s.  c  o  m*/
 */
private void initialize(Image backgroundImg) {
    updateWindowIcon();

    BufferedImage headerImage = createBackgroundImage(backgroundImg);
    imagePanel = new ImageComponent(headerImage);
    imagePanel.setBounds(0, 0, headerImage.getWidth(), headerImage.getHeight());
    imagePanel.setOpaque(true);
    imagePanel.setLayout(new BoxLayout(imagePanel, BoxLayout.Y_AXIS));

    imagePanel.add(Box.createVerticalStrut(windowHeight / 2));

    JPanel panel = bodyPanel();
    imagePanel.add(panel);
    imagePanel.add(Box.createVerticalStrut(marginBottom));
    setContentPane(imagePanel);
}

From source file:FrameDemo2.java

protected JComponent createOptionControls() {
    JLabel label1 = new JLabel("Decoration options for subsequently created frames:");
    ButtonGroup bg1 = new ButtonGroup();
    JLabel label2 = new JLabel("Icon options:");
    ButtonGroup bg2 = new ButtonGroup();

    // Create the buttons
    JRadioButton rb1 = new JRadioButton();
    rb1.setText("Look and feel decorated");
    rb1.setActionCommand(LF_DECORATIONS);
    rb1.addActionListener(this);
    rb1.setSelected(true);/*from w w w.  ja  va2 s.c o m*/
    bg1.add(rb1);
    //
    JRadioButton rb2 = new JRadioButton();
    rb2.setText("Window system decorated");
    rb2.setActionCommand(WS_DECORATIONS);
    rb2.addActionListener(this);
    bg1.add(rb2);
    //
    JRadioButton rb3 = new JRadioButton();
    rb3.setText("No decorations");
    rb3.setActionCommand(NO_DECORATIONS);
    rb3.addActionListener(this);
    bg1.add(rb3);
    //
    //
    JRadioButton rb4 = new JRadioButton();
    rb4.setText("Default icon");
    rb4.setActionCommand(DEFAULT_ICON);
    rb4.addActionListener(this);
    rb4.setSelected(true);
    bg2.add(rb4);
    //
    JRadioButton rb5 = new JRadioButton();
    rb5.setText("Icon from a JPEG file");
    rb5.setActionCommand(FILE_ICON);
    rb5.addActionListener(this);
    bg2.add(rb5);
    //
    JRadioButton rb6 = new JRadioButton();
    rb6.setText("Painted icon");
    rb6.setActionCommand(PAINT_ICON);
    rb6.addActionListener(this);
    bg2.add(rb6);

    // Add everything to a container.
    Box box = Box.createVerticalBox();
    box.add(label1);
    box.add(Box.createVerticalStrut(5)); // spacer
    box.add(rb1);
    box.add(rb2);
    box.add(rb3);
    //
    box.add(Box.createVerticalStrut(15)); // spacer
    box.add(label2);
    box.add(Box.createVerticalStrut(5)); // spacer
    box.add(rb4);
    box.add(rb5);
    box.add(rb6);

    // Add some breathing room.
    box.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    return box;
}

From source file:org.isatools.gui.datamanager.studyaccess.StudyAccessionGUI.java

private JPanel createEmptyDbPanel() {
    JPanel errorPanel = new JPanel();
    errorPanel.setLayout(new BoxLayout(errorPanel, BoxLayout.PAGE_AXIS));
    errorPanel.setOpaque(false);/*from   ww  w.  ja  va2  s . c  o m*/

    errorPanel.add(new JLabel(noStudiesPresentInfo), JLabel.CENTER);

    // add button to go back to main menu!

    JPanel buttonPanel = new JPanel(new BorderLayout());
    buttonPanel.setOpaque(false);

    buttonPanel.add(createBackToMainMenuButton(), BorderLayout.WEST);

    errorPanel.add(Box.createVerticalStrut(20));
    errorPanel.add(buttonPanel);

    return errorPanel;
}

From source file:org.isatools.gui.datamanager.exportisa.ExportISAGUI.java

public void createGUI() {
    // header image
    add(UIHelper.wrapComponentInPanel(new JLabel(panelHeader, SwingConstants.RIGHT)), BorderLayout.NORTH);

    // add a checkable jtree with investigations & studies...
    JPanel availableSubmissionsContainer = new JPanel(new BorderLayout());
    availableSubmissionsContainer.setOpaque(false);

    JPanel optionsContainer = new JPanel();
    optionsContainer.setLayout(new BoxLayout(optionsContainer, BoxLayout.LINE_AXIS));
    optionsContainer.setOpaque(false);//from   www . j a va 2s.c o  m

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

    JLabel fileInformation = UIHelper.createLabel("<html><i>where</i> to save the isatab files?</html>",
            UIHelper.VER_12_BOLD, UIHelper.LIGHT_GREY_COLOR);
    fileInformation.setVerticalAlignment(JLabel.TOP);

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

    // add component for selection of output to repository or output to folder...
    fileLocationOptionGroup = new OptionGroup<String>(OptionGroup.HORIZONTAL_ALIGNMENT, true);
    fileLocationOptionGroup.addOptionItem("BII repository", true);
    fileLocationOptionGroup.addOptionItem("Local file system");

    localDirectoryLocation = new FileSelectionUtil("select output directory", createFileChooser(),
            UIHelper.VER_11_BOLD, UIHelper.GREY_COLOR);
    localDirectoryLocation.setVisible(false);
    localDirectoryLocation.setPreferredSize(new Dimension(150, 20));

    fileLocationOptionGroup.addPropertyChangeListener("optionSelectionChange", new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
            localDirectoryLocation
                    .setVisible(fileLocationOptionGroup.getSelectedItem().equals("Local file system"));
            revalidate();
        }
    });

    fileLocationOptionContainer.add(UIHelper.wrapComponentInPanel(fileInformation));
    fileLocationOptionContainer.add(UIHelper.wrapComponentInPanel(fileLocationOptionGroup));
    fileLocationOptionContainer.add(Box.createVerticalStrut(5));
    fileLocationOptionContainer.add(UIHelper.wrapComponentInPanel(localDirectoryLocation));

    optionsContainer.add(fileLocationOptionContainer);

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

    JLabel dataFileExportInformation = UIHelper.createLabel("<html>export data files?</html>",
            UIHelper.VER_12_BOLD, UIHelper.LIGHT_GREY_COLOR);
    dataFileExportInformation.setVerticalAlignment(JLabel.TOP);

    dataFileExportOptionGroup = new OptionGroup<String>(OptionGroup.HORIZONTAL_ALIGNMENT, true);
    dataFileExportOptionGroup.addOptionItem("yes", true);
    dataFileExportOptionGroup.addOptionItem("no");

    dataFileExportOptionContainer.add(UIHelper.wrapComponentInPanel(dataFileExportInformation));
    dataFileExportOptionContainer.add(UIHelper.wrapComponentInPanel(dataFileExportOptionGroup));
    dataFileExportOptionContainer.add(Box.createVerticalStrut(25));

    optionsContainer.add(dataFileExportOptionContainer);

    optionsAndInformationPanel.add(Box.createVerticalStrut(5));
    optionsAndInformationPanel.add(optionsContainer);
    optionsAndInformationPanel.add(Box.createVerticalStrut(10));

    JLabel information = UIHelper.createLabel(
            "<html>please <i>select</i> the submissions to be exported...</html>", UIHelper.VER_12_BOLD,
            UIHelper.LIGHT_GREY_COLOR);
    information.setVerticalAlignment(JLabel.TOP);

    optionsAndInformationPanel.add(UIHelper.wrapComponentInPanel(information));
    optionsAndInformationPanel.add(Box.createVerticalStrut(5));

    availableSubmissionsContainer.add(optionsAndInformationPanel, BorderLayout.NORTH);

    retrieveAndProcessStudyInformation();

    JScrollPane treeScroller = new JScrollPane(studyAvailabilityTree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    treeScroller.getViewport().setOpaque(false);
    treeScroller.setOpaque(false);
    treeScroller.setBorder(new EmptyBorder(1, 1, 1, 1));

    treeScroller.setPreferredSize(new Dimension(380, 250));

    availableSubmissionsContainer.add(treeScroller, BorderLayout.CENTER);
    add(availableSubmissionsContainer, BorderLayout.CENTER);
    add(createSouthPanel(), BorderLayout.SOUTH);
}

From source file:plugins.ImageRectificationPanel.java

public final void createGui() {
    this.removeAll();

    if (imageGCPsXCoords == null) {
        return;/*w ww  .ja  va  2s.c o m*/
    }
    int i;
    int newN = 0;
    for (i = 0; i < imageGCPsXCoords.length; i++) {
        if (useGCP[i]) {
            newN++;
        }
    }
    double[] X1 = new double[newN];
    double[] Y1 = new double[newN];
    double[] X2 = new double[newN];
    double[] Y2 = new double[newN];

    int j = 0;
    for (i = 0; i < imageGCPsXCoords.length; i++) {
        if (useGCP[i]) {
            X1[j] = imageGCPsXCoords[i];
            Y1[j] = imageGCPsYCoords[i];
            X2[j] = mapGCPsXCoords[i];
            Y2[j] = mapGCPsYCoords[i];
            j++;
        }
    }

    calculateEquations(X1, Y1, X2, Y2);

    // gui stuff
    this.setLayout(new BorderLayout());

    DecimalFormat df = new DecimalFormat("###,###,##0.000");

    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));
    JButton btnOK = createButton(bundle.getString("OK"), bundle.getString("OK"), "ok");
    JButton btnExit = createButton(bundle.getString("Close"), bundle.getString("Close"), "close");
    //JButton btnRefresh = createButton("Cancel", "Cancel");

    buttonPane.add(Box.createHorizontalStrut(10));
    buttonPane.add(btnOK);
    buttonPane.add(Box.createHorizontalStrut(5));
    //buttonPane.add(btnRefresh);
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.add(btnExit);
    buttonPane.add(Box.createHorizontalGlue());

    progressBar = new JProgressBar(0, 100);
    buttonPane.add(progressBar);
    buttonPane.add(Box.createHorizontalStrut(5));
    cancel = new JLabel(bundle.getString("Cancel"));
    cancel.setForeground(Color.BLUE.darker());
    cancel.addMouseListener(this);
    buttonPane.add(cancel);
    buttonPane.add(Box.createHorizontalStrut(10));

    this.add(buttonPane, BorderLayout.SOUTH);

    Box mainBox = Box.createVerticalBox();
    mainBox.add(Box.createVerticalStrut(10));

    Box box1 = Box.createHorizontalBox();
    box1.add(Box.createHorizontalStrut(10));
    box1.add(new JLabel(bundle.getString("PolynomialOrder") + ": "));
    SpinnerModel model = new SpinnerNumberModel(polyOrder, //initial value
            1, //min
            5, //max
            1); //step

    polyOrderSpinner = new JSpinner(model);
    polyOrderSpinner.setPreferredSize(new Dimension(15, polyOrderSpinner.getPreferredSize().height));
    polyOrderSpinner.addChangeListener(this);

    JSpinner.DefaultEditor editor = (JSpinner.DefaultEditor) polyOrderSpinner.getEditor();
    editor.getTextField().setEnabled(true);
    editor.getTextField().setEditable(false);

    box1.add(polyOrderSpinner);
    box1.add(Box.createHorizontalGlue());
    JLabel label = new JLabel("RMSE: " + df.format(overallRMSE));
    box1.add(label);
    box1.add(Box.createHorizontalStrut(10));
    mainBox.add(box1);

    mainBox.add(Box.createVerticalStrut(10));

    // Create columns names
    int numPoints = imageGCPsXCoords.length;
    Object dataValues[][] = new Object[numPoints][7];
    j = 0;
    for (i = 0; i < numPoints; i++) {
        dataValues[i][0] = i + 1;
        dataValues[i][1] = df.format(imageGCPsXCoords[i]);
        dataValues[i][2] = df.format(imageGCPsYCoords[i]);
        dataValues[i][3] = df.format(mapGCPsXCoords[i]);
        dataValues[i][4] = df.format(mapGCPsYCoords[i]);
        if (useGCP[i]) {
            dataValues[i][5] = df.format(residualsXY[j]);
            j++;
        } else {
            dataValues[i][5] = null;
        }
        dataValues[i][6] = useGCP[i];
    }

    String columnNames[] = { "GCP", bundle.getString("Image") + " X", bundle.getString("Image") + " Y",
            bundle.getString("Map") + " X", bundle.getString("Map") + " Y", messages.getString("Error"),
            "Use" };

    DefaultTableModel tableModel = new DefaultTableModel(dataValues, columnNames);

    dataTable = new JTable(tableModel) {
        private static final long serialVersionUID = 1L;

        @Override
        public Class getColumnClass(int column) {
            switch (column) {
            case 0:
                return Integer.class;
            case 1:
                return String.class; //Double.class;
            case 2:
                return String.class; //Double.class;
            case 3:
                return String.class; //Double.class;
            case 4:
                return String.class; //Double.class;
            case 5:
                return String.class; //Double.class;
            case 6:
                return Boolean.class;
            default:
                return String.class; //Double.class;
            }
        }

        @Override
        public Component prepareRenderer(TableCellRenderer renderer, int index_row, int index_col) {
            Component comp = super.prepareRenderer(renderer, index_row, index_col);
            //even index, selected or not selected

            if (index_row % 2 == 0) {
                comp.setBackground(Color.WHITE);
                comp.setForeground(Color.BLACK);
            } else {
                comp.setBackground(new Color(225, 245, 255)); //new Color(210, 230, 255));
                comp.setForeground(Color.BLACK);
            }
            if (isCellSelected(index_row, index_col)) {
                comp.setForeground(Color.RED);
            }
            return comp;
        }
    };

    tableModel.addTableModelListener(this);

    TableCellRenderer rend = dataTable.getTableHeader().getDefaultRenderer();
    TableColumnModel tcm = dataTable.getColumnModel();
    //for (int j = 0; j < tcm.getColumnCount(); j += 1) {
    TableColumn tc = tcm.getColumn(0);
    TableCellRenderer rendCol = tc.getHeaderRenderer(); // likely null  
    if (rendCol == null) {
        rendCol = rend;
    }
    Component c = rendCol.getTableCellRendererComponent(dataTable, tc.getHeaderValue(), false, false, 0, 0);
    tc.setPreferredWidth(35);

    tc = tcm.getColumn(6);
    rendCol = tc.getHeaderRenderer(); // likely null  
    if (rendCol == null) {
        rendCol = rend;
    }
    c = rendCol.getTableCellRendererComponent(dataTable, tc.getHeaderValue(), false, false, 0, 6);
    tc.setPreferredWidth(35);

    JScrollPane scroll = new JScrollPane(dataTable);
    mainBox.add(scroll);

    this.add(mainBox, BorderLayout.CENTER);

    this.validate();
}

From source file:org.datacleaner.widgets.OpenAnalysisJobFileChooserAccessory.java

private void showFileInformation() {
    JaxbJobReader reader = new JaxbJobReader(_configuration);

    try {/* w  w  w. j a va 2  s.c o m*/
        _metadata = reader.readMetadata(_file);
    } catch (Exception e) {
        // metadata could not be produced so we cannot display the file
        // information
        logger.warn("An unexpected error occurred reading metadata from file", e);
        setVisible(false);
        return;
    }

    _centerPanel.removeAll();

    final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

    final int separatorHeight = 6;

    final String jobName = _metadata.getJobName();
    if (jobName != null) {
        _centerPanel.add(new JLabel("<html><b>Job name:</b></html>"));
        _centerPanel.add(new JLabel(jobName));
        _centerPanel.add(Box.createVerticalStrut(separatorHeight));
    }
    final String jobDescription = _metadata.getJobDescription();
    if (jobDescription != null) {
        _centerPanel.add(new JLabel("<html><b>Job description:</b></html>"));
        DCLabel descriptionLabel = DCLabel.darkMultiLine(jobDescription);
        descriptionLabel.setMaximumWidth(WIDTH);
        _centerPanel.add(descriptionLabel);
        _centerPanel.add(Box.createVerticalStrut(separatorHeight));
    }
    final String jobVersion = _metadata.getJobVersion();
    if (jobVersion != null) {
        _centerPanel.add(new JLabel("<html><b>Job version:</b></html>"));
        _centerPanel.add(new JLabel(jobVersion));
        _centerPanel.add(Box.createVerticalStrut(separatorHeight));
    }
    final String author = _metadata.getAuthor();
    if (author != null) {
        _centerPanel.add(new JLabel("<html><b>Author:</b></html>"));
        _centerPanel.add(new JLabel(author));
        _centerPanel.add(Box.createVerticalStrut(separatorHeight));
    }
    final Date createdDate = _metadata.getCreatedDate();
    if (createdDate != null) {
        _centerPanel.add(new JLabel("<html><b>Created:</b></html>"));
        _centerPanel.add(new JLabel(dateFormat.format(createdDate)));
        _centerPanel.add(Box.createVerticalStrut(separatorHeight));
    }
    final Date updatedDate = _metadata.getUpdatedDate();
    if (updatedDate != null) {
        _centerPanel.add(new JLabel("<html><b>Updated:</b></html>"));
        _centerPanel.add(new JLabel(dateFormat.format(updatedDate)));
        _centerPanel.add(Box.createVerticalStrut(separatorHeight));
    }

    final String datastoreName = _metadata.getDatastoreName();

    _centerPanel.add(new JLabel("<html><b>Datastore:</b></html>"));
    final JLabel datastoreLabel = new JLabel(datastoreName);

    Datastore datastore = _configuration.getDatastoreCatalog().getDatastore(datastoreName);
    if (datastore == null) {
        _openJobButton.setEnabled(false);
        datastoreLabel.setIcon(imageManager.getImageIcon(IconUtils.STATUS_WARNING, IconUtils.ICON_SIZE_SMALL));
        datastoreLabel.setToolTipText("No such datastore: " + datastoreName);
    } else {
        _openJobButton.setEnabled(true);
        datastoreLabel.setIcon(IconUtils.getDatastoreIcon(datastore, IconUtils.ICON_SIZE_SMALL));
        datastoreLabel.setToolTipText(null);
    }

    _centerPanel.add(datastoreLabel);
    _centerPanel.add(Box.createVerticalStrut(separatorHeight));
    _centerPanel.add(new JLabel("<html><b>Source columns:</b></html>"));
    List<String> paths = _metadata.getSourceColumnPaths();
    for (String path : paths) {
        JLabel columnLabel = new JLabel(path);
        columnLabel.setIcon(imageManager.getImageIcon("images/model/column.png", IconUtils.ICON_SIZE_SMALL));
        _centerPanel.add(columnLabel);
    }

    _centerPanel.updateUI();
    setVisible(true);
}

From source file:org.ecoinformatics.seek.ecogrid.EcogridPreferencesTab.java

private void initButtonPanel() {

    // remember default button font
    final Font defaultUIMgrButtonFont = (Font) UIManager.get("Button.font");

    // now set our custom size, provided it's smaller than the default:
    int buttonFontSize = (defaultUIMgrButtonFont.getSize() < BUTTON_FONT_SIZE)
            ? defaultUIMgrButtonFont.getSize()
            : BUTTON_FONT_SIZE;//w  w  w . ja v  a  2s. c  o m

    final Font BUTTON_FONT = new Font(defaultUIMgrButtonFont.getFontName(), defaultUIMgrButtonFont.getStyle(),
            buttonFontSize);

    UIManager.put("Button.font", BUTTON_FONT);

    refreshButton = new JButton(new ServicesRefreshAction(
            StaticResources.getDisplayString("preferences.data.refresh", "Refresh"), this));
    refreshButton.setMinimumSize(EcogridPreferencesTab.BUTTONDIMENSION);
    refreshButton.setPreferredSize(EcogridPreferencesTab.BUTTONDIMENSION);
    refreshButton.setSize(EcogridPreferencesTab.BUTTONDIMENSION);
    // setMaximumSize was truncating label on osX. I don't know why. 
    // It seems about the same as how SearchUIJPanel does things. -derik
    //refreshButton.setMaximumSize(EcogridPreferencesTab.BUTTONDIMENSION);

    keepExistingCheckbox = new JCheckBox(
            StaticResources.getDisplayString("preferences.data.keepExistingSources", "Keep existing sources"));
    keepExistingCheckbox.setSelected(false);

    JPanel bottomPanel = new JPanel();

    bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS));
    bottomPanel.add(refreshButton);
    bottomPanel.add(keepExistingCheckbox);

    newButtonPanel = new JPanel();
    newButtonPanel.setLayout(new BorderLayout());
    newButtonPanel.add(Box.createVerticalStrut(EcogridPreferencesTab.MARGINGSIZE), BorderLayout.NORTH);
    newButtonPanel.add(bottomPanel, BorderLayout.SOUTH);
    setButtonPanel(newButtonPanel);

    // restore default button font
    if (defaultUIMgrButtonFont != null) {
        UIManager.put("Button.font", defaultUIMgrButtonFont);
    }
}

From source file:de.mpg.mpi_inf.bioinf.netanalyzer.ui.ChartDisplayPanel.java

/**
 * Creates and lays out the controls inside this panel.
 * <p>//  w  ww .j  av a2s. c  om
 * This method is called upon initialization only.
 * </p>
 */
private void initControls() {
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    add(createChartPanel());

    final Box buttonPanel = Box.createVerticalBox();
    final List<JButton> buttons = new ArrayList<JButton>(8);
    btnEnlarged = Utils.createButton(Messages.DI_VIEWENLARGED, Messages.TT_VIEWENLARGED, this);
    if (Plugin.hasFilter(originalParam.getClass())) {
        btnFilter = Utils.createButton(Messages.DI_FILTERDATA, Messages.TT_FILTERDATA, this);
    } else {
        btnFilter = null;
    }
    btnSaveChart = Utils.createButton(Messages.DI_EXPORTCHART, Messages.TT_SAVECHART, this);
    btnSaveData = Utils.createButton(Messages.DI_EXPORTDATA, Messages.TT_SAVEDATA, this);
    btnChartSettings = Utils.createButton(Messages.DI_CHARTSETTINGS, Messages.TT_CHARTSETTINGS, this);

    buttonPanel.add(btnChartSettings);
    buttons.add(btnChartSettings);
    buttonPanel.add(btnEnlarged);
    buttons.add(btnEnlarged);
    if (btnFilter != null) {
        buttonPanel.add(btnFilter);
        buttons.add(btnFilter);
    }
    buttonPanel.add(Box.createVerticalStrut(Utils.BORDER_SIZE * 2));
    if (decorators != null) {
        btnsDec = new JButton[decorators.length];
        for (int i = 0; i < decorators.length; ++i) {
            Decorator d = decorators[i];
            btnsDec[i] = Utils.createButton(d.getButtonLabel(), d.getButtonToolTip(), this);
            buttonPanel.add(btnsDec[i]);
            buttons.add(btnsDec[i]);
        }
        buttonPanel.add(Box.createVerticalStrut(Utils.BORDER_SIZE * 2));
    }
    buttonPanel.add(btnSaveChart);
    buttons.add(btnSaveChart);
    buttonPanel.add(btnSaveData);
    buttons.add(btnSaveData);
    buttonPanel.add(Box.createVerticalStrut(Utils.BORDER_SIZE * 2));
    buttonPanel.add(Box.createVerticalGlue());
    // Ensure buttons are large enough to fit all possible messages
    final JButton[] btnsArray = new JButton[buttons.size()];
    Utils.setSizes(buttons.toArray(btnsArray), preferred, preferred);
    add(buttonPanel);
    add(Box.createHorizontalGlue());
}