Example usage for javax.swing ScrollPaneConstants HORIZONTAL_SCROLLBAR_NEVER

List of usage examples for javax.swing ScrollPaneConstants HORIZONTAL_SCROLLBAR_NEVER

Introduction

In this page you can find the example usage for javax.swing ScrollPaneConstants HORIZONTAL_SCROLLBAR_NEVER.

Prototype

int HORIZONTAL_SCROLLBAR_NEVER

To view the source code for javax.swing ScrollPaneConstants HORIZONTAL_SCROLLBAR_NEVER.

Click Source Link

Document

Used to set the horizontal scroll bar policy so that horizontal scrollbars are never displayed.

Usage

From source file:edu.ku.brc.af.ui.forms.CarryForwardConfigDlg.java

@Override
public void createUI() {
    super.createUI();

    buildTableModel(mvParent);/*from w ww .  j  av  a 2 s  .c o m*/

    model = new CFTableModel();
    table = new JTable(model) {
        //  Returning the Class of each column will allow different
        //  renderers to be used based on Class
        public Class<?> getColumnClass(int column) {
            return getValueAt(0, column).getClass();
        }

        public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
            Component c = super.prepareRenderer(renderer, row, column);
            if (!c.getBackground().equals(getSelectionBackground())) {
                CFWItem item = items.get(row);
                c.setBackground(item.getColor());
            }
            return c;
        }
    };

    UIHelper.makeTableHeadersCentered(table, false);

    //((DefaultTableCellRenderer)table.getColumnModel().getColumn(1).getCellRenderer()).setHorizontalAlignment(SwingConstants.CENTER);

    JScrollPane sp = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    contentPanel = sp;//new JPanel(new BorderLayout()));
    mainPanel.add(contentPanel, BorderLayout.CENTER);
}

From source file:edu.ku.brc.af.core.NavBox.java

/**
 * Constructor (with name)./*  w  w  w .  ja v a2s .c o m*/
 * @param name the name of the NavBox.
 * @param collapsable indicates whether the NavBox can be collapsable
 */
public NavBox(final String name, final boolean collapsable, final boolean scrollable) {
    super();
    this.name = name;
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    this.scrollable = scrollable;

    SkinItem skinItem = SkinsMgr.getSkinItem("NavBox");

    if (scrollable) {
        itemsPanel = new JPanel();//new BoxLayout(this, BoxLayout.Y_AXIS));

        itemsPanel.setBorder(null);

        if (skinItem != null) {
            itemsPanel.setOpaque(skinItem.isOpaque());
            skinItem.setupPanel(itemsPanel);

        } else {
            itemsPanel.setBackground(NavBoxMgr.getBGColor());
        }
    }

    setBorder(BorderFactory.createEmptyBorder(22, 4, 4, 4));
    setBackground(NavBoxMgr.getBGColor());
    setOpaque(!SkinsMgr.hasSkins());

    if (scrollable) {
        JScrollPane scrollPane = new JScrollPane(itemsPanel);
        scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        scrollPane.setBorder(null);
        add(scrollPane);
    }

    if (collapsable) {
        /*
           collapsableIconOpen   = IconManager.getIcon("Minimize");
           collapsableIconClosed = IconManager.getIcon("Maximize");
                   
           addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e)
        {
            if (iconRect != null && iconRect.contains(e.getPoint()))
            {
                collapsed = !collapsed;
                if (collapsed)
                {
                    icon = collapsableIconClosed;
                    setSize(getSize().width, minHeight);
                } else
                {
                    icon = collapsableIconOpen;
                    setSize(getPreferredSize());
                }
                validate();
                invalidate();
                doLayout();
            }
        }
           });
        */ }
}

From source file:captureplugin.drivers.DeviceCreatorDialog.java

/**
 * Create the GUI/*  www  . j  ava  2s.  c  om*/
 */
