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.apache.jmeter.visualizers.CreateReport.java

/**
 * Main visualizer setup.//from w w  w  .j  a v  a2 s.c o m
 */
private void init() {
    this.setLayout(new BorderLayout());

    // MAIN PANEL
    JPanel mainPanel = new JPanel();

    Border margin = new EmptyBorder(10, 10, 5, 10);

    mainPanel.setBorder(margin);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));

    mainPanel.add(makeTitlePanel());
    mainPanel.add(createSavePanel());
    myJTable = new JTable(model);
    myJTable.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer());
    myJTable.setPreferredScrollableViewportSize(new Dimension(500, 70));
    RendererUtils.applyRenderers(myJTable, RENDERERS);
    myScrollPane = new JScrollPane(myJTable);
    this.add(mainPanel, BorderLayout.NORTH);
    this.add(myScrollPane, BorderLayout.CENTER);
    saveTable.addActionListener(this);
    JPanel opts = new JPanel();
    opts.add(useGroupName, BorderLayout.WEST);
    opts.add(saveTable, BorderLayout.CENTER);
    opts.add(saveHeaders, BorderLayout.EAST);
    this.add(opts, BorderLayout.SOUTH);
}

From source file:net.sf.vfsjfilechooser.plaf.metal.MetalVFSFileChooserUI.java

