Example usage for javax.swing BoxLayout Y_AXIS

List of usage examples for javax.swing BoxLayout Y_AXIS

Introduction

In this page you can find the example usage for javax.swing BoxLayout Y_AXIS.

Prototype

int Y_AXIS

To view the source code for javax.swing BoxLayout Y_AXIS.

Click Source Link

Document

Specifies that components should be laid out top to bottom.

Usage

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

/** Builds and lays out the UI. */
private void buildGUI() {
    Container container = getContentPane();
    container.setLayout(new BorderLayout(0, 0));

    IconManager icons = IconManager.getInstance();
    TitlePanel tp = new TitlePanel(TEXT_TITLE, "", TEXT_TITLE_DESCRIPTION,
            icons.getIcon(IconManager.IMPORT_48));
    JXPanel p = new JXPanel();
    JXPanel lp = new JXPanel();
    lp.setLayout(new FlowLayout(FlowLayout.LEFT));
    lp.add(messageLabel);/*from  www  .  ja  v  a  2 s.co m*/
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(tp);
    p.add(lp);
    p.setBackgroundPainter(tp.getBackgroundPainter());
    lp.setBackgroundPainter(tp.getBackgroundPainter());
    container.add(p, BorderLayout.NORTH);
    container.add(tabs, BorderLayout.CENTER);
    container.add(controlsBar, BorderLayout.SOUTH);
}

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

/**
 * Initializes the components.//  ww w  .j a va  2  s .  c o m
 * 
 * @param imageName   The name of the image.
 * @param type      The type of projection.
 * @param maxZ      The maximum number of z-sections.
 * @param startZ   The lower bound of the z-section interval.
 * @param endZ      The upper bound of the z-section interval.
 */
private void initComponents(String imageName, String type, int maxZ, int startZ, int endZ) {
    parentsBox = new JComboBox();

    parentsBoxListener = new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                DataNode node = (DataNode) parentsBox.getSelectedItem();
                if (!node.isDefaultNode() && !node.getDataObject().canLink()) {
                    selectedContainer = null;
                    parentsBox.setSelectedIndex(0);
                }
                populateDatasetsBox(null);
            }
        }
    };
    parentsBox.removeItemListener(parentsBoxListener);
    datasetsBox = new JComboBox();
    datasetsBoxListener = new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                DataNode node = (DataNode) datasetsBox.getSelectedItem();
                if (node != null) {
                    if (!node.isDefaultNode() && !node.getDataObject().canLink()) {
                        //Determine the first dataset that be picked.
                        datasetsBox.setSelectedIndex(0);
                        node = (DataNode) datasetsBox.getSelectedItem();
                        selectedDataset = (DatasetData) node.getDataObject();
                    } else
                        selectedDataset = (DatasetData) node.getDataObject();
                }
            }

        }
    };
    datasetsBox.removeItemListener(datasetsBoxListener);
    rndSettingsBox = new JCheckBox("Apply same rendering settings");
    rndSettingsBox.setToolTipText(
            UIUtilities.formatToolTipText("Apply the rendering settings to " + "the projected image."));
    rndSettingsBox.setSelected(true);

    zrangeSelection = new TextualTwoKnobsSlider(1, maxZ, startZ, endZ);
    zrangeSelection.layoutComponents(TextualTwoKnobsSlider.LAYOUT_FIELDS);

    timeSelection = new TextualTwoKnobsSlider(1, maxT, 1, maxT);
    timeSelection.layoutComponents(TextualTwoKnobsSlider.LAYOUT_FIELDS);
    timeSelection.setEnabled(maxT > 1);

    Map<String, String> map = EditorUtil.PIXELS_TYPE_DESCRIPTION;
    String[] data = new String[map.size()];
    Set set = map.entrySet();
    Entry entry;
    Iterator i = set.iterator();
    int index = 0;
    //String originalType = type;
    String key;
    int selectedIndex = 0;
    while (i.hasNext()) {
        entry = (Entry) i.next();
        key = (String) entry.getKey();
        data[index] = (String) entry.getValue();
        if (key.equals(type))
            selectedIndex = index;
        index++;
    }
    pixelsType = new JComboBox(data);
    pixelsType.setSelectedIndex(selectedIndex);
    pixelsType.setEnabled(algorithm == ProjectionParam.SUM_INTENSITY);

    selectionPane = new JPanel();
    selectionPane.setLayout(new BoxLayout(selectionPane, BoxLayout.Y_AXIS));

    closeButton = new JButton("Cancel");
    closeButton.setToolTipText(UIUtilities.formatToolTipText("Close the window."));
    closeButton.setActionCommand("" + CLOSE);
    closeButton.addActionListener(this);
    projectButton = new JButton("Save");
    projectButton.setToolTipText(UIUtilities.formatToolTipText("Project the image."));
    projectButton.setActionCommand("" + PROJECT);
    projectButton.addActionListener(this);
    newFolderButton = new JButton("New Dataset...");
    newFolderButton.setToolTipText(UIUtilities.formatToolTipText("Create a new Dataset."));
    newFolderButton.setActionCommand("" + NEWFOLDER);
    newFolderButton.addActionListener(this);
    nameField = new JTextField();

    StringBuffer buffer = new StringBuffer();
    buffer.append(UIUtilities.removeFileExtension(imageName));
    buffer.append(DEFAULT_EXTENSION);
    nameField.setText(buffer.toString());
    nameField.getDocument().addDocumentListener(this);
    //Display datasets
    getRootPane().setDefaultButton(projectButton);

    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            close();
        }
    });
}

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