private void createGUI() {
    UiUtilities.registerForClosing(this);

    DriverIf[] drivers = DriverFactory.getInstance().getDrivers();

    mDriverCombo = new JComboBox(drivers);
    mDriverCombo.setRenderer(new DefaultListCellRenderer() {
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {

            if (value instanceof DriverIf) {
                value = ((DriverIf) value).getDriverName();
            }

            return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        }
    });

    JPanel panel = (JPanel) getContentPane();

    panel.setLayout(new GridBagLayout());

    GridBagConstraints label = new GridBagConstraints();

    label.insets = new Insets(5, 5, 5, 5);
    label.anchor = GridBagConstraints.NORTHWEST;

    GridBagConstraints input = new GridBagConstraints();

    input.fill = GridBagConstraints.HORIZONTAL;
    input.weightx = 1.0;
    input.gridwidth = GridBagConstraints.REMAINDER;
    input.insets = new Insets(5, 5, 5, 5);

    panel.add(new JLabel(mLocalizer.msg("Name", "Name")), label);

    mName = new JTextField();
    panel.add(mName, input);

    panel.add(new JLabel(mLocalizer.msg("Driver", "Driver")), label);
    panel.add(mDriverCombo, input);

    mDesc = UiUtilities.createHtmlHelpTextArea("");
    mDesc.setEditable(false);

    panel.add(new JLabel(mLocalizer.msg("Description", "Description")), input);

    GridBagConstraints descC = new GridBagConstraints();
    descC.weightx = 1.0;
    descC.weighty = 1.0;
    descC.fill = GridBagConstraints.BOTH;
    descC.gridwidth = GridBagConstraints.REMAINDER;
    descC.insets = new Insets(5, 5, 5, 5);

    panel.add(new JScrollPane(mDesc, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER), descC);

    final Font font = new JLabel().getFont();

    String desc = ((DriverIf) mDriverCombo.getSelectedItem()).getDriverDesc();
    desc = "<html><div style=\"color:#000000;font-family:" + font.getName() + "; font-size:" + font.getSize()
            + ";\">" + desc + "</div></html>";
    mDesc.setText(desc);
    mDesc.setFont(font);

    mDriverCombo.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            String description = ((DriverIf) mDriverCombo.getSelectedItem()).getDriverDesc();
            description = "<html><div style=\"color:#000000;font-family:" + font.getName() + "; font-size:"
                    + font.getSize() + ";\">" + description + "</div></html>";
            mDesc.setText(description);
            mDesc.setFont(font);
        }

    });

    final JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
    ok.setEnabled(false);
    final JButton cancel = new JButton(Localizer.getLocalization(Localizer.I18N_CANCEL));
    ok.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            okPressed();
        }
    });

    cancel.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            setVisible(false);
        }
    });

    mName.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void removeUpdate(DocumentEvent e) {
            updateButtons();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            updateButtons();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            updateButtons();
        }

        private void updateButtons() {
            ok.setEnabled(!mName.getText().trim().isEmpty());
        }
    });

    ButtonBarBuilder2 builder = new ButtonBarBuilder2();
    builder.addGlue();
    builder.addButton(new JButton[] { ok, cancel });

    getRootPane().setDefaultButton(ok);

    input.insets = new Insets(5, 5, 5, 5);

    panel.add(builder.getPanel(), input);

    setSize(400, 300);

}

From source file:dk.dma.epd.common.prototype.gui.notification.ChatServicePanel.java

/**
 * Constructor//from   w w w . j a  v  a 2 s . c om
 * 
 * @param compactLayout
 *            if false, there will be message type selectors in the panel
 */
public ChatServicePanel(boolean compactLayout) {
    super(new BorderLayout());

    // Prepare the title header
    titleHeader.setBackground(getBackground().darker());
    titleHeader.setOpaque(true);
    titleHeader.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    titleHeader.setHorizontalAlignment(SwingConstants.CENTER);
    add(titleHeader, BorderLayout.NORTH);

    // Add messages panel
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    messagesPanel.setBackground(UIManager.getColor("List.background"));
    messagesPanel.setOpaque(false);
    messagesPanel.setLayout(new GridBagLayout());
    messagesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    add(scrollPane, BorderLayout.CENTER);

    JPanel sendPanel = new JPanel(new GridBagLayout());
    add(sendPanel, BorderLayout.SOUTH);
    Insets insets = new Insets(2, 2, 2, 2);

    // Add text area
    if (compactLayout) {
        messageText = new JTextField();
        ((JTextField) messageText).addActionListener(this);
        sendPanel.add(messageText, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, NORTH, BOTH, insets, 0, 0));

    } else {
        messageText = new JTextArea();
        JScrollPane scrollPane2 = new JScrollPane(messageText);
        scrollPane2.setPreferredSize(new Dimension(100, 50));
        scrollPane2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        scrollPane2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
        sendPanel.add(scrollPane2, new GridBagConstraints(0, 0, 1, 2, 1.0, 1.0, NORTH, BOTH, insets, 0, 0));
    }

    // Add buttons
    ButtonGroup group = new ButtonGroup();
    messageTypeBtn = createMessageTypeButton("Send messages", ICON_MESSAGE, true, group);
    warningTypeBtn = createMessageTypeButton("Send warnings", ICON_WARNING, false, group);
    alertTypeBtn = createMessageTypeButton("Send alerts", ICON_ALERT, false, group);

    if (!compactLayout) {
        JToolBar msgTypePanel = new JToolBar();
        msgTypePanel.setBorderPainted(false);
        msgTypePanel.setOpaque(true);
        msgTypePanel.setFloatable(false);
        sendPanel.add(msgTypePanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0));
        msgTypePanel.add(messageTypeBtn);
        msgTypePanel.add(warningTypeBtn);
        msgTypePanel.add(alertTypeBtn);
    }

    if (compactLayout) {
        sendBtn = new JButton("Send");
        sendPanel.add(sendBtn, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0));
    } else {
        sendBtn = new JButton("Send", ICON_MESSAGE);
        sendBtn.setPreferredSize(new Dimension(100, sendBtn.getPreferredSize().height));
        sendPanel.add(sendBtn, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0));
    }
    sendBtn.setEnabled(false);
    messageText.setEditable(false);
    sendBtn.addActionListener(this);
}