@SuppressWarnings("serial")
@Override/*  w ww .ja  v a  2 s .co  m*/
public void installComponents(VFSJFileChooser fc) {
    AbstractVFSFileSystemView fsv = fc.getFileSystemView();

    fc.setBorder(new EmptyBorder(12, 12, 11, 11));
    fc.setLayout(new BorderLayout(0, 11));

    filePane = new VFSFilePane(new MetalVFSFileChooserUIAccessor());
    fc.addPropertyChangeListener(filePane);

    updateUseShellFolder();

    // ********************************* //
    // **** Construct the top panel **** //
    // ********************************* //

    // Directory manipulation buttons
    JPanel topPanel = new JPanel(new BorderLayout(11, 0));
    topButtonPanel = new JPanel();
    topButtonPanel.setLayout(new BoxLayout(topButtonPanel, BoxLayout.LINE_AXIS));
    topPanel.add(topButtonPanel, BorderLayout.AFTER_LINE_ENDS);

    // Add the top panel to the fileChooser
    fc.add(topPanel, BorderLayout.NORTH);

    // ComboBox Label
    lookInLabel = new JLabel(lookInLabelText);
    topPanel.add(lookInLabel, BorderLayout.BEFORE_LINE_BEGINS);

    // CurrentDir ComboBox
    directoryComboBox = new JComboBox() {
        @Override
        public Dimension getPreferredSize() {
            Dimension d = super.getPreferredSize();
            // Must be small enough to not affect total width.
            d.width = 150;

            return d;
        }
    };
    directoryComboBox.putClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY, lookInLabelText);
    directoryComboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    lookInLabel.setLabelFor(directoryComboBox);
    directoryComboBoxModel = createDirectoryComboBoxModel(fc);
    directoryComboBox.setModel(directoryComboBoxModel);
    directoryComboBox.addActionListener(directoryComboBoxAction);
    directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc));
    directoryComboBox.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    directoryComboBox.setAlignmentY(JComponent.TOP_ALIGNMENT);
    directoryComboBox.setMaximumRowCount(8);

    topPanel.add(directoryComboBox, BorderLayout.CENTER);

    // Up Button
    upFolderButton = new JButton(getChangeToParentDirectoryAction());
    upFolderButton.setText(null);
    upFolderButton.setIcon(upFolderIcon);
    upFolderButton.setToolTipText(upFolderToolTipText);
    upFolderButton.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, upFolderAccessibleName);
    upFolderButton.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    upFolderButton.setAlignmentY(JComponent.CENTER_ALIGNMENT);
    upFolderButton.setMargin(shrinkwrap);

    topButtonPanel.add(upFolderButton);
    topButtonPanel.add(Box.createRigidArea(hstrut5));

    // Home Button
    FileObject homeDir = fsv.getHomeDirectory();
    String toolTipText = homeFolderToolTipText;

    if (fsv.isRoot(homeDir)) {
        toolTipText = getFileView(fc).getName(homeDir); // Probably "Desktop".
    }

    JButton b = new JButton(homeFolderIcon);
    b.setToolTipText(toolTipText);
    b.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, homeFolderAccessibleName);
    b.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    b.setAlignmentY(JComponent.CENTER_ALIGNMENT);
    b.setMargin(shrinkwrap);

    b.addActionListener(getGoHomeAction());
    topButtonPanel.add(b);
    topButtonPanel.add(Box.createRigidArea(hstrut5));

    // New Directory Button
    if (!UIManager.getBoolean("FileChooser.readOnly")) {
        b = new JButton(filePane.getNewFolderAction());
        b.setText(null);
        b.setIcon(newFolderIcon);
        b.setToolTipText(newFolderToolTipText);
        b.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, newFolderAccessibleName);
        b.setAlignmentX(JComponent.LEFT_ALIGNMENT);
        b.setAlignmentY(JComponent.CENTER_ALIGNMENT);
        b.setMargin(shrinkwrap);
    }

    topButtonPanel.add(b);
    topButtonPanel.add(Box.createRigidArea(hstrut5));

    // View button group
    ButtonGroup viewButtonGroup = new ButtonGroup();

    // List Button
    listViewButton = new JToggleButton(listViewIcon);
    listViewButton.setToolTipText(listViewButtonToolTipText);
    listViewButton.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, listViewButtonAccessibleName);
    listViewButton.setSelected(true);
    listViewButton.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    listViewButton.setAlignmentY(JComponent.CENTER_ALIGNMENT);
    listViewButton.setMargin(shrinkwrap);
    listViewButton.addActionListener(filePane.getViewTypeAction(VFSFilePane.VIEWTYPE_LIST));
    topButtonPanel.add(listViewButton);
    viewButtonGroup.add(listViewButton);

    // Details Button
    detailsViewButton = new JToggleButton(detailsViewIcon);
    detailsViewButton.setToolTipText(detailsViewButtonToolTipText);
    detailsViewButton.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY,
            detailsViewButtonAccessibleName);
    detailsViewButton.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    detailsViewButton.setAlignmentY(JComponent.CENTER_ALIGNMENT);
    detailsViewButton.setMargin(shrinkwrap);
    detailsViewButton.addActionListener(filePane.getViewTypeAction(VFSFilePane.VIEWTYPE_DETAILS));
    topButtonPanel.add(detailsViewButton);
    viewButtonGroup.add(detailsViewButton);
    filePane.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            if ("viewType".equals(e.getPropertyName())) {
                final int viewType = filePane.getViewType();

                if (viewType == VFSFilePane.VIEWTYPE_LIST) {
                    listViewButton.setSelected(true);
                } else if (viewType == VFSFilePane.VIEWTYPE_DETAILS) {
                    detailsViewButton.setSelected(true);
                }
            }
        }
    });

    // ************************************** //
    // ******* Add the directory pane ******* //
    // ************************************** //
    fc.add(getAccessoryPanel(), BorderLayout.AFTER_LINE_ENDS);

    JComponent accessory = fc.getAccessory();

    if (accessory != null) {
        getAccessoryPanel().add(accessory);
    }

    filePane.setPreferredSize(LIST_PREF_SIZE);
    fc.add(filePane, BorderLayout.CENTER);

    // ********************************** //
    // **** Construct the bottom panel ** //
    // ********************************** //
    bottomPanel = getBottomPanel();
    bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.Y_AXIS));
    fc.add(bottomPanel, BorderLayout.SOUTH);

    // FileName label and textfield
    JPanel fileNamePanel = new JPanel();
    fileNamePanel.setLayout(new BoxLayout(fileNamePanel, BoxLayout.LINE_AXIS));
    bottomPanel.add(fileNamePanel);
    bottomPanel.add(Box.createRigidArea(vstrut5));

    fileNameLabel = new AlignedLabel();
    populateFileNameLabel();
    fileNamePanel.add(fileNameLabel);

    fileNameTextField = new JTextField(35) {
        @Override
        public Dimension getMaximumSize() {
            return new Dimension(Short.MAX_VALUE, super.getPreferredSize().height);
        }
    };

    PopupHandler.installDefaultMouseListener(fileNameTextField);

    fileNamePanel.add(fileNameTextField);
    fileNameLabel.setLabelFor(fileNameTextField);
    fileNameTextField.addFocusListener(new FocusAdapter() {
        @Override
        public void focusGained(FocusEvent e) {
            if (!getFileChooser().isMultiSelectionEnabled()) {
                filePane.clearSelection();
            }
        }
    });

    if (fc.isMultiSelectionEnabled()) {
        setFileName(fileNameString(fc.getSelectedFiles()));
    } else {
        setFileName(fileNameString(fc.getSelectedFile()));
    }

    // Filetype label and combobox
    JPanel filesOfTypePanel = new JPanel();
    filesOfTypePanel.setLayout(new BoxLayout(filesOfTypePanel, BoxLayout.LINE_AXIS));
    bottomPanel.add(filesOfTypePanel);

    AlignedLabel filesOfTypeLabel = new AlignedLabel(filesOfTypeLabelText);
    filesOfTypePanel.add(filesOfTypeLabel);

    filterComboBoxModel = createFilterComboBoxModel();
    fc.addPropertyChangeListener(filterComboBoxModel);
    filterComboBox = new JComboBox(filterComboBoxModel);
    filterComboBox.putClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY, filesOfTypeLabelText);
    filesOfTypeLabel.setLabelFor(filterComboBox);
    filterComboBox.setRenderer(createFilterComboBoxRenderer());
    filesOfTypePanel.add(filterComboBox);

    // buttons
    getButtonPanel().setLayout(new ButtonAreaLayout());

    approveButton = new JButton(getApproveButtonText(fc));
    // Note: Metal does not use mnemonics for approve and cancel
    approveButton.addActionListener(getApproveSelectionAction());
    fileNameTextField.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                getApproveSelectionAction().actionPerformed(null);
            }
        }
    });
    approveButton.setToolTipText(getApproveButtonToolTipText(fc));
    getButtonPanel().add(approveButton);

    cancelButton = new JButton(cancelButtonText);
    cancelButton.setToolTipText(cancelButtonToolTipText);
    cancelButton.addActionListener(getCancelSelectionAction());
    getButtonPanel().add(cancelButton);

    if (fc.getControlButtonsAreShown()) {
        addControlButtons();
    }

    groupLabels(new AlignedLabel[] { fileNameLabel, filesOfTypeLabel });
}

