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.isatools.isacreator.spreadsheet.Spreadsheet.java

/**
 * Create the FlatButton panel - a panel which contains graphical representations of the options available
 * to the user when interacting with the software.
 *//*from  w  ww.  jav a2s  .  c o m*/
private void createButtonPanel() {

    spreadsheetFunctionPanel = new JPanel();
    spreadsheetFunctionPanel.setLayout(new BoxLayout(spreadsheetFunctionPanel, BoxLayout.LINE_AXIS));
    spreadsheetFunctionPanel.setBackground(UIHelper.BG_COLOR);

    addRow = new JLabel(addRowButton);
    addRow.setToolTipText("<html><b>add row</b>" + "<p>add a new row to the table</p></html>");
    addRow.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent mouseEvent) {
            addRow.setIcon(addRowButton);
            showMultipleRowsGUI();
        }

        public void mouseEntered(MouseEvent mouseEvent) {
            addRow.setIcon(addRowButtonOver);
        }

        public void mouseExited(MouseEvent mouseEvent) {
            addRow.setIcon(addRowButton);
        }
    });

    deleteRow = new JLabel(deleteRowButton);
    deleteRow.setToolTipText("<html><b>remove row</b>" + "<p>remove selected row from table</p></html>");
    deleteRow.setEnabled(false);
    deleteRow.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent mouseEvent) {
            deleteRow.setIcon(deleteRowButton);
            if (table.getSelectedRow() != -1) {
                if (!(table.getSelectedRowCount() > 1)) {
                    spreadsheetFunctions.deleteRow(table.getSelectedRow());
                } else {
                    spreadsheetFunctions.deleteRow(table.getSelectedRows());
                }

            }
        }

        public void mouseEntered(MouseEvent mouseEvent) {
            deleteRow.setIcon(deleteRowButtonOver);
        }

        public void mouseExited(MouseEvent mouseEvent) {
            deleteRow.setIcon(deleteRowButton);
        }
    });

    deleteColumn = new JLabel(deleteColumnButton);
    deleteColumn
            .setToolTipText("<html><b>remove column</b>" + "<p>remove selected column from table</p></html>");
    deleteColumn.setEnabled(false);
    deleteColumn.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent mouseEvent) {
            deleteColumn.setIcon(deleteColumnButton);
            if (!(table.getSelectedColumns().length > 1)) {
                spreadsheetFunctions.deleteColumn(table.getSelectedColumn());
            } else {
                showColumnErrorMessage();
            }
        }

        public void mouseEntered(MouseEvent mouseEvent) {
            deleteColumn.setIcon(deleteColumnButtonOver);
        }

        public void mouseExited(MouseEvent mouseEvent) {
            deleteColumn.setIcon(deleteColumnButton);
        }
    });

    multipleSort = new JLabel(multipleSortButton);
    multipleSort.setToolTipText(
            "<html><b>multiple sort</b>" + "<p>perform a multiple sort on the table</p></html>");
    multipleSort.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent mouseEvent) {
            multipleSort.setIcon(multipleSortButton);
            showMultipleColumnSortGUI();
        }

        public void mouseEntered(MouseEvent mouseEvent) {
            multipleSort.setIcon(multipleSortButtonOver);
        }

        public void mouseExited(MouseEvent mouseEvent) {
            multipleSort.setIcon(multipleSortButton);
        }
    });

    copyColDown = new JLabel(copyColDownButton);
    copyColDown.setToolTipText("<html><b>copy column downwards</b>"
            + "<p>duplicate selected column and copy it from the current</p>"
            + "<p>position down to the final row in the table</p></html>");
    copyColDown.setEnabled(false);
    copyColDown.addMouseListener(new MouseAdapter() {

        public void mouseExited(MouseEvent mouseEvent) {
            copyColDown.setIcon(copyColDownButton);
        }

        public void mouseEntered(MouseEvent mouseEvent) {
            copyColDown.setIcon(copyColDownButtonOver);
        }

        public void mousePressed(MouseEvent mouseEvent) {
            copyColDown.setIcon(copyColDownButton);

            final int row = table.getSelectedRow();
            final int col = table.getSelectedColumn();

            if (row != -1 && col != -1) {
                JOptionPane copyColDownConfirmationPane = new JOptionPane(
                        "<html><b>Confirm Copy of Column...</b><p>Are you sure you wish to copy "
                                + "this column downwards?</p><p>This Action can not be undone!</p></html>",
                        JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION);

                copyColDownConfirmationPane.setIcon(copyColumnDownWarningIcon);
                UIHelper.applyOptionPaneBackground(copyColDownConfirmationPane, UIHelper.BG_COLOR);

                copyColDownConfirmationPane.addPropertyChangeListener(new PropertyChangeListener() {
                    public void propertyChange(PropertyChangeEvent event) {
                        if (event.getPropertyName().equals(JOptionPane.VALUE_PROPERTY)) {
                            int lastOptionAnswer = Integer.valueOf(event.getNewValue().toString());
                            parentFrame.hideSheet();
                            if (lastOptionAnswer == JOptionPane.YES_OPTION) {
                                spreadsheetFunctions.copyColumnDownwards(row, col);
                            }
                        }
                    }
                });
                parentFrame.showJDialogAsSheet(
                        copyColDownConfirmationPane.createDialog(Spreadsheet.this, "Copy Column?"));
            }
        }
    });

    copyRowDown = new JLabel(copyRowDownButton);
    copyRowDown.setToolTipText(
            "<html><b>copy row downwards</b>" + "<p>duplicate selected row and copy it from the current</p>"
                    + "<p>position down to the final row</p></html>");
    copyRowDown.setEnabled(false);
    copyRowDown.addMouseListener(new MouseAdapter() {

        public void mouseExited(MouseEvent mouseEvent) {
            copyRowDown.setIcon(copyRowDownButton);
        }

        public void mouseEntered(MouseEvent mouseEvent) {
            copyRowDown.setIcon(copyRowDownButtonOver);
        }

        public void mousePressed(MouseEvent mouseEvent) {
            copyRowDown.setIcon(copyRowDownButton);

            final int row = table.getSelectedRow();

            JOptionPane copyRowDownConfirmationPane = new JOptionPane(
                    "<html><b>Confirm Copy of Row...</b><p>Are you sure you wish to copy "
                            + "this row downwards?</p><p>This Action can not be undone!</p>",
                    JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION);

            copyRowDownConfirmationPane.setIcon(copyRowDownWarningIcon);

            UIHelper.applyOptionPaneBackground(copyRowDownConfirmationPane, UIHelper.BG_COLOR);

            copyRowDownConfirmationPane.addPropertyChangeListener(new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent event) {
                    if (event.getPropertyName().equals(JOptionPane.VALUE_PROPERTY)) {
                        int lastOptionAnswer = Integer.valueOf(event.getNewValue().toString());
                        parentFrame.hideSheet();
                        if (lastOptionAnswer == JOptionPane.YES_OPTION) {
                            spreadsheetFunctions.copyRowDownwards(row);
                        }
                    }
                }
            });
            parentFrame.showJDialogAsSheet(
                    copyRowDownConfirmationPane.createDialog(Spreadsheet.this, "Copy Row Down?"));
        }
    });

    addProtocol = new JLabel(addProtocolButton);
    addProtocol.setToolTipText(
            "<html><b>add a protocol column</b>" + "<p>Add a protocol column to the table</p></html>");
    addProtocol.addMouseListener(new MouseAdapter() {

        public void mouseEntered(MouseEvent mouseEvent) {
            addProtocol.setIcon(addProtocolButtonOver);
        }

        public void mouseExited(MouseEvent mouseEvent) {
            addProtocol.setIcon(addProtocolButton);
        }

        public void mousePressed(MouseEvent mouseEvent) {
            addProtocol.setIcon(addProtocolButton);
            if (addProtocol.isEnabled()) {
                FieldObject fo = new FieldObject(table.getColumnCount(), "Protocol REF",
                        "Protocol used for experiment", DataTypes.LIST, "", false, false, false);

                fo.setFieldList(studyDataEntryEnvironment.getProtocolNames());

                spreadsheetFunctions.addFieldToReferenceObject(fo);

                spreadsheetFunctions.addColumnAfterPosition("Protocol REF", null, fo.isRequired(), -1);
            }
        }
    });

    addFactor = new JLabel(addFactorButton);
    addFactor.setToolTipText(
            "<html><b>add a factor column</b>" + "<p>Add a factor column to the table</p></html>");
    addFactor.addMouseListener(new MouseAdapter() {
        public void mouseEntered(MouseEvent mouseEvent) {
            addFactor.setIcon(addFactorButtonOver);
        }

        public void mouseExited(MouseEvent mouseEvent) {
            addFactor.setIcon(addFactorButton);
        }

        public void mousePressed(MouseEvent mouseEvent) {
            addFactor.setIcon(addFactorButton);
            if (addFactor.isEnabled()) {
                showAddColumnsGUI(AddColumnGUI.ADD_FACTOR_COLUMN);
            }
        }
    });

    addCharacteristic = new JLabel(addCharacteristicButton);
    addCharacteristic.setToolTipText("<html><b>add a characteristic column</b>"
            + "<p>Add a characteristic column to the table</p></html>");
    addCharacteristic.addMouseListener(new MouseAdapter() {
        public void mouseEntered(MouseEvent mouseEvent) {
            addCharacteristic.setIcon(addCharacteristicButtonOver);
        }

        public void mouseExited(MouseEvent mouseEvent) {
            addCharacteristic.setIcon(addCharacteristicButton);
        }

        public void mousePressed(MouseEvent mouseEvent) {
            addCharacteristic.setIcon(addCharacteristicButton);
            if (addCharacteristic.isEnabled()) {
                showAddColumnsGUI(AddColumnGUI.ADD_CHARACTERISTIC_COLUMN);
            }
        }
    });

    addParameter = new JLabel(addParameterButton);
    addParameter.setToolTipText(
            "<html><b>add a parameter column</b>" + "<p>Add a parameter column to the table</p></html>");
    addParameter.addMouseListener(new MouseAdapter() {
        public void mouseEntered(MouseEvent mouseEvent) {
            addParameter.setIcon(addParameterButtonOver);
        }

        public void mouseExited(MouseEvent mouseEvent) {
            addParameter.setIcon(addParameterButton);
        }

        public void mousePressed(MouseEvent mouseEvent) {
            addParameter.setIcon(addParameterButton);
            if (addParameter.isEnabled()) {
                showAddColumnsGUI(AddColumnGUI.ADD_PARAMETER_COLUMN);
            }
        }
    });

    undo = new JLabel(undoButton);
    undo.setToolTipText("<html><b>undo previous action<b></html>");
    undo.setEnabled(undoManager.canUndo());
    undo.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent mouseEvent) {
            undo.setIcon(undoButton);
            undoManager.undo();

            if (highlightActive) {
                setRowsToDefaultColor();
            }
            table.addNotify();
        }

        public void mouseEntered(MouseEvent mouseEvent) {
            undo.setIcon(undoButtonOver);
        }

        public void mouseExited(MouseEvent mouseEvent) {
            undo.setIcon(undoButton);
        }
    });

    redo = new JLabel(redoButton);
    redo.setToolTipText("<html><b>redo action<b></html>");
    redo.setEnabled(undoManager.canRedo());
    redo.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent mouseEvent) {
            redo.setIcon(redoButton);
            undoManager.redo();

            if (highlightActive) {
                setRowsToDefaultColor();
            }
            table.addNotify();

        }

        public void mouseEntered(MouseEvent mouseEvent) {
            redo.setIcon(redoButtonOver);
        }

        public void mouseExited(MouseEvent mouseEvent) {
            redo.setIcon(redoButton);
        }
    });

    transpose = new JLabel(transposeIcon);
    transpose.setToolTipText("<html>View a transposed version of this spreadsheet</html>");
    transpose.addMouseListener(new MouseAdapter() {

        public void mouseExited(MouseEvent mouseEvent) {
            transpose.setIcon(transposeIcon);
        }

        public void mouseEntered(MouseEvent mouseEvent) {
            transpose.setIcon(transposeIconOver);
        }

        public void mousePressed(MouseEvent mouseEvent) {
            showTransposeSpreadsheetGUI();
        }
    });

    addButtons();

    if (studyDataEntryEnvironment != null) {
        JPanel labelContainer = new JPanel(new GridLayout(1, 1));
        labelContainer.setBackground(UIHelper.BG_COLOR);

        JLabel lab = UIHelper.createLabel(spreadsheetTitle, UIHelper.VER_10_PLAIN, UIHelper.DARK_GREEN_COLOR,
                JLabel.RIGHT);
        lab.setBackground(UIHelper.BG_COLOR);
        lab.setVerticalAlignment(JLabel.CENTER);
        lab.setPreferredSize(new Dimension(200, 30));

        labelContainer.add(lab);

        spreadsheetFunctionPanel.add(labelContainer);
        spreadsheetFunctionPanel.add(Box.createHorizontalStrut(10));
    }

    add(spreadsheetFunctionPanel, BorderLayout.NORTH);
}

