Example usage for javax.swing Box createHorizontalStrut

List of usage examples for javax.swing Box createHorizontalStrut

Introduction

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

Prototype

public static Component createHorizontalStrut(int width) 

Source Link

Document

Creates an invisible, fixed-width component.

Usage

From source file:org.openmicroscopy.shoola.agents.treeviewer.util.MIFNotificationDialog.java

/**
 * Layout the result per group./*from  ww  w  . j  av  a 2 s.  c  o m*/
 * 
 * @param object The object to handle
 * @param n The number of objects to handle.
 * @return See above.
 */
private JComponent layoutMIFResult(MIFResultObject object, int n) {
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    Map<Long, Map<Boolean, List<ImageData>>> map = object.getResult();

    Entry<Long, Map<Boolean, List<ImageData>>> e;
    Iterator<Entry<Long, Map<Boolean, List<ImageData>>>> i = map.entrySet().iterator();
    List<ThumbnailData> thumbnails;
    JPanel row;
    List<ImageData> images;
    StringBuffer buf;
    String text = "You tried to move ";
    if (ImageCheckerType.DELETE.equals(index))
        text = "You tried to delete ";
    int size;
    while (i.hasNext()) {
        e = i.next();
        buf = new StringBuffer();
        buf.append(text);

        row = createRow();
        images = e.getValue().get(Boolean.valueOf(true));
        size = images.size();
        buf.append(size);
        buf.append(" image");
        if (size > 1)
            buf.append("s");
        buf.append(" from a fileset, leaving ");

        thumbnails = object.getThumbnailsFromList(images);
        row.add(layoutThumbnails(images.size() - thumbnails.size(), thumbnails));
        row.add(Box.createHorizontalStrut(10));

        images = e.getValue().get(Boolean.valueOf(false));
        buf.append(images.size());
        buf.append(".");
        thumbnails = object.getThumbnailsFromList(images);
        row.add(layoutThumbnails(images.size() - thumbnails.size(), thumbnails));
        p.add(UIUtilities.buildComponentPanel(new JLabel(buf.toString())));
        p.add(row);

    }
    if (n == 1)
        return new JScrollPane(p);
    long id = object.getContext().getGroupID();
    GroupData group = getGroup(id);
    if (group != null)
        text = group.getName();
    else {
        buf = new StringBuffer();
        buf.append("Group ");
        buf.append(id);
        text = buf.toString();
    }
    JXTaskPane pane = EditorUtil.createTaskPane(text);
    pane.add(new JScrollPane(p));
    return pane;
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.ToolBar.java

/** 
 * Builds and lays out the component displayed on the right hand side of
 * the toolbar./*from w w w. j a  va2  s . c  o  m*/
 * 
 * @return See above.
 */
private JPanel buildRightPane() {
    JPanel p = new JPanel();
    p.setBorder(null);
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    p.add(importFailureLabel);
    p.add(Box.createHorizontalStrut(5));
    p.add(importSuccessLabel);
    p.add(Box.createHorizontalStrut(5));
    p.add(importLabel);
    return p;
}

From source file:org.openmicroscopy.shoola.agents.util.SelectionWizard.java

/**
 * Builds and lays out the component to add new objects to the selection.
 * //from   w  ww  .ja  v  a 2  s .c  o  m
 * @return See above.
 */
private JPanel createAdditionPane() {
    JPanel p = new JPanel();
    p.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    if (TagAnnotationData.class.equals(type)) {
        formatAddLabelText();
        p.add(UIUtilities.buildComponentPanel(addLabel));
        JPanel pane = new JPanel();
        pane.setLayout(new BoxLayout(pane, BoxLayout.X_AXIS));
        pane.add(addField);
        pane.add(Box.createHorizontalStrut(5));
        pane.add(descriptionField);
        pane.add(addNewButton);
        p.add(pane);
    }
    return UIUtilities.buildComponentPanel(p);
}

From source file:org.openmicroscopy.shoola.agents.util.ui.ScriptComponent.java

/** Builds and lays out the UI. */
void buildUI() {//from   ww  w  .ja  va  2  s.com
    int width = TAB * getTabulationLevel();
    if (DEFAULT_TEXT.equals(name))
        width = 0;
    if (CollectionUtils.isEmpty(children)) {
        double[][] size = { { width, TableLayout.PREFERRED, 5, TableLayout.FILL }, { TableLayout.PREFERRED } };
        setLayout(new TableLayout(size));
        add(Box.createHorizontalStrut(width), "0, 0");
        add(getLabel(), "1, 0");
        add(getComponent(), "3, 0");
    } else {
        //create a row.
        double[][] size = { { TableLayout.FILL }, { TableLayout.PREFERRED } };
        TableLayout layout = new TableLayout(size);
        setLayout(layout);
        Iterator<ScriptComponent> i = children.iterator();
        ScriptComponent child;
        setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
        add(createRow(), "0, 0");
        int index = 1;
        while (i.hasNext()) {
            child = i.next();
            child.buildUI();
            layout.insertRow(index, TableLayout.PREFERRED);
            add(child, "0, " + index);
            index++;
        }
    }
}

From source file:org.openmicroscopy.shoola.env.data.util.StatusLabel.java

/** Builds and lays out the UI.*/
private void buildUI() {
    labels = new ArrayList<JLabel>();
    setLayout(new FlowLayout(FlowLayout.LEFT));
    add(generalLabel);/* ww w . jav a 2 s  . c  om*/
    JLabel label = new JLabel("Upload");
    label.setVisible(false);
    labels.add(label);
    add(label);
    add(uploadBar);
    add(Box.createHorizontalStrut(5));
    label = new JLabel("Processing");
    label.setVisible(false);
    labels.add(label);
    add(label);
    add(processingBar);
    setOpaque(false);
}

From source file:org.openmicroscopy.shoola.env.ui.ActivityComponent.java

/**
 * Returns the tool bar.//  w  ww. ja  va  2s.c om
 * 
 * @return See above.
 */
private JComponent createToolBar() {
    toolBar = new JToolBar();
    toolBar.setOpaque(false);
    toolBar.setFloatable(false);
    toolBar.setBorder(null);
    buttonIndex = 0;
    toolBar.add(exceptionButton);
    toolBar.add(Box.createHorizontalStrut(5));
    buttonIndex = 2;
    toolBar.add(cancelButton);
    JLabel l = new JLabel();
    Font f = l.getFont();
    l.setForeground(UIUtilities.LIGHT_GREY.darker());
    l.setFont(f.deriveFont(f.getStyle(), f.getSize() - 2));
    String s = UIUtilities.formatShortDateTime(null);
    String[] values = s.split(" ");
    if (values.length > 1) {
        String v = values[1];
        if (values.length > 2)
            v += " " + values[2];
        l.setText(v);
        toolBar.add(Box.createHorizontalStrut(5));
        toolBar.add(l);
        toolBar.add(Box.createHorizontalStrut(5));
    }
    return toolBar;
}

From source file:org.openmicroscopy.shoola.util.ui.MessengerDialog.java

/**
 * Builds and lays out the buttons./*  w  ww  . ja va  2s  .  com*/
 * 
 * @param submit Pass <code>true</code> to display the submit files option,
 *              <code>false</code> otherwise.
 * @return See above.
 */
private JPanel buildToolBar(boolean submit) {
    JPanel bars = new JPanel();
    bars.setLayout(new BoxLayout(bars, BoxLayout.X_AXIS));
    if (submit) {
        JPanel row = new JPanel();
        row.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
        row.add(new JLabel("Submit Exceptions and: "));
        row.add(UIUtilities.buildComponentPanel(submitFile));
        JPanel p = new JPanel();
        p.setBorder(null);
        p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
        p.add(row);
        JPanel progressPane = new JPanel();
        progressPane.setLayout(new BoxLayout(progressPane, BoxLayout.X_AXIS));
        progressPane.add(progress);
        progressPane.add(Box.createHorizontalStrut(5));
        progressPane.add(progressLabel);
        p.add(UIUtilities.buildComponentPanel(progressPane));
        bars.add(UIUtilities.buildComponentPanel(p));
    }
    JPanel bar = new JPanel();
    bar.setLayout(new BoxLayout(bar, BoxLayout.X_AXIS));
    bar.add(cancelButton);
    bar.add(Box.createHorizontalStrut(5));
    bar.add(sendButton);
    bar.add(Box.createHorizontalStrut(10));
    bars.add(UIUtilities.buildComponentPanelRight(bar));
    return bars;
}

From source file:org.pentaho.reporting.engine.classic.extensions.drilldown.devtools.DrillDownProfileEditor.java

protected Component createContentPane() {
    drillDownProfiles = new DefaultListModel();
    profileList = new JList(drillDownProfiles);
    profileList.setCellRenderer(new DrillDownProfileListRenderer());

    final JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5));
    buttonPane.add(new JButton(new NewAction()));
    buttonPane.add(new JButton(new EditAction()));
    buttonPane.add(new JButton(new RemoveAction()));
    buttonPane.add(Box.createHorizontalStrut(10));
    buttonPane.add(new JButton(new LoadAction()));
    buttonPane.add(new JButton(new SaveAction()));

    final JPanel contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout());
    contentPane.add(buttonPane, BorderLayout.NORTH);
    contentPane.add(new JScrollPane(profileList), BorderLayout.CENTER);
    return contentPane;
}