From source file:edu.ucla.stat.SOCR.chart.demo.DotChart.java

protected void setMixPanel() {
    dataPanel2.removeAll();/*from  w ww .j  av a  2s .  co m*/
    graphPanel2.removeAll();

    graphPanel2.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3));
    graphPanel2.setLayout(new BoxLayout(graphPanel2, BoxLayout.Y_AXIS));
    if (chartPanel1 != null)
        graphPanel2.add(chartPanel1);
    if (chartPanel2 != null)
        graphPanel2.add(chartPanel2);
    graphPanel2.validate();

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Data"));
    JScrollPane dt = new JScrollPane(dataTable);
    dt.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y * 3 / 8));

    dataPanel2.add(dt);
    JScrollPane st = new JScrollPane(summaryPanel);
    st.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 6));
    dataPanel2.add(st);
    st.validate();

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Mapping"));
    mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 2));
    dataPanel2.add(mapPanel);

    dataPanel2.validate();

    mixPanel.removeAll();
    mixPanel.add(graphPanel2, BorderLayout.WEST);
    mixPanel.add(new JScrollPane(dataPanel2), BorderLayout.CENTER);
    mixPanel.validate();
}

From source file:com.googlecode.vfsjfilechooser2.plaf.metal.MetalVFSFileChooserUI.java