From source file:org.isatools.isacreator.spreadsheet.Spreadsheet.java

/**
 * Helper method that adds a number of buttons to a panel.
 *
 * @param container             - Container to add the components to
 * @param addSpaceOnLastElement - do you wish to add a space after the last component? If false, there will be no padding added after the last component.
 * @param components            - Components to add. Added in the order they are passed in to the method.
 *//*from ww w  . j  ava2 s.co m*/
public void addComponentsToContainer(Container container, boolean addSpaceOnLastElement,
        JComponent... components) {
    int count = 0;
    for (Component component : components) {
        container.add(component);

        if (addSpaceOnLastElement || count != components.length - 1) {
            container.add(Box.createHorizontalStrut(5));
        }
        count++;
    }
}

From source file:org.jdal.swing.report.ReportFileView.java

@Override
protected JComponent buildPanel() {
    Box box = Box.createHorizontalBox();

    fileName.setEditable(false);/*  w w w.  jav a  2  s . c om*/

    box.add(new JLabel("Fichero"));
    box.add(fileName);
    box.add(Box.createHorizontalStrut(5));

    box.add(Box.createHorizontalStrut(5));
    box.add(new JButton(new FileAction()));

    return box;
}

From source file:org.nuclos.client.customcomp.resplan.ResPlanPanel.java

