Search in sources :

Example 96 with JScrollPane

use of javax.swing.JScrollPane in project pcgen by PCGen.

the class RunConvertPanel method setupDisplay.

/**
	 * @see pcgen.gui2.converter.panel.ConvertSubPanel#setupDisplay(javax.swing.JPanel, pcgen.cdom.base.CDOMObject)
	 */
@Override
public void setupDisplay(JPanel panel, CDOMObject pc) {
    panel.setLayout(new GridBagLayout());
    JLabel introLabel = new JLabel("Conversion in progress");
    GridBagConstraints gbc = new GridBagConstraints();
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(0, 10, 5, 10);
    panel.add(introLabel, gbc);
    JLabel explainLabel = new JLabel("<html>The LST data is being converted. In the log, " + "LSTERROR rows are errors that need to be manually corrected in the source data. " + "LSTWARN rows indicate changes the converter is making. " + "See " + changeLogFile.getAbsolutePath() + " for a log of all data changes.</html>");
    explainLabel.setFocusable(true);
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(0, 10, 5, 10);
    panel.add(explainLabel, gbc);
    progressBar = getProgressBar();
    Dimension d = progressBar.getPreferredSize();
    d.width = 400;
    progressBar.setPreferredSize(d);
    progressBar.setStringPainted(true);
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    panel.add(progressBar, gbc);
    messageAreaContainer = new JScrollPane(getMessageArea());
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, GridBagConstraints.REMAINDER, 1.0, 1.0);
    gbc.fill = GridBagConstraints.BOTH;
    panel.add(messageAreaContainer, gbc);
    panel.setPreferredSize(new Dimension(800, 500));
}
Also used : JScrollPane(javax.swing.JScrollPane) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Example 97 with JScrollPane

use of javax.swing.JScrollPane in project pcgen by PCGen.

the class CampaignPanel method setupDisplay.

/**
	 * @see pcgen.gui2.converter.panel.ConvertSubPanel#setupDisplay(javax.swing.JPanel, pcgen.cdom.base.CDOMObject)
	 */
@Override
public void setupDisplay(JPanel panel, final CDOMObject pc) {
    panel.setLayout(new GridBagLayout());
    JLabel introLabel = new JLabel("Please select the Campaign(s) to Convert:");
    GridBagConstraints gbc = new GridBagConstraints();
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
    gbc.insets = new Insets(25, 25, 5, 25);
    panel.add(introLabel, gbc);
    final CampaignTableModel model = new CampaignTableModel(gameModeCampaigns, folderName);
    final JTable table = new JTable(model) {

        //Implement table cell tool tips.
        @Override
        public String getToolTipText(MouseEvent e) {
            java.awt.Point p = e.getPoint();
            int rowIndex = rowAtPoint(p);
            int colIndex = columnAtPoint(p);
            String tip = String.valueOf(getValueAt(rowIndex, colIndex));
            return tip;
        }
    };
    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent event) {
            pc.removeListFor(ListKey.CAMPAIGN);
            int[] selRows = table.getSelectedRows();
            if (selRows.length == 0) {
                saveSourceSelection(pc);
                fireProgressEvent(ProgressEvent.NOT_ALLOWED);
            } else {
                for (int row : selRows) {
                    Campaign selCampaign = (Campaign) model.getValueAt(row, 0);
                    pc.addToListFor(ListKey.CAMPAIGN, selCampaign);
                }
                saveSourceSelection(pc);
                fireProgressEvent(ProgressEvent.ALLOWED);
            }
        }
    });
    JScrollPane listScroller = new JScrollPane(table);
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, GridBagConstraints.REMAINDER, 1.0, 1.0);
    gbc.fill = GridBagConstraints.BOTH;
    panel.add(listScroller, gbc);
    initSourceSelection(model, table);
}
Also used : JScrollPane(javax.swing.JScrollPane) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) MouseEvent(java.awt.event.MouseEvent) GridBagLayout(java.awt.GridBagLayout) ListSelectionEvent(javax.swing.event.ListSelectionEvent) JLabel(javax.swing.JLabel) ListSelectionListener(javax.swing.event.ListSelectionListener) Campaign(pcgen.core.Campaign) JTable(javax.swing.JTable)