@SuppressWarnings("serial")
@Override//from  w  w  w . j  a  v  a 2s .  c o  m
public void installComponents(VFSJFileChooser fc) {
    AbstractVFSFileSystemView fsv = fc.getFileSystemView();

    fc.setBorder(new EmptyBorder(12, 12, 11, 11));
    fc.setLayout(new BorderLayout(0, 11));

    filePane = new VFSFilePane(new MetalVFSFileChooserUIAccessor());
    fc.addPropertyChangeListener(filePane);

    updateUseShellFolder();

    // ********************************* //
    // **** Construct the top panel **** //
    // ********************************* //

    // Directory manipulation buttons
    JPanel topPanel = new JPanel(new BorderLayout(11, 0));
    topButtonPanel = new JPanel();
    topButtonPanel.setLayout(new BoxLayout(topButtonPanel, BoxLayout.LINE_AXIS));
    topPanel.add(topButtonPanel, BorderLayout.AFTER_LINE_ENDS);

    // Add the top panel to the fileChooser
    fc.add(topPanel, BorderLayout.NORTH);

    // ComboBox Label
    lookInLabel = new JLabel(lookInLabelText);
    topPanel.add(lookInLabel, BorderLayout.BEFORE_LINE_BEGINS);

    // CurrentDir ComboBox
    directoryComboBox = new JComboBox() {
        @Override
        public Dimension getPreferredSize() {
            Dimension d = super.getPreferredSize();
            // Must be small enough to not affect total width.
            d.width = 150;

            return d;
        }
    };
    directoryComboBox.putClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY, lookInLabelText);
    directoryComboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    lookInLabel.setLabelFor(directoryComboBox);
    directoryComboBoxModel = createDirectoryComboBoxModel(fc);
    directoryComboBox.setModel(directoryComboBoxModel);
    directoryComboBox.addActionListener(directoryComboBoxAction);
    directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc));
    directoryComboBox.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    directoryComboBox.setAlignmentY(JComponent.TOP_ALIGNMENT);
    directoryComboBox.setMaximumRowCount(8);

    topPanel.add(directoryComboBox, BorderLayout.CENTER);

    // Up Button
    upFolderButton = new JButton(getChangeToParentDirectoryAction());
    upFolderButton.setText(null);
    upFolderButton.setIcon(upFolderIcon);
    upFolderButton.setToolTipText(upFolderToolTipText);
    upFolderButton.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, upFolderAccessibleName);
    upFolderButton.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    upFolderButton.setAlignmentY(JComponent.CENTER_ALIGNMENT);
    upFolderButton.setMargin(shrinkwrap);

    topButtonPanel.add(upFolderButton);
    topButtonPanel.add(Box.createRigidArea(hstrut5));

    // Home Button
    FileObject homeDir = fsv.getHomeDirectory();
    String toolTipText = homeFolderToolTipText;

    if (fsv.isRoot(homeDir)) {
        toolTipText = getFileView(fc).getName(homeDir); // Probably "Desktop".
    }

    JButton b = new JButton(homeFolderIcon);
    b.setToolTipText(toolTipText);
    b.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, homeFolderAccessibleName);
    b.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    b.setAlignmentY(JComponent.CENTER_ALIGNMENT);
    b.setMargin(shrinkwrap);

    b.addActionListener(getGoHomeAction());
    topButtonPanel.add(b);
    topButtonPanel.add(Box.createRigidArea(hstrut5));

    // New Directory Button
    if (!UIManager.getBoolean("FileChooser.readOnly")) {
        b = new JButton(filePane.getNewFolderAction());
        b.setText(null);
        b.setIcon(newFolderIcon);
        b.setToolTipText(newFolderToolTipText);
        b.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, newFolderAccessibleName);
        b.setAlignmentX(JComponent.LEFT_ALIGNMENT);
        b.setAlignmentY(JComponent.CENTER_ALIGNMENT);
        b.setMargin(shrinkwrap);
    }

    topButtonPanel.add(b);
    topButtonPanel.add(Box.createRigidArea(hstrut5));

    // View button group
    ButtonGroup viewButtonGroup = new ButtonGroup();

    // List Button
    listViewButton = new JToggleButton(listViewIcon);
    listViewButton.setToolTipText(listViewButtonToolTipText);
    listViewButton.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, listViewButtonAccessibleName);
    listViewButton.setSelected(true);
    listViewButton.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    listViewButton.setAlignmentY(JComponent.CENTER_ALIGNMENT);
    listViewButton.setMargin(shrinkwrap);
    listViewButton.addActionListener(filePane.getViewTypeAction(VFSFilePane.VIEWTYPE_LIST));
    topButtonPanel.add(listViewButton);
    viewButtonGroup.add(listViewButton);

    // Details Button
    detailsViewButton = new JToggleButton(detailsViewIcon);
    detailsViewButton.setToolTipText(detailsViewButtonToolTipText);
    detailsViewButton.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY,
            detailsViewButtonAccessibleName);
    detailsViewButton.setAlignmentX(JComponent.LEFT_ALIGNMENT);
    detailsViewButton.setAlignmentY(JComponent.CENTER_ALIGNMENT);
    detailsViewButton.setMargin(shrinkwrap);
    detailsViewButton.addActionListener(filePane.getViewTypeAction(VFSFilePane.VIEWTYPE_DETAILS));
    topButtonPanel.add(detailsViewButton);
    viewButtonGroup.add(detailsViewButton);
    filePane.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            if ("viewType".equals(e.getPropertyName())) {
                final int viewType = filePane.getViewType();

                if (viewType == VFSFilePane.VIEWTYPE_LIST) {
                    listViewButton.setSelected(true);
                } else if (viewType == VFSFilePane.VIEWTYPE_DETAILS) {
                    detailsViewButton.setSelected(true);
                }
            }
        }
    });

    // ************************************** //
    // ******* Add the directory pane ******* //
    // ************************************** //
    fc.add(getAccessoryPanel(), BorderLayout.AFTER_LINE_ENDS);

    JComponent accessory = fc.getAccessory();

    if (accessory != null) {
        getAccessoryPanel().add(accessory);
    }

    filePane.setPreferredSize(LIST_PREF_SIZE);
    fc.add(filePane, BorderLayout.CENTER);

    // ********************************** //
    // **** Construct the bottom panel ** //
    // ********************************** //
    bottomPanel = getBottomPanel();
    bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.Y_AXIS));
    fc.add(bottomPanel, BorderLayout.SOUTH);

    // FileName label and textfield
    JPanel fileNamePanel = new JPanel();
    fileNamePanel.setLayout(new BoxLayout(fileNamePanel, BoxLayout.LINE_AXIS));
    bottomPanel.add(fileNamePanel);
    bottomPanel.add(Box.createRigidArea(vstrut5));

    fileNameLabel = new AlignedLabel();
    populateFileNameLabel();
    fileNamePanel.add(fileNameLabel);

    fileNameTextField = new JTextField(35) {
        @Override
        public Dimension getMaximumSize() {
            return new Dimension(Short.MAX_VALUE, super.getPreferredSize().height);
        }
    };

    PopupHandler.installDefaultMouseListener(fileNameTextField);

    fileNamePanel.add(fileNameTextField);
    fileNameLabel.setLabelFor(fileNameTextField);
    fileNameTextField.addFocusListener(new FocusAdapter() {
        @Override
        public void focusGained(FocusEvent e) {
            if (!getFileChooser().isMultiSelectionEnabled()) {
                filePane.clearSelection();
            }
        }
    });

    if (fc.isMultiSelectionEnabled()) {
        setFileName(fileNameString(fc.getSelectedFileObjects()));
    } else {
        setFileName(fileNameString(fc.getSelectedFileObject()));
    }

    // Filetype label and combobox
    JPanel filesOfTypePanel = new JPanel();
    filesOfTypePanel.setLayout(new BoxLayout(filesOfTypePanel, BoxLayout.LINE_AXIS));
    bottomPanel.add(filesOfTypePanel);

    AlignedLabel filesOfTypeLabel = new AlignedLabel(filesOfTypeLabelText);
    filesOfTypePanel.add(filesOfTypeLabel);

    filterComboBoxModel = createFilterComboBoxModel();
    fc.addPropertyChangeListener(filterComboBoxModel);
    filterComboBox = new JComboBox(filterComboBoxModel);
    filterComboBox.putClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY, filesOfTypeLabelText);
    filesOfTypeLabel.setLabelFor(filterComboBox);
    filterComboBox.setRenderer(createFilterComboBoxRenderer());
    filesOfTypePanel.add(filterComboBox);

    // buttons
    getButtonPanel().setLayout(new ButtonAreaLayout());

    approveButton = new JButton(getApproveButtonText(fc));
    // Note: Metal does not use mnemonics for approve and cancel
    approveButton.addActionListener(getApproveSelectionAction());
    fileNameTextField.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                getApproveSelectionAction().actionPerformed(null);
            } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                getFileChooser().cancelSelection();
            }
        }
    });
    approveButton.setToolTipText(getApproveButtonToolTipText(fc));
    getButtonPanel().add(approveButton);

    cancelButton = new JButton(cancelButtonText);
    cancelButton.setToolTipText(cancelButtonToolTipText);
    cancelButton.addActionListener(getCancelSelectionAction());
    getButtonPanel().add(cancelButton);

    if (fc.getControlButtonsAreShown()) {
        addControlButtons();
    }

    groupLabels(new AlignedLabel[] { fileNameLabel, filesOfTypeLabel });
}