public ResPlanPanel(ResPlanController cntrl, CollectableResPlanModel model, DateTimeModel timeModel) {
    final SpringLocaleDelegate localeDelegate = SpringLocaleDelegate.getInstance();

    this.controller = cntrl;
    this.timeModel = timeModel;
    this.resPlanModel = model;
    setLayout(new BorderLayout());

    JToolBar tb = UIUtils.createNonFloatableToolBar();
    tb.setFloatable(false);/* w  ww .ja v  a2s . c  o  m*/
    tb.add(new AbstractAction(localeDelegate.getText("nuclos.resplan.action.refresh"),
            Icons.getInstance().getIconRefresh16()) {

        @Override
        public void actionPerformed(ActionEvent e) {
            controller.refresh();
        }
    });
    tb.add(exportAction);
    tb.addSeparator();

    this.timeHorizon = new Interval<Date>(model.getDefaultViewFrom(), model.getDefaultViewUntil());

    final LabeledComponentSupport support = new LabeledComponentSupport();
    startDateChooser = new DateChooser(support, timeHorizon.getStart());
    startDateChooser.setMinimumSize(startDateChooser.getPreferredSize());
    startDateChooser.setMaximumSize(startDateChooser.getPreferredSize());
    endDateChooser = new DateChooser(support, timeHorizon.getEnd());
    endDateChooser.setMinimumSize(endDateChooser.getPreferredSize());
    endDateChooser.setMaximumSize(endDateChooser.getPreferredSize());

    tb.add(new JLabel(localeDelegate.getText("nuclos.resplan.toolbar.from")));
    tb.add(startDateChooser);
    tb.add(Box.createHorizontalStrut(5));
    tb.add(new JLabel(localeDelegate.getText("nuclos.resplan.toolbar.until")));
    tb.add(endDateChooser);

    timeGranularityModel = new ListComboBoxModel<ResPlanController.TimeGranularity>(
            controller.getTimeGranularityOptions());
    tb.addSeparator();
    tb.add(new JLabel(localeDelegate.getText("nuclos.resplan.toolbar.granularity")));
    timeGranularityComboBox = new JComboBox(timeGranularityModel);
    tb.add(timeGranularityComboBox);
    timeGranularityComboBox
            .setMaximumSize(Orientation.VERTICAL.updateExtent(timeGranularityComboBox.getPreferredSize(), 20));

    tb.addSeparator();
    tb.add(new JLabel(localeDelegate.getText("nuclos.resplan.toolbar.resourceFilter")));
    searchFilterComboBox = new JComboBox();
    searchFilterComboBox.setRenderer(new SearchFilterListCellRenderer());
    refreshSearchFilter();
    tb.add(searchFilterComboBox);
    searchFilterComboBox
            .setMaximumSize(Orientation.VERTICAL.updateExtent(searchFilterComboBox.getPreferredSize(), 20));

    tb.add(Box.createGlue());

    infoButton = new JButton(infoAction);
    infoButton.setVisible(false);
    tb.add(infoButton);

    tb.add(Box.createHorizontalStrut(3));

    initJResPlan();

    ActionListener dateChooserListener = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            timeHorzionChanged();
        }
    };
    startDateChooser.addActionListener(dateChooserListener);
    endDateChooser.addActionListener(dateChooserListener);

    timeGranularityComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                Runnable runnable = createScrollToCurrentAreaRunnable();
                ResPlanController.TimeGranularity granularity = timeGranularityModel.getSelectedItem();
                resPlan.setTimeModel(granularity.getTimeModel());
                resPlan.getTimelineHeader().setCategoryModel(granularity.getHeaderCategories());
                SwingUtilities.invokeLater(runnable);
            }
        }
    });
    searchFilterComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                EntitySearchFilter filter = (EntitySearchFilter) searchFilterComboBox.getSelectedItem();
                if (filter instanceof NewCustomSearchFilter) {
                    runCustomSearch();
                    return;
                }
                setSearchCondition(filter.getSearchCondition());
            }
        }
    });

    scrollPane = new JScrollPane(resPlan);

    JButton corner = new JButton(switchOrientationAction);
    corner.setBorderPainted(false);
    scrollPane.setCorner(JScrollPane.LOWER_RIGHT_CORNER, corner);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    add(tb, BorderLayout.NORTH);
    add(scrollPane, BorderLayout.CENTER);

    resPlan.setTimeHorizon(this.timeHorizon);
    resPlan.invalidate();

    setFocusable(true);
    setFocusCycleRoot(true);
    getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("DELETE"), "delete");
    //getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("control F"), "find");
    getActionMap().put("delete", removeAction);
    //getActionMap().put("find", findAction);
    KeyBindingProvider.bindActionToComponent(KeyBindingProvider.ACTIVATE_SEARCH_PANEL_2, findAction, this);
}

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