From source file:net.sf.jabref.gui.PreviewPanel.java

/**
 *
 * @param panel/*w w  w .ja v  a 2  s  .  c o m*/
 *            (may be null) If not given no toolbar is shown on the right
 *            hand side.
 * @param databaseContext
 *            (may be null) Used for resolving pdf directories for links.
 * @param layoutFile
 *            (must be given) Used for layout
 */
public PreviewPanel(BasePanel panel, BibDatabaseContext databaseContext, String layoutFile) {
    super(new BorderLayout(), true);

    this.databaseContext = Optional.ofNullable(databaseContext);
    this.layoutFile = Objects.requireNonNull(layoutFile);
    updateLayout();

    this.closeAction = new CloseAction();
    this.printAction = new PrintAction();
    this.copyPreviewAction = new CopyPreviewAction();

    this.basePanel = Optional.ofNullable(panel);

    createPreviewPane();

    if (panel != null) {
        // dropped files handler only created for main window
        // not for Windows as like the search results window
        this.previewPane.setTransferHandler(
                new PreviewPanelTransferHandler(panel.frame(), this, this.previewPane.getTransferHandler()));
    }

    // Set up scroll pane for preview pane
    scrollPane = new JScrollPane(previewPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setBorder(null);

    /*
     * If we have been given a panel and the preference option
     * previewPrintButton is set, show the tool bar
     */
    if (this.basePanel.isPresent()
            && JabRefPreferences.getInstance().getBoolean(JabRefPreferences.PREVIEW_PRINT_BUTTON)) {
        add(createToolBar(), BorderLayout.LINE_START);
    }

    add(scrollPane, BorderLayout.CENTER);

    this.createKeyBindings();
}

From source file:net.sf.keystore_explorer.gui.dialogs.extensions.DViewExtensions.java

private void initComponents() {
    ExtensionsTableModel extensionsTableModel = new ExtensionsTableModel();
    jtExtensions = new JKseTable(extensionsTableModel);

    TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(extensionsTableModel);
    sorter.setComparator(2, new ObjectIdComparator());
    jtExtensions.setRowSorter(sorter);/*from   ww w. j  a  v  a 2s.  c o m*/

    jtExtensions.setShowGrid(false);
    jtExtensions.setRowMargin(0);
    jtExtensions.getColumnModel().setColumnMargin(0);
    jtExtensions.getTableHeader().setReorderingAllowed(false);
    jtExtensions.setAutoResizeMode(JKseTable.AUTO_RESIZE_ALL_COLUMNS);
    jtExtensions.setRowHeight(Math.max(18, jtExtensions.getRowHeight()));

    for (int i = 0; i < jtExtensions.getColumnCount(); i++) {
        TableColumn column = jtExtensions.getColumnModel().getColumn(i);
        column.setHeaderRenderer(
                new ExtensionsTableHeadRend(jtExtensions.getTableHeader().getDefaultRenderer()));
        column.setCellRenderer(new ExtensionsTableCellRend());
    }

    TableColumn criticalCol = jtExtensions.getColumnModel().getColumn(0);
    criticalCol.setResizable(false);
    criticalCol.setMinWidth(28);
    criticalCol.setMaxWidth(28);
    criticalCol.setPreferredWidth(28);

    ListSelectionModel selectionModel = jtExtensions.getSelectionModel();
    selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    selectionModel.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent evt) {
            if (!evt.getValueIsAdjusting()) {
                try {
                    CursorUtil.setCursorBusy(DViewExtensions.this);
                    updateExtensionValue();
                } finally {
                    CursorUtil.setCursorFree(DViewExtensions.this);
                }
            }
        }
    });

    jspExtensionsTable = PlatformUtil.createScrollPane(jtExtensions,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jspExtensionsTable.getViewport().setBackground(jtExtensions.getBackground());

    jpExtensionsTable = new JPanel(new BorderLayout(5, 5));
    jpExtensionsTable.setPreferredSize(new Dimension(500, 200));
    jpExtensionsTable.add(jspExtensionsTable, BorderLayout.CENTER);

    jpExtensionValue = new JPanel(new BorderLayout(5, 5));

    jlExtensionValue = new JLabel(res.getString("DViewExtensions.jlExtensionValue.text"));

    jpExtensionValue.add(jlExtensionValue, BorderLayout.NORTH);

    jepExtensionValue = new JEditorPane();
    jepExtensionValue.setFont(new Font(Font.MONOSPACED, Font.PLAIN, LnfUtil.getDefaultFontSize()));
    jepExtensionValue.setEditable(false);
    jepExtensionValue.setToolTipText(res.getString("DViewExtensions.jtaExtensionValue.tooltip"));
    // JGoodies - keep uneditable color same as editable
    jepExtensionValue.putClientProperty("JTextArea.infoBackground", Boolean.TRUE);

    // for displaying URLs in extensions as clickable links
    jepExtensionValue.setContentType("text/html");
    jepExtensionValue.addHyperlinkListener(this);
    // use default font and foreground color from the component
    jepExtensionValue.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);

    jspExtensionValue = PlatformUtil.createScrollPane(jepExtensionValue,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    jpExtensionValueTextArea = new JPanel(new BorderLayout(5, 5));
    jpExtensionValueTextArea.setPreferredSize(new Dimension(500, 200));
    jpExtensionValueTextArea.add(jspExtensionValue, BorderLayout.CENTER);

    jpExtensionValue.add(jpExtensionValueTextArea, BorderLayout.CENTER);

    jbAsn1 = new JButton(res.getString("DViewExtensions.jbAsn1.text"));

    PlatformUtil.setMnemonic(jbAsn1, res.getString("DViewExtensions.jbAsn1.mnemonic").charAt(0));
    jbAsn1.setToolTipText(res.getString("DViewExtensions.jbAsn1.tooltip"));
    jbAsn1.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DViewExtensions.this);
                asn1DumpPressed();
            } finally {
                CursorUtil.setCursorFree(DViewExtensions.this);
            }
        }
    });

    jpExtensionValueAsn1 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    jpExtensionValueAsn1.add(jbAsn1);

    jpExtensionValue.add(jpExtensionValueAsn1, BorderLayout.SOUTH);

    jpExtensions = new JPanel(new GridLayout(2, 1, 5, 5));
    jpExtensions.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5),
            new CompoundBorder(new EtchedBorder(), new EmptyBorder(5, 5, 5, 5))));

    jpExtensions.add(jpExtensionsTable);
    jpExtensions.add(jpExtensionValue);

    jbOK = new JButton(res.getString("DViewExtensions.jbOK.text"));
    jbOK.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });

    jpOK = PlatformUtil.createDialogButtonPanel(jbOK, false);

    extensionsTableModel.load(extensions);

    if (extensionsTableModel.getRowCount() > 0) {
        jtExtensions.changeSelection(0, 0, false, false);
    }

    getContentPane().add(jpExtensions, BorderLayout.CENTER);
    getContentPane().add(jpOK, BorderLayout.SOUTH);

    setResizable(false);

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent evt) {
            closeDialog();
        }
    });

    getRootPane().setDefaultButton(jbOK);

    pack();

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            jbOK.requestFocus();
        }
    });
}