From source file:medsavant.uhn.cancer.UserCommentApp.java

private JPanel getNoCommentsPanel() {
    JPanel innerPanel = new JPanel();
    innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));
    innerPanel.add(Box.createVerticalGlue());
    innerPanel.add(new JLabel("No Comments"));
    innerPanel.add(Box.createVerticalGlue());
    return innerPanel;
}

From source file:net.sf.profiler4j.console.ProjectDialog.java

/**
 * This method initializes exportPanel, which shows the options
 * to enable the automatic export of the call graph to an imagefile.
 * /*from  w ww  .j av a 2 s. c o m*/
 * @return javax.swing.JPanel
 */
private JPanel getExportPanel() {
    if (exportPanel == null) {
        exportPanel = new JPanel();
        exportPanel.setLayout(new BoxLayout(exportPanel, BoxLayout.Y_AXIS));
        exportPanel.setBounds(new java.awt.Rectangle(7, 390, 691, 101));
        exportPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Automatic Export",
                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
                javax.swing.border.TitledBorder.DEFAULT_POSITION,
                new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11), new java.awt.Color(0, 70, 213)));
        exportPanel.add(getExportActivationPanel());
        exportPanel.add(getExportPatternPanel());
    }
    return exportPanel;
}

From source file:com.enderville.enderinstaller.ui.Installer.java