/**
 * Builds and lays out the tool bar.//from   w w w .j a  v a 2  s .  c om
 * @return See above.
 */
private JPanel buildToolBarRight() {
    JPanel bar = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    bar.add(cancelImportButton);
    bar.add(Box.createHorizontalStrut(5));
    bar.add(importButton);
    bar.add(Box.createHorizontalStrut(10));
    return bar;
}

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

/**
 * Builds and lays out the tool bar./*from   w  ww.j  av a2  s.c o m*/
 * 
 * @return See above.
 */
private JPanel buildToolBarLeft() {
    JPanel bar = new JPanel(new FlowLayout(FlowLayout.LEFT));
    bar.add(closeButton);
    int plugin = ImporterAgent.runAsPlugin();
    if (!(plugin == LookupNames.IMAGE_J_IMPORT || plugin == LookupNames.IMAGE_J)) {
        bar.add(Box.createHorizontalStrut(5));
        bar.add(refreshFilesButton);
    }

    return bar;
}

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

/**
 * Builds and lays out the components displaying the naming options.
 * /*  ww  w  . ja va  2s .c o m*/
 * @return See above.
 */
private JComponent buildNamingComponent() {
    JPanel content = new JPanel();
    content.setBorder(BorderFactory.createTitledBorder("File Naming"));

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(fullName);
    panel.add(partialName);
    JPanel pp = new JPanel();
    pp.setLayout(new BoxLayout(pp, BoxLayout.Y_AXIS));
    pp.add(UIUtilities.buildComponentPanel(panel));
    pp.add(buildPathComponent());
    GridBagConstraints c = new GridBagConstraints();
    content.setLayout(new GridBagLayout());
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0.0;
    c.gridwidth = 2;
    c.gridx = 0;
    c.gridy = 0;
    content.add(overrideName, c);
    c.gridwidth = 1;
    c.gridy++;
    content.add(Box.createHorizontalStrut(15), c);
    c.gridx++;
    content.add(pp, c);

    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(content);
    p.add(buildAnnotationComponent());
    return UIUtilities.buildComponentPanel(p);
}