From source file:ca.sqlpower.architect.swingui.ProfileGraphPanel.java

public ProfileGraphPanel(ProfilePanel panel, int rowCount) {
    this.profilePanel = panel;
    this.rowCount = rowCount;

    FormLayout displayLayout = new FormLayout("4dlu, default, 4dlu, 100dlu, 4dlu, fill:default:grow, 4dlu", // columns
            "4dlu, default, 6dlu"); // rows
    CellConstraints cc = new CellConstraints();

    validResultsPanel = ProfileGraphPanel.logger.isDebugEnabled() ? new FormDebugPanel(displayLayout)
            : new JPanel(displayLayout);
    validResultsPanel.setBorder(BorderFactory.createEtchedBorder());

    Font bodyFont = validResultsPanel.getFont();
    Font titleFont = bodyFont.deriveFont(Font.BOLD, bodyFont.getSize() * 1.25F);

    title = new JLabel("Column Name");
    title.setFont(titleFont);//from   w ww. j a va 2s  .c  o m

    PanelBuilder pb = new PanelBuilder(displayLayout, validResultsPanel);
    pb.add(title, cc.xyw(2, 2, 5));

    int row = 4;
    rowCountDisplay = makeInfoRow(pb, "RowCount", row);
    row += 2;
    nullableLabel = makeInfoRow(pb, "Nullable", row);
    row += 2;
    nullCountLabel = makeInfoRow(pb, "Null Count", row);
    row += 2;
    nullPercentLabel = makeInfoRow(pb, "% Null Records", row);
    row += 2;
    minLengthLabel = makeInfoRow(pb, "Minimum Length", row);
    row += 2;
    maxLengthLabel = makeInfoRow(pb, "Maximum Length", row);
    row += 2;
    uniqueCountLabel = makeInfoRow(pb, "Unique Values", row);
    row += 2;
    uniquePercentLabel = makeInfoRow(pb, "% Unique", row);
    row += 2;
    minValue = makeInfoRow(pb, "Minimum Value", row);
    row += 2;
    maxValue = makeInfoRow(pb, "Maximum Value", row);
    row += 2;
    avgValue = makeInfoRow(pb, "Average Value", row);
    row += 2;

    freqValueTable = new FreqValueTable(null);
    freqValueSp = new JScrollPane(freqValueTable);

    pb.appendRow("fill:10dlu:grow");
    pb.appendRow("fill:default:grow");
    pb.add(freqValueSp, cc.xyw(2, row + 1, 3));

    // Now add something to represent the chart
    JFreeChart createPieChart = ChartFactory.createPieChart("", new DefaultPieDataset(new DefaultKeyedValues()),
            false, false, false);
    chartPanel = new ChartPanel(createPieChart);
    chartPanel.setPreferredSize(new Dimension(300, 300));

    if (panel.getProfileManager().getWorkspaceContainer() instanceof ArchitectSession
            && ((ArchitectSession) panel.getProfileManager().getWorkspaceContainer()).isEnterpriseSession()) {
        pb.add(new JLabel("Column Profile Notes"), cc.xy(6, 2));
        notesField = new JTextArea();
        notesField.setLineWrap(true);
        notesField.setWrapStyleWord(true);
        JScrollPane notesScroll = new JScrollPane(notesField);
        notesScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        notesScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        pb.add(notesScroll, cc.xywh(6, 4, 1, row - 4));

        pb.appendRow("fill:4dlu:grow");
        pb.appendRow("4dlu");

        pb.add(chartPanel, cc.xy(6, row + 1));
    } else {
        pb.appendRow("fill:4dlu:grow");
        pb.appendRow("4dlu");
        pb.add(chartPanel, cc.xywh(6, 4, 1, row - 2));
    }

    invalidResultsPanel = new JPanel(new BorderLayout());
    invalidResultsLabel = new JLabel("No error message yet");
    invalidResultsPanel.add(invalidResultsLabel);

    displayArea = new JPanel(new GridLayout(1, 1));
    displayArea.setPreferredSize(validResultsPanel.getPreferredSize());
}