/**
 * Builds the various panels used to set the parameters of the
 * projection./*  w  w w .ja  va 2s .  c  om*/
 * 
 * @return See above.
 */
private JPanel buildParametersPanel() {
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(buildRangePanel(zrangeSelection, "Z Range: "));
    p.add(buildRangePanel(timeSelection, "Timepoint: "));

    if (pixelsType != null) {
        p.add(new JSeparator());
        p.add(buildPixelsTypePanel());
    }

    JPanel r = UIUtilities.buildComponentPanel(p);
    r.setBorder(new TitledBorder(""));
    return r;
}

From source file:org.openmicroscopy.shoola.agents.measurement.view.GraphPane.java

/** Builds and lays out the UI. */
private void buildGUI() {
    buildHistogramNoSelection();/*from w w w .ja  va 2  s . co m*/
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    JPanel centrePanel = new JPanel();
    centrePanel.setLayout(new BoxLayout(centrePanel, BoxLayout.X_AXIS));

    centrePanel.add(zSlider);
    centrePanel.add(Box.createHorizontalStrut(5));
    centrePanel.add(mainPanel);
    centrePanel.add(export);
    add(centrePanel);
    add(tSlider);
}

From source file:org.openmicroscopy.shoola.agents.measurement.view.GraphPane.java

/**
 * The method builds the graphs from the data that was constructed in the
 * display analysis method. This method should be called from either the 
 * display analysis method or the changelistener which uses the same ROI 
 * data generated in the displayAnalysis method.
 *//*from  w w w  . j  av  a 2 s .  c om*/