From source file:org.openmicroscopy.shoola.agents.fsimporter.util.FileImportComponent.java

/** Initializes the components. */
private void initComponents() {
    actionMenuButton = new JButton();
    actionMenuButton.setVisible(false);//from  ww w.j a  v  a  2 s.co  m
    actionMenuButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
            JPopupMenu popup = createActionMenu();
            popup.show(actionMenuButton, 0, actionMenuButton.getHeight());
        }
    });

    adapter = new MouseAdapter() {

        /**
         * Views the image.
         * @see MouseListener#mousePressed(MouseEvent)
         */
        public void mousePressed(MouseEvent e) {
            if (e.getClickCount() == 1) {
                launchFullViewer();
            }
        }
    };

    setLayout(new FlowLayout(FlowLayout.LEFT));
    busyLabel = new JXBusyLabel(SIZE);
    busyLabel.setVisible(false);
    busyLabel.setBusy(false);

    cancelButton = new JButton("Cancel");
    cancelButton.setForeground(UIUtilities.HYPERLINK_COLOR);
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
            cancelLoading();
        }
    });
    cancelButton.setVisible(true);

    namePane = new JPanel();
    namePane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
    IconManager icons = IconManager.getInstance();
    Icon icon;
    if (getFile().isFile())
        icon = icons.getIcon(IconManager.IMAGE);
    else
        icon = icons.getIcon(IconManager.DIRECTORY);
    imageLabel = new ThumbnailLabel(icon);
    imageLabel.addPropertyChangeListener(this);
    imageLabels = new ArrayList<ThumbnailLabel>();
    ThumbnailLabel label;
    for (int i = 0; i < MAX_THUMBNAILS; i++) {
        label = new ThumbnailLabel();
        if (i == MAX_THUMBNAILS - 1) {
            Font f = label.getFont();
            label.setFont(f.deriveFont(f.getStyle(), f.getSize() - 2));
        }
        label.setVisible(false);
        label.addPropertyChangeListener(this);
        imageLabels.add(label);
    }
    fileNameLabel = new JLabel(getFile().getName());
    namePane.add(imageLabel);
    Iterator<ThumbnailLabel> j = imageLabels.iterator();
    while (j.hasNext()) {
        namePane.add(j.next());
    }
    namePane.add(Box.createHorizontalStrut(4));
    namePane.add(fileNameLabel);
    namePane.add(Box.createHorizontalStrut(10));
    resultLabel = new JLabel();
    statusLabel = new StatusLabel(importable.getFile());
    statusLabel.addPropertyChangeListener(this);
    image = null;
    refButton = cancelButton;
    refLabel = busyLabel;
}