From source file:org.pentaho.reporting.ui.datasources.mondrian.MondrianDataSourceEditor.java

private JPanel createConnectionTopPanel() {
    final JPanel masterPanel = new JPanel();
    masterPanel.setLayout(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;// w w  w.  j  a  v a 2s. c  o m
    gbc.gridy = 0;
    gbc.gridwidth = 4;
    gbc.anchor = GridBagConstraints.WEST;
    masterPanel.add(new JLabel(Messages.getString("MondrianDataSourceEditor.SchemaFileLabel")), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.gridwidth = 1;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1;
    masterPanel.add(filenameField, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.gridwidth = 1;
    gbc.anchor = GridBagConstraints.WEST;
    masterPanel.add(new JButton(new BrowseAction()), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = 1;
    gbc.gridwidth = 1;
    gbc.anchor = GridBagConstraints.WEST;
    masterPanel.add(Box.createHorizontalStrut(20), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 3;
    gbc.gridy = 1;
    gbc.gridwidth = 1;
    gbc.anchor = GridBagConstraints.WEST;
    masterPanel.add(new JButton(new EditSecurityAction()), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 2;
    gbc.gridwidth = 4;
    gbc.anchor = GridBagConstraints.WEST;
    masterPanel.add(new JLabel(Messages.getString("MondrianDataSourceEditor.CubeConnectionName")), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.gridwidth = 1;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 5;
    masterPanel.add(cubeConnectionNameField, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 3;
    gbc.gridwidth = 3;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    masterPanel.add(new JButton(new RefreshSchemaNameAction()), gbc);

    return masterPanel;
}

From source file:org.pentaho.ui.xul.swing.tags.SwingDialog.java

private void populateButtonPanel() {

    buttonPanel.removeAll();/* w w w  .ja  v a  2s . co  m*/
    if (this.buttonAlignment == BUTTON_ALIGN.RIGHT || this.buttonAlignment == BUTTON_ALIGN.END
            || this.buttonAlignment == BUTTON_ALIGN.MIDDLE || this.buttonAlignment == BUTTON_ALIGN.CENTER
            || this.buttonAlignment == null) {
        buttonPanel.add(Box.createHorizontalGlue());
    }

    ArrayList<BUTTONS> buttonKeyList = new ArrayList<BUTTONS>(buttons.keySet());
    for (int i = 0; i < buttonKeyList.size(); i++) {
        buttonPanel.add(Box.createHorizontalStrut(5));
        buttonPanel.add((JButton) this.buttons.get(buttonKeyList.get(i)).getManagedObject());
        this.addChild(this.buttons.get(buttonKeyList.get(i)));
    }

    buttonPanel.add(Box.createHorizontalStrut(5));

    if (this.buttonAlignment == BUTTON_ALIGN.START || this.buttonAlignment == BUTTON_ALIGN.LEFT
            || this.buttonAlignment == BUTTON_ALIGN.MIDDLE || this.buttonAlignment == BUTTON_ALIGN.CENTER) {
        buttonPanel.add(Box.createHorizontalGlue());
    }

    if (buttons.containsKey(SwingDialog.BUTTONS.ACCEPT)) {
        this.buttons.get(SwingDialog.BUTTONS.ACCEPT).setLabel(this.getButtonlabelaccept());
        this.buttons.get(SwingDialog.BUTTONS.ACCEPT).setOnclick(this.getOndialogaccept());
    }
    if (buttons.containsKey(SwingDialog.BUTTONS.CANCEL)) {
        this.buttons.get(SwingDialog.BUTTONS.CANCEL).setLabel(this.getButtonlabelcancel());
        this.buttons.get(SwingDialog.BUTTONS.CANCEL).setOnclick(this.getOndialogcancel());
    }

    // FIXME
    if (buttons.containsKey(SwingDialog.BUTTONS.EXTRA1)) {
        this.buttons.get(SwingDialog.BUTTONS.EXTRA1).setLabel(this.getButtonlabelextra1());
        this.buttons.get(SwingDialog.BUTTONS.EXTRA1).setOnclick(this.getOndialogextra1());
    }
    if (buttons.containsKey(SwingDialog.BUTTONS.EXTRA2)) {
        this.buttons.get(SwingDialog.BUTTONS.EXTRA2).setLabel(this.getButtonlabelextra2());
        this.buttons.get(SwingDialog.BUTTONS.EXTRA2).setOnclick(this.getOndialogextra2());
    }
}