private void buildGraphsAndDisplay() {
    coord = new Coord3D(zSlider.getValue() - 1, tSlider.getValue() - 1);
    Map<Integer, ROIShapeStatsSimple> data = pixelStats.get(coord);
    if (data == null)
        return;
    shape = shapeMap.get(coord);
    double[][] dataXY;
    Color c;
    int channel;
    List<double[]> channelData = new ArrayList<double[]>();
    List<double[][]> channelXYData = new ArrayList<double[][]>();
    channelName.clear();
    channelColour.clear();
    channelData.clear();

    ChannelData cData;
    List<ChannelData> metadata = model.getMetadata();
    Iterator<ChannelData> j = metadata.iterator();
    double[] values;
    Map<Integer, List<String>> locations = new HashMap<Integer, List<String>>();
    List<String> points = formatPoints(shape.getFigure().getPoints());
    while (j.hasNext()) {
        cData = j.next();
        channel = cData.getIndex();
        if (model.isChannelActive(channel)) {
            cData = model.getMetadata(channel);
            if (cData != null)
                channelName.add(cData.getChannelLabeling());
            c = model.getActiveChannelColor(channel);
            if (UIUtilities.isSameColors(c, Color.white, false))
                c = DEFAULT_COLOR;
            channelColour.add(c);
            values = data.get(channel).getValues();
            if (values != null && values.length != 0) {
                channelData.add(values);

                if (lineProfileFigure(shape)) {
                    locations.put(channel, points);
                    dataXY = new double[2][values.length];
                    for (int i = 0; i < values.length; i++) {
                        dataXY[0][i] = i;
                        dataXY[1][i] = values[i];
                    }
                    channelXYData.add(dataXY);
                }
            }
        }
    }
    mainPanel.removeAll();
    if (channelData.size() == 0) {
        buildHistogramNoSelection();
        return;
    }
    lineProfileChart = null;
    histogramChart = null;
    if (lineProfileFigure(shape))
        lineProfileChart = drawLineplot("Line Profile", channelName, channelXYData, channelColour, locations);
    histogramChart = drawHistogram("Histogram", channelName, channelData, channelColour, 1001);

    if (lineProfileChart == null && histogramChart != null) {
        mainPanel.setLayout(new BorderLayout());
        mainPanel.add(
                histogramChart.getChart(Collections.singletonList(
                        (AbstractAction) controller.getAction(MeasurementViewerControl.EXPORT_GRAPH))),
                BorderLayout.CENTER);
    }

    if (lineProfileChart != null && histogramChart != null) {
        mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
        mainPanel.add(lineProfileChart.getChart(Collections
                .singletonList((AbstractAction) controller.getAction(MeasurementViewerControl.EXPORT_GRAPH))));
        mainPanel.add(histogramChart.getChart(Collections
                .singletonList((AbstractAction) controller.getAction(MeasurementViewerControl.EXPORT_GRAPH))));
    }
    mainPanel.validate();
    mainPanel.repaint();
}

From source file:org.openmicroscopy.shoola.agents.measurement.view.IntensityView.java

/** Builds and lays out the UI. */
private void buildGUI() {
    JPanel scrollPanel = new JPanel();
    JPanel containerPanel = new JPanel();
    containerPanel.setLayout(new BoxLayout(containerPanel, BoxLayout.X_AXIS));
    JPanel tPanel = tablePanel();
    containerPanel.add(zSlider);//ww  w. ja  va 2s . com
    containerPanel.add(tPanel);
    JPanel cPanel = new JPanel();
    cPanel.setLayout(new BoxLayout(cPanel, BoxLayout.Y_AXIS));
    cPanel.add(containerPanel);
    cPanel.add(tSlider);
    JPanel buttonPanel = createButtonPanel();

    scrollPanel.setLayout(new BoxLayout(scrollPanel, BoxLayout.X_AXIS));
    scrollPanel.add(cPanel);
    scrollPanel.add(buttonPanel);
    scrollPanel.add(Box.createGlue());

    this.setLayout(new BorderLayout());
    this.add(scrollPanel, BorderLayout.CENTER);
    intensityDialog = new IntensityValuesDialog(view, tableModel, channelSelection);
}

From source file:org.openmicroscopy.shoola.agents.measurement.view.IntensityView.java

/**
 * Create the button panel to the right of the summary table.
 * @return see above.//  w ww. jav  a  2  s.co m
 */
private JPanel createButtonPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(Box.createRigidArea(new Dimension(0, 10)));
    panel.add(Box.createRigidArea(new Dimension(0, 10)));
    JPanel intensityPanel = UIUtilities.buildComponentPanel(showIntensityTable);
    UIUtilities.setDefaultSize(intensityPanel, new Dimension(175, 32));
    panel.add(intensityPanel);
    panel.add(Box.createRigidArea(new Dimension(0, 10)));
    JPanel savePanel = UIUtilities.buildComponentPanel(saveButton);
    UIUtilities.setDefaultSize(savePanel, new Dimension(175, 32));
    panel.add(savePanel);
    panel.add(Box.createVerticalGlue());
    return panel;
}

From source file:org.openmicroscopy.shoola.agents.measurement.view.IntensityView.java

/**
 * Create the table panel which holds all the intensities for the selected
 * channel in the table.//from  w  ww  . j  a va  2  s .com
 * @return See Above.
 */