private void loadModDescription(String modName) {
    JPanel p = getModDescriptionPane();
    p.removeAll();/*  w  ww . j  av a2  s .com*/
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));

    final String extras = InstallerConfig.getExtraModsFolder();
    final String modFolderName = FilenameUtils.concat(extras, modName);
    File modFolder = new File(modFolderName);
    if (!modFolder.exists()) {
        LOGGER.error("Mod folder for " + modName + " does not exist.");
    }
    File descrFile = new File(FilenameUtils.concat(modFolderName, "description.txt"));
    File imgFile = new File(FilenameUtils.concat(modFolderName, "image.png"));
    if (!descrFile.exists() && !imgFile.exists()) {
        p.add(new JLabel("<html>No description for:<br>" + modName + "</html>"));
    } else {
        if (imgFile.exists()) {
            try {
                JLabel label = new JLabel();
                BufferedImage img = ImageIO.read(imgFile);
                label.setIcon(new ImageIcon(img));
                p.add(label);
            } catch (IOException e) {
                LOGGER.error("Error reading image file: " + imgFile.getPath(), e);
            }
        }
        if (descrFile.exists()) {
            StringBuilder buffer = new StringBuilder();
            try {
                BufferedReader r = new BufferedReader(new FileReader(descrFile));
                String l = null;
                while ((l = r.readLine()) != null) {
                    buffer.append(l + "\n");
                }
                r.close();
                JEditorPane area = new JEditorPane();
                area.setContentType("text/html");
                area.setText(buffer.toString());
                area.setEditable(false);
                area.addHyperlinkListener(this);
                area.setCaretPosition(0);
                p.add(new JScrollPane(area));
            } catch (IOException e) {
                LOGGER.error("Error reading description file: " + descrFile.getPath(), e);
            }
        }
    }

    p.validate();
    p.repaint();
}