Example 98 with JScrollPane

use of javax.swing.JScrollPane in project pcgen by PCGen.

the class SummaryPanel method setupDisplay.

/**
	 * @see pcgen.gui2.converter.panel.ConvertSubPanel#setupDisplay(javax.swing.JPanel, pcgen.cdom.base.CDOMObject)
	 */
@Override
public void setupDisplay(JPanel panel, CDOMObject pc) {
    panel.setLayout(new GridBagLayout());
    JLabel introLabel = new JLabel("Ready to convert.");
    GridBagConstraints gbc = new GridBagConstraints();
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
    gbc.insets = new Insets(50, 25, 10, 25);
    panel.add(introLabel, gbc);
    JLabel instructLabel = new JLabel("Press Next to begin converting using the following settings:");
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
    gbc.insets = new Insets(10, 25, 20, 25);
    panel.add(instructLabel, gbc);
    JLabel[] labels = new JLabel[4];
    JComponent[] values = new JComponent[4];
    labels[0] = new JLabel("Source Folder:");
    labels[1] = new JLabel("Destination Folder:");
    labels[2] = new JLabel("Game mode:");
    labels[3] = new JLabel("Sources:");
    values[0] = new JLabel(pc.get(ObjectKey.DIRECTORY).getAbsolutePath());
    values[1] = new JLabel(pc.get(ObjectKey.WRITE_DIRECTORY).getAbsolutePath());
    values[2] = new JLabel(pc.get(ObjectKey.GAME_MODE).getDisplayName());
    List<Campaign> campaigns = pc.getSafeListFor(ListKey.CAMPAIGN);
    StringBuilder campDisplay = new StringBuilder();
    for (int i = 0; i < campaigns.size(); i++) {
        campDisplay.append(campaigns.get(i).getDisplayName());
        campDisplay.append("\n");
    }
    JTextArea campText = new JTextArea(campDisplay.toString());
    campText.setEditable(false);
    JScrollPane scrollPane = new JScrollPane(campText);
    values[3] = scrollPane;
    // Place the labels on the page and lay them out
    Font plainFont = FontManipulation.plain(panel.getFont());
    for (int i = 0; i < labels.length; i++) {
        Utility.buildRelativeConstraints(gbc, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
        gbc.insets = new Insets(10, 25, 10, 10);
        panel.add(labels[i], gbc);
        if (i < labels.length - 1) {
            Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
        } else {
            Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, GridBagConstraints.REMAINDER, 1.0, 1.0, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
        }
        gbc.insets = new Insets(10, 10, 10, 25);
        panel.add(values[i], gbc);
        values[i].setFont(plainFont);
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JTextArea(javax.swing.JTextArea) GridBagLayout(java.awt.GridBagLayout) JComponent(javax.swing.JComponent) JLabel(javax.swing.JLabel) Font(java.awt.Font) Campaign(pcgen.core.Campaign)

Example 99 with JScrollPane

use of javax.swing.JScrollPane in project pcgen by PCGen.

the class TableUtils method createToggleButtonSelectionPane.

private static JScrollPane createToggleButtonSelectionPane(JTable table, JTable rowheaderTable, JToggleButton button) {
    rowheaderTable.setAutoCreateColumnsFromModel(false);
    // force the tables to share models
    rowheaderTable.setModel(table.getModel());
    rowheaderTable.setSelectionModel(table.getSelectionModel());
    rowheaderTable.setRowHeight(table.getRowHeight());
    rowheaderTable.setIntercellSpacing(table.getIntercellSpacing());
    rowheaderTable.setShowGrid(false);
    rowheaderTable.setFocusable(false);
    TableColumn column = new TableColumn(-1);
    column.setHeaderValue(new Object());
    column.setCellRenderer(new TableCellUtilities.ToggleButtonRenderer(button));
    rowheaderTable.addColumn(column);
    rowheaderTable.setPreferredScrollableViewportSize(new Dimension(20, 0));
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setViewportView(table);
    scrollPane.setRowHeaderView(rowheaderTable);
    return scrollPane;
}
Also used : JScrollPane(javax.swing.JScrollPane) Dimension(java.awt.Dimension) TableColumn(javax.swing.table.TableColumn)

Example 100 with JScrollPane

use of javax.swing.JScrollPane in project pcgen by PCGen.

the class SummaryInfoTab method resetBasicsPanel.

private void resetBasicsPanel() {
    basicsPanel.removeAll();
    GridBagConstraints gbc = new GridBagConstraints();
    {
        //$NON-NLS-1$
        JLabel label = createLabel("in_sumName");
        gbc.anchor = java.awt.GridBagConstraints.WEST;
        gbc.insets = new Insets(0, 0, 3, 0);
        basicsPanel.add(label, gbc);
        //$NON-NLS-1$
        random.setText(LanguageBundle.getString("in_randomButton"));
        random.setMargin(new Insets(0, 0, 0, 0));
        gbc.insets = new Insets(0, 2, 3, 2);
        basicsPanel.add(random, gbc);
        gbc.insets = new Insets(0, 0, 3, 2);
        gbc.gridwidth = GridBagConstraints.REMAINDER;
        gbc.fill = GridBagConstraints.BOTH;
        gbc.weightx = 1.0;
        basicsPanel.add(characterNameField, gbc);
    }
    Insets insets = new Insets(0, 0, 3, 2);
    Font labelFont = null;
    //$NON-NLS-1$
    addGridBagLayer(basicsPanel, labelFont, insets, "in_sumCharType", characterTypeComboBox);
    //$NON-NLS-1$
    addGridBagLayer(basicsPanel, labelFont, insets, "in_sumPlayer", playerNameField);
    //$NON-NLS-1$
    addGridBagLayer(basicsPanel, labelFont, insets, "in_sumTabLabel", tabLabelField);
    if (genderComboBox.getModel().getSize() != 0) {
        //$NON-NLS-1$
        addGridBagLayer(basicsPanel, labelFont, insets, "in_sumGender", genderComboBox);
    }
    if (handsComboBox.getModel().getSize() != 0) {
        //$NON-NLS-1$
        addGridBagLayer(basicsPanel, labelFont, insets, "in_sumHanded", handsComboBox);
    }
    if (alignmentComboBox.getModel().getSize() != 0) {
        //$NON-NLS-1$
        addGridBagLayer(basicsPanel, labelFont, insets, "in_sumAlignment", alignmentComboBox);
    }
    if (deityComboBox.getModel().getSize() != 0) {
        //$NON-NLS-1$
        addGridBagLayer(basicsPanel, labelFont, insets, "in_domDeityLabel", deityComboBox);
    }
    gbc = new GridBagConstraints();
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weighty = 1;
    gbc.insets = new Insets(6, 2, 2, 2);
    langScroll = new JScrollPane(languageTable);
    basicsPanel.add(langScroll, gbc);
    basicsPanel.revalidate();
}
Also used : JScrollPane(javax.swing.JScrollPane) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JLabel(javax.swing.JLabel) Font(java.awt.Font)

Aggregations

JScrollPane (javax.swing.JScrollPane)657 JPanel (javax.swing.JPanel)335 JLabel (javax.swing.JLabel)210 Dimension (java.awt.Dimension)204 BorderLayout (java.awt.BorderLayout)193 JButton (javax.swing.JButton)169 JTable (javax.swing.JTable)126 BoxLayout (javax.swing.BoxLayout)125 ActionEvent (java.awt.event.ActionEvent)112 ActionListener (java.awt.event.ActionListener)95 GridBagLayout (java.awt.GridBagLayout)94 JTextArea (javax.swing.JTextArea)94 FlowLayout (java.awt.FlowLayout)81 Insets (java.awt.Insets)70 GridBagConstraints (java.awt.GridBagConstraints)65 FormLayout (com.jgoodies.forms.layout.FormLayout)57 JTextField (javax.swing.JTextField)53 Container (java.awt.Container)51 JFrame (javax.swing.JFrame)44 Color (java.awt.Color)38