private JPanel tablePanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    JScrollPane scrollPane = new JScrollPane(channelSummaryTable);
    scrollPane.setVerticalScrollBar(scrollPane.createVerticalScrollBar());
    scrollPane.setHorizontalScrollBar(scrollPane.createHorizontalScrollBar());
    panel.add(scrollPane);
    return panel;
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.AnnotationDataUI.java

/** Initializes the components composing the display. */
private void initComponents() {
    setLayout(new BorderLayout());
    setBackground(UIUtilities.BACKGROUND);
    setBorder(new SeparatorOneLineBorder());

    toReplace = new ArrayList<FileAnnotationData>();
    IconManager icons = IconManager.getInstance();
    filter = SHOW_ALL;//from   w  w  w.  j  av  a 2  s  .  c  o  m
    filterButton = new JButton(NAMES[SHOW_ALL]);
    filterButton.setToolTipText("Filter tags and attachments.");
    UIUtilities.unifiedButtonLookAndFeel(filterButton);
    Font font = filterButton.getFont();
    filterButton.setFont(font.deriveFont(font.getStyle(), font.getSize() - 2));

    filterButton.setIcon(icons.getIcon(IconManager.UP_DOWN_9_12));

    filterButton.setBackground(UIUtilities.BACKGROUND_COLOR);
    filterButton.addMouseListener(new MouseAdapter() {

        /** 
         * Brings up the menu. 
         * @see MouseListener#mouseReleased(MouseEvent)
         */
        public void mouseReleased(MouseEvent me) {
            Object source = me.getSource();
            if (source instanceof Component)
                displayMenu((Component) source, me.getPoint());
        }

    });

    otherRating = new JLabel();
    otherRating.setBackground(UIUtilities.BACKGROUND_COLOR);
    font = otherRating.getFont();
    otherRating.setFont(font.deriveFont(Font.ITALIC, font.getSize() - 2));
    content = new JPanel();
    content.setBackground(UIUtilities.BACKGROUND_COLOR);
    content.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    tagFlag = false;
    docFlag = false;
    otherFlag = false;
    tagNames = new ArrayList<String>();
    tagsDocList = new ArrayList<DocComponent>();
    filesDocList = new ArrayList<DocComponent>();
    otherList = new ArrayList<DocComponent>();
    existingTags = new HashMap<String, TagAnnotationData>();

    addTagsButton = new JButton(icons.getIcon(IconManager.PLUS_12));
    UIUtilities.unifiedButtonLookAndFeel(addTagsButton);
    addTagsButton.setBackground(UIUtilities.BACKGROUND_COLOR);
    addTagsButton.setToolTipText("Add Tags.");
    addTagsButton.addActionListener(controller);
    addTagsButton.setActionCommand("" + EditorControl.ADD_TAGS);
    addDocsButton = new JButton(icons.getIcon(IconManager.PLUS_12));
    addDocsButton.setBackground(UIUtilities.BACKGROUND_COLOR);
    addDocsButton.setToolTipText("Attach a document.");
    addDocsButton.addMouseListener(new MouseAdapter() {

        public void mouseReleased(MouseEvent e) {
            if (addDocsButton.isEnabled()) {
                Point p = e.getPoint();
                createDocSelectionMenu().show(addDocsButton, p.x, p.y);
            }
        }

    });
    UIUtilities.unifiedButtonLookAndFeel(addDocsButton);

    removeTagsButton = new JButton(icons.getIcon(IconManager.MINUS_12));
    UIUtilities.unifiedButtonLookAndFeel(removeTagsButton);
    removeTagsButton.setBackground(UIUtilities.BACKGROUND_COLOR);
    removeTagsButton.setToolTipText("Remove Tags.");
    removeTagsButton.addMouseListener(controller);
    removeTagsButton.setActionCommand("" + EditorControl.REMOVE_TAGS);

    removeDocsButton = new JButton(icons.getIcon(IconManager.MINUS_12));
    UIUtilities.unifiedButtonLookAndFeel(removeDocsButton);
    removeDocsButton.setBackground(UIUtilities.BACKGROUND_COLOR);
    removeDocsButton.setToolTipText("Remove Attachments.");
    removeDocsButton.addMouseListener(controller);
    removeDocsButton.setActionCommand("" + EditorControl.REMOVE_DOCS);

    removeOtherAnnotationsButton = new JButton(icons.getIcon(IconManager.MINUS_12));
    UIUtilities.unifiedButtonLookAndFeel(removeOtherAnnotationsButton);
    removeOtherAnnotationsButton.setBackground(UIUtilities.BACKGROUND_COLOR);
    removeOtherAnnotationsButton.setToolTipText("Remove Annotations.");
    removeOtherAnnotationsButton.addMouseListener(controller);
    removeOtherAnnotationsButton.setActionCommand("" + EditorControl.REMOVE_OTHER_ANNOTATIONS);

    selectedValue = 0;
    initialValue = selectedValue;
    rating = new RatingComponent(selectedValue, RatingComponent.MEDIUM_SIZE);
    rating.setOpaque(false);
    rating.setBackground(UIUtilities.BACKGROUND_COLOR);
    rating.addPropertyChangeListener(this);
    unrateButton = new JButton(icons.getIcon(IconManager.MINUS_12));
    UIUtilities.unifiedButtonLookAndFeel(unrateButton);
    unrateButton.setBackground(UIUtilities.BACKGROUND_COLOR);
    unrateButton.setToolTipText("Unrate.");
    unrateButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            rating.setValue(0);
            view.saveData(true);
        }
    });
    tagsPane = new JPanel();
    tagsPane.setLayout(new BoxLayout(tagsPane, BoxLayout.Y_AXIS));
    tagsPane.setBackground(UIUtilities.BACKGROUND_COLOR);
    DocComponent doc = new DocComponent(null, model);
    tagsDocList.add(doc);
    tagsPane.add(doc);
    docPane = new JPanel();
    docPane.setLayout(new BoxLayout(docPane, BoxLayout.Y_AXIS));
    docPane.setBackground(UIUtilities.BACKGROUND_COLOR);
    docRef = docPane;
    doc = new DocComponent(null, model);
    filesDocList.add(doc);
    docPane.add(doc);
    publishedBox = new JCheckBox();
    publishedBox.setBackground(UIUtilities.BACKGROUND_COLOR);
    publishedBox.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            firePropertyChange(EditorControl.SAVE_PROPERTY, Boolean.FALSE, Boolean.TRUE);
        }
    });

    mapsPane = new MapAnnotationsComponent(model, view);

    otherPane = new JPanel();
    otherPane.setLayout(new GridBagLayout());
    otherPane.setBackground(UIUtilities.BACKGROUND_COLOR);
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.GeneralPaneUI.java