From source file:TransformExplorer.java

Box translationPanel() {
    Box panel = new Box(BoxLayout.Y_AXIS);

    panel.add(new LeftAlignComponent(new JLabel("Translation Offset")));

    // X translation label, slider, and value label
    FloatLabelJSlider coneTranslateXSlider = new FloatLabelJSlider("X", 0.1f, -2.0f, 2.0f, coneTranslation.x);
    coneTranslateXSlider.setMajorTickSpacing(1.0f);
    coneTranslateXSlider.setPaintTicks(true);
    coneTranslateXSlider.addFloatListener(new FloatListener() {
        public void floatChanged(FloatEvent e) {
            coneTranslation.x = e.getValue();
            if (useCompoundTransform) {
                updateUsingCompoundTransform();
            } else {
                setConeTranslation();//from  w w  w.  ja  v  a  2  s .c o m
            }
        }
    });
    panel.add(coneTranslateXSlider);

    // Y translation label, slider, and value label
    FloatLabelJSlider coneTranslateYSlider = new FloatLabelJSlider("Y", 0.1f, -2.0f, 2.0f, coneTranslation.y);
    coneTranslateYSlider.setMajorTickSpacing(1.0f);
    coneTranslateYSlider.setPaintTicks(true);
    coneTranslateYSlider.addFloatListener(new FloatListener() {
        public void floatChanged(FloatEvent e) {
            coneTranslation.y = e.getValue();
            if (useCompoundTransform) {
                updateUsingCompoundTransform();
            } else {
                setConeTranslation();
            }
        }
    });
    panel.add(coneTranslateYSlider);

    // Z translation label, slider, and value label
    FloatLabelJSlider coneTranslateZSlider = new FloatLabelJSlider("Z", 0.1f, -2.0f, 2.0f, coneTranslation.z);
    coneTranslateZSlider.setMajorTickSpacing(1.0f);
    coneTranslateZSlider.setPaintTicks(true);
    coneTranslateZSlider.addFloatListener(new FloatListener() {
        public void floatChanged(FloatEvent e) {
            coneTranslation.z = e.getValue();
            if (useCompoundTransform) {
                updateUsingCompoundTransform();
            } else {
                setConeTranslation();
            }
        }
    });
    panel.add(coneTranslateZSlider);

    return panel;
}

From source file:edu.ucla.stat.SOCR.chart.SuperXYZChart.java

protected void initGraphPanel() {
    //   System.out.println("initGraphPanel called");
    graphPanel = new JPanel();

    graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS));

    JFreeChart chart = createEmptyChart(null); //create a empty graph first
    chartPanel = new ChartPanel(chart, false);
    chartPanel.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y - 100));

    sliderPanel = new JPanel();
    zSlider = new PercentSlider("Bubble Size Percent", 100, 1, 200);
    //   zSlider.setAll(1, 200, zThrinkPercent);

    reset_Slider();// the range will need to be reset
    zSlider.setPreferredSize(new Dimension(CHART_SIZE_X, 100));
    //zSlider.setSliderSize(new Dimension(CHART_SIZE_X-10,100));
    zSlider.addObserver(this);
    sliderPanel.add(this.zSlider);
    sliderPanel.setPreferredSize(new Dimension(CHART_SIZE_X + 100, 80));

    graphPanel.add(chartPanel);/*  www. j av a2s.co  m*/
    graphPanel.add(sliderPanel);
    graphPanel.validate();
}