From source file:org.openmicroscopy.shoola.agents.fsimporter.view.ImporterUI.java

/**
 * Builds and lays out the controls./*from ww w.j  ava 2s  .c  o m*/
 * 
 * @return See above.
 */
private JPanel buildControls() {
    JPanel p = new JPanel();
    p.add(new JButton(controller.getAction(ImporterControl.RETRY_BUTTON)));
    p.add(Box.createHorizontalStrut(5));
    p.add(new JButton(controller.getAction(ImporterControl.SEND_BUTTON)));
    p.add(Box.createHorizontalStrut(5));
    p.add(new JButton(controller.getAction(ImporterControl.CANCEL_BUTTON)));
    p.add(Box.createHorizontalStrut(5));
    if (!model.isMaster()) {
        p.add(new JButton(controller.getAction(ImporterControl.CLOSE_BUTTON)));
    }
    return UIUtilities.buildComponentPanelRight(p);
}

From source file:org.openmicroscopy.shoola.agents.imviewer.util.proj.ProjSavingDialog.java

/**
 * Builds the controls.//from   w  w  w .ja va2s .c om
 * 
 * @return See above.
 */
private JPanel buildControls() {
    JPanel p = new JPanel();
    p.setBorder(new TitledBorder(""));
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    p.add(selectionPane);
    p.add(Box.createHorizontalStrut(5));
    p.add(newFolderButton);
    return p;
}