/** Initializes the UI components. */
private void initComponents() {
    container = new JXTaskPaneContainer();
    container.setBackground(UIUtilities.BACKGROUND);
    if (container.getLayout() instanceof VerticalLayout) {
        VerticalLayout vl = (VerticalLayout) container.getLayout();
        vl.setGap(0);/*from   w w w  . j  av  a 2s.c  o  m*/
    }
    if (model.getBrowser() != null) {
        browserTaskPane = EditorUtil.createTaskPane(Browser.TITLE);
        browserTaskPane.add(model.getBrowser().getUI());
        browserTaskPane.addPropertyChangeListener(controller);
    }

    protocolTaskPane = EditorUtil.createTaskPane(PROTOCOL);

    propertiesUI = new PropertiesUI(model, controller);
    textualAnnotationsUI = new TextualAnnotationsUI(model, controller);
    annotationUI = new AnnotationDataUI(view, model, controller);

    components = new ArrayList<AnnotationUI>();
    components.add(propertiesUI);
    components.add(textualAnnotationsUI);
    components.add(annotationUI);
    Iterator<AnnotationUI> i = components.iterator();
    while (i.hasNext()) {
        i.next().addPropertyChangeListener(EditorControl.SAVE_PROPERTY, controller);
    }
    previews = new ArrayList<PreviewPanel>();
    propertiesTaskPane = EditorUtil.createTaskPane("");
    propertiesTaskPane.setCollapsed(false);
    propertiesTaskPane.add(propertiesUI);
    annotationTaskPane = EditorUtil.createTaskPane("Annotations");
    annotationTaskPane.setCollapsed(false);
    JPanel p = new JPanel();
    p.setBackground(UIUtilities.BACKGROUND_COLOR);
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(annotationUI);
    p.add(textualAnnotationsUI);
    annotationTaskPane.add(p);
}