From source file:edu.ucla.stat.SOCR.analyses.gui.KolmogorovSmirnoff.java

/*********************************************************************************/
protected void doGraph() {
    graphPanel.removeAll();//from w w w .  j a v  a 2s.co  m
    JPanel innerPanel = new JPanel();
    JScrollPane graphPane = new JScrollPane(innerPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    graphPanel.add(graphPane);
    innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));
    graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS));

    /******************************************************/
    JFreeChart scatterChart = null;
    ChartPanel chartPanel1 = null, chartPanel2 = null;
    Chart chartFactory = new Chart();
    String lineType = "excludesZeroNoShape";

    double[][] x = new double[1][];
    double[][] y = new double[1][];
    String[] groupNames = null;

    /********* FIGURE 1, BEFORE TAKING LOG ****************/
    x[0] = sortedX1;
    y[0] = y1;
    groupNames = new String[] { varHeader0 };
    scatterChart = chartFactory.getLineChart("Cumulative Factor Plot", varHeader0, "Probability",
            groupNames.length, groupNames, x, y, lineType);
    chartPanel1 = new ChartPanel(scatterChart, false);
    chartPanel1.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel1);

    x = new double[1][];
    y = new double[1][];
    x[0] = sortedX2;
    y[0] = y2;
    groupNames = new String[] { varHeader1 };
    scatterChart = chartFactory.getLineChart("Cumulative Factor Plot", varHeader1, "Probability",
            groupNames.length, groupNames, x, y, lineType);
    chartPanel1 = new ChartPanel(scatterChart, false);
    chartPanel1.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel1);

    x = new double[2][];
    y = new double[2][];
    x[0] = sortedX1;
    x[1] = sortedX2;
    y[0] = y1;
    y[1] = y2;
    groupNames = new String[] { varHeader0, varHeader1 };
    scatterChart = chartFactory.getLineChart("Cumulative Factor Plot", "X", "Probability", groupNames.length,
            groupNames, x, y, lineType);
    chartPanel1 = new ChartPanel(scatterChart, false);
    chartPanel1.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel1);

    scatterChart = null;

    /********* FIGURE 1, AFTER TAKING LOG *****************/
    x = new double[1][];
    y = new double[1][];
    x[0] = logX1;
    y[0] = y1;
    groupNames = new String[] { varHeader0 };
    scatterChart = chartFactory.getLineChart("Cumulative Factor Plot (log)", "log(" + varHeader0 + ")",
            "Probability", groupNames.length, groupNames, x, y, lineType);
    chartPanel2 = new ChartPanel(scatterChart, false);
    chartPanel2.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel2);

    x = new double[1][];
    y = new double[1][];
    x[0] = logX2;
    y[0] = y2;
    groupNames = new String[] { varHeader1 };
    scatterChart = chartFactory.getLineChart("Cumulative Factor Plot (log)", "log(" + varHeader0 + ")",
            "Probability", groupNames.length, groupNames, x, y, lineType);
    chartPanel2 = new ChartPanel(scatterChart, false);
    chartPanel2.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel2);

    x = new double[2][];
    y = new double[2][];
    x[0] = logX1;
    x[1] = logX2;
    y[0] = y1;
    y[1] = y2;
    groupNames = new String[] { varHeader0, varHeader1 };
    scatterChart = chartFactory.getLineChart("Cumulative Factor Plot (log)", "log(X)", "Probability",
            groupNames.length, groupNames, x, y, lineType);
    chartPanel2 = new ChartPanel(scatterChart, false);
    chartPanel2.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel2);

    graphPanel.validate();

}