From source file:edu.ku.brc.specify.ui.SelectPrepsDlg.java

@Override
public void createUI() {
    applyLabel = getResourceString("SELECTALL");//$NON-NLS-1$

    super.createUI();

    Vector<ColObjInfo> coList = new Vector<ColObjInfo>(coToPrepHash.values());
    Collections.sort(coList, new Comparator<ColObjInfo>() {
        @Override/*from  www.  ja v  a  2s. co m*/
        public int compare(ColObjInfo o1, ColObjInfo o2) {
            return o1.getCatNo().compareTo(o2.getCatNo());
        }
    });

    int cnt = 0;
    Vector<ColObjInfo> coFilteredList = new Vector<ColObjInfo>();
    for (ColObjInfo colObjInfo : coList) {
        if (StringUtils.isNotEmpty(colObjInfo.getCatNo()) && colObjInfo.getPreps() != null
                && colObjInfo.getPreps().size() > 0) {
            coFilteredList.add(colObjInfo);
            cnt += colObjInfo.getPreps().size();
        }
    }

    String rowDef = UIHelper.createDuplicateJGoodiesDef("p", "1px,p,4px", (cnt * 2) - 1) + ",10px,p"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    PanelBuilder pbuilder = new PanelBuilder(new FormLayout("f:p:g", rowDef)); //$NON-NLS-1$
    CellConstraints cc = new CellConstraints();

    ActionListener al = new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            doEnableOKBtn();
        }
    };

    ChangeListener cl = new ChangeListener() {
        public void stateChanged(ChangeEvent ae) {
            doEnableOKBtn();
        }
    };

    DBTableInfo colObjTI = DBTableIdMgr.getInstance().getInfoById(CollectionObject.getClassTableId());
    DBFieldInfo colObjFI = colObjTI.getFieldByColumnName("CatalogNumber");

    int i = 0;
    int y = 1;
    for (ColObjInfo colObjInfo : coFilteredList) {
        if (i > 0) {
            pbuilder.addSeparator("", cc.xy(1, y)); //$NON-NLS-1$
        }
        y += 2;

        colObjInfo.setCatNo((String) colObjFI.getFormatter().formatToUI(colObjInfo.getCatNo()));
        ColObjPanel panel = new ColObjPanel(this, colObjInfo);
        colObjPanels.add(panel);
        panel.addActionListener(al, cl);
        pbuilder.add(panel, cc.xy(1, y));
        y += 2;
        i++;
    }

    applyBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            selectAllItems();
        }
    });

    JPanel tPanel = new JPanel(new BorderLayout());
    summaryLabel = createLabel(""); //$NON-NLS-1$
    tPanel.setBorder(BorderFactory.createEmptyBorder(5, 1, 5, 1));
    tPanel.add(summaryLabel, BorderLayout.NORTH);

    JScrollPane sp = new JScrollPane(pbuilder.getPanel(), ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    tPanel.add(sp, BorderLayout.CENTER);

    contentPanel = tPanel;
    mainPanel.add(contentPanel, BorderLayout.CENTER);

    pack();

    doEnableOKBtn();

    Dimension size = getPreferredSize();
    size.width += 20;
    size.height = size.height > 500 ? 500 : size.height;
    setSize(size);
}

From source file:org.esa.snap.rcp.statistics.ChartPagePanel.java

protected void createUI(final ChartPanel chartPanel, final JPanel optionsPanel, BindingContext bindingContext) {
    roiMaskSelector = new RoiMaskSelector(bindingContext);

    final JPanel extendedOptionsPanel = GridBagUtils.createPanel();
    GridBagConstraints extendedOptionsPanelConstraints = GridBagUtils.createConstraints(
            "insets.left=4,insets.right=2,anchor=NORTHWEST,fill=HORIZONTAL,insets.top=2,weightx=1");
    GridBagUtils.addToPanel(extendedOptionsPanel, new JSeparator(), extendedOptionsPanelConstraints, "gridy=0");
    GridBagUtils.addToPanel(extendedOptionsPanel, roiMaskSelector.createPanel(),
            extendedOptionsPanelConstraints, "gridy=1,insets.left=-4");
    GridBagUtils.addToPanel(extendedOptionsPanel, new JPanel(), extendedOptionsPanelConstraints,
            "gridy=1,insets.left=-4");
    GridBagUtils.addToPanel(extendedOptionsPanel, optionsPanel, extendedOptionsPanelConstraints,
            "insets.left=0,insets.right=0,gridy=2,fill=VERTICAL,fill=HORIZONTAL,weighty=1");
    GridBagUtils.addToPanel(extendedOptionsPanel, new JSeparator(), extendedOptionsPanelConstraints,
            "insets.left=4,insets.right=2,gridy=5,anchor=SOUTHWEST");

    final SimpleScrollPane optionsScrollPane = new SimpleScrollPane(extendedOptionsPanel,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    optionsScrollPane.setBorder(null);//from   ww w  . j a v a 2 s .co m
    optionsScrollPane.getVerticalScrollBar().setUnitIncrement(20);

    final JPanel rightPanel = new JPanel(new BorderLayout());
    rightPanel.add(createTopPanel(), BorderLayout.NORTH);
    rightPanel.add(optionsScrollPane, BorderLayout.CENTER);
    rightPanel.add(createChartBottomPanel(chartPanel), BorderLayout.SOUTH);

    final ImageIcon collapseIcon = UIUtils.loadImageIcon("icons/PanelRight12.png");
    final ImageIcon collapseRolloverIcon = ToolButtonFactory.createRolloverIcon(collapseIcon);
    final ImageIcon expandIcon = UIUtils.loadImageIcon("icons/PanelLeft12.png");
    final ImageIcon expandRolloverIcon = ToolButtonFactory.createRolloverIcon(expandIcon);

    hideAndShowButton = ToolButtonFactory.createButton(collapseIcon, false);
    hideAndShowButton.setToolTipText("Collapse Options Panel");
    hideAndShowButton.setName("switchToChartButton");
    hideAndShowButton.addActionListener(new ActionListener() {

        public boolean rightPanelShown;

        @Override
        public void actionPerformed(ActionEvent e) {
            rightPanel.setVisible(rightPanelShown);
            if (rightPanelShown) {
                hideAndShowButton.setIcon(collapseIcon);
                hideAndShowButton.setRolloverIcon(collapseRolloverIcon);
                hideAndShowButton.setToolTipText("Collapse Options Panel");
            } else {
                hideAndShowButton.setIcon(expandIcon);
                hideAndShowButton.setRolloverIcon(expandRolloverIcon);
                hideAndShowButton.setToolTipText("Expand Options Panel");
            }
            rightPanelShown = !rightPanelShown;
        }
    });

    backgroundPanel = new JPanel(new BorderLayout());
    backgroundPanel.add(chartPanel, BorderLayout.CENTER);
    backgroundPanel.add(rightPanel, BorderLayout.EAST);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.add(backgroundPanel, new Integer(0));
    layeredPane.add(hideAndShowButton, new Integer(1));
    add(layeredPane);
}

From source file:net.sf.firemox.ui.wizard.About.java

/**
 * Creates a new instance of About <br>
 * /*w w w  .  j  a v a  2 s .c  o  m*/
 * @param parent
 */
public About(JFrame parent) {
    super(LanguageManager.getString("wiz_about.title"), LanguageManager.getString("wiz_about.description"),
            "mp64.gif", LanguageManager.getString("close"), 420, 620);
    JPanel thanksPanel = new JPanel();

    thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS));
    thanksPanel.setMaximumSize(new Dimension(32767, 26));
    thanksPanel.setOpaque(false);
    JLabel jLabel5 = new JLabel(LanguageManager.getString("version") + " : ");
    jLabel5.setFont(MToolKit.defaultFont);
    jLabel5.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabel5.setMaximumSize(new Dimension(100, 16));
    jLabel5.setMinimumSize(new Dimension(100, 16));
    jLabel5.setPreferredSize(new Dimension(100, 16));
    thanksPanel.add(jLabel5);
    jLabel5 = new JLabel(IdConst.VERSION);
    thanksPanel.add(jLabel5);
    gameParamPanel.add(thanksPanel);

    thanksPanel = new JPanel();
    thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS));
    thanksPanel.setOpaque(false);
    JPanel thanksPanelLeft = new JPanel(new FlowLayout(FlowLayout.LEADING));
    thanksPanelLeft.setLayout(new BoxLayout(thanksPanelLeft, BoxLayout.Y_AXIS));
    thanksPanelLeft.setMaximumSize(new Dimension(100, 2000));
    thanksPanelLeft.setMinimumSize(new Dimension(100, 16));
    jLabel5 = new JLabel(LanguageManager.getString("thanks") + " : ");
    jLabel5.setFont(MToolKit.defaultFont);
    jLabel5.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabel5.setMaximumSize(new Dimension(100, 16));
    jLabel5.setMinimumSize(new Dimension(100, 16));
    jLabel5.setPreferredSize(new Dimension(100, 16));
    thanksPanelLeft.add(jLabel5);
    thanksPanel.add(thanksPanelLeft);
    thanksPanelLeft = new JPanel();
    thanksPanelLeft.setLayout(new BoxLayout(thanksPanelLeft, BoxLayout.Y_AXIS));
    StringBuilder contributors = new StringBuilder();
    addContributor(contributors, "Fabrice Daugan", "developper", "france");
    addContributor(contributors, "Hoani Cross", "developper", "frenchpolynesia");
    addContributor(contributors, "nico100", "graphist", "france");
    addContributor(contributors, "seingalt_tm", "graphist", "france");
    addContributor(contributors, "surtur2", "tester", null);
    addContributor(contributors, "Jan Blaha", "developper", "cz");
    addContributor(contributors, "Tureba", "developper", "brazil");
    addContributor(contributors, "hakvf", "tester", "france");
    addContributor(contributors, "Stefano \"Kismet\" Lenzi", "developper", "italian");
    jLabel5 = new JLabel(contributors.toString());
    jLabel5.setFont(MToolKit.defaultFont);
    jLabel5.setHorizontalAlignment(SwingConstants.LEFT);
    thanksPanelLeft.add(jLabel5);
    jLabel5 = new JLink("http://obsidiurne.free.fr", "morgil has designed the splash screen");
    jLabel5.setFont(MToolKit.defaultFont);
    thanksPanelLeft.add(jLabel5);
    thanksPanel.add(thanksPanelLeft);

    gameParamPanel.add(thanksPanel);

    thanksPanel = new JPanel();
    thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS));
    thanksPanel.setMaximumSize(new Dimension(32767, 26));
    thanksPanel.setOpaque(false);
    JLabel blanklbl = new JLabel();
    blanklbl.setHorizontalAlignment(SwingConstants.RIGHT);
    blanklbl.setMaximumSize(new Dimension(100, 16));
    blanklbl.setMinimumSize(new Dimension(100, 16));
    blanklbl.setPreferredSize(new Dimension(100, 16));
    thanksPanel.add(blanklbl);

    jLabel5 = new JLink(
            "http://sourceforge.net/tracker/?func=add&group_id=" + IdConst.PROJECT_ID + "&atid=601043",
            LanguageManager.getString("joindev"));
    jLabel5.setFont(MToolKit.defaultFont);
    thanksPanel.add(jLabel5);
    gameParamPanel.add(thanksPanel);

    thanksPanel = new JPanel();
    thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS));
    thanksPanel.setOpaque(false);
    jLabel5 = new JLabel(LanguageManager.getString("projecthome") + " : ");
    jLabel5.setFont(MToolKit.defaultFont);
    jLabel5.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabel5.setMaximumSize(new Dimension(100, 16));
    jLabel5.setMinimumSize(new Dimension(100, 16));
    jLabel5.setPreferredSize(new Dimension(100, 16));
    thanksPanel.add(jLabel5);
    jLabel5 = new JLink(IdConst.MAIN_PAGE, IdConst.MAIN_PAGE);
    jLabel5.setFont(MToolKit.defaultFont);
    thanksPanel.add(jLabel5);
    gameParamPanel.add(thanksPanel);

    // forum francais
    thanksPanel = new JPanel();
    thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS));
    thanksPanel.setOpaque(false);
    jLabel5 = new JLabel(LanguageManager.getString("othersites") + " : ");
    jLabel5.setFont(MToolKit.defaultFont);
    jLabel5.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabel5.setMaximumSize(new Dimension(100, 16));
    jLabel5.setMinimumSize(new Dimension(100, 16));
    jLabel5.setPreferredSize(new Dimension(100, 16));
    thanksPanel.add(jLabel5);
    jLabel5 = new JLink("http://www.Firemox.fr.st", UIHelper.getIcon("mpfrsml.gif"), SwingConstants.LEFT);
    jLabel5.setToolTipText(LanguageManager.getString("frenchforum.tooltip"));
    thanksPanel.add(jLabel5);
    jLabel5 = new JLabel();
    jLabel5.setMaximumSize(new Dimension(1000, 16));
    thanksPanel.add(jLabel5);
    gameParamPanel.add(thanksPanel);

    JTextArea disclaimer = new JTextArea();
    disclaimer.setEditable(false);
    disclaimer.setLineWrap(true);
    disclaimer.setWrapStyleWord(true);
    disclaimer.setAutoscrolls(true);
    disclaimer.setTabSize(2);
    disclaimer.setFont(new Font("Arial", 0, 10));
    // Then try and read it locally
    BufferedReader inGPL = null;
    try {
        inGPL = new BufferedReader(new InputStreamReader(MToolKit.getResourceAsStream(IdConst.FILE_LICENSE)));
        disclaimer.read(inGPL, "");
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        IOUtils.closeQuietly(inGPL);
    }
    JScrollPane disclaimerSPanel = new JScrollPane();
    disclaimerSPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    MToolKit.addOverlay(disclaimerSPanel);
    disclaimerSPanel.setViewportView(disclaimer);
    gameParamPanel.add(disclaimerSPanel);
}