Search in sources :

Example 61 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 62 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)

Example 63 with JScrollPane

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

the class SummaryInfoTab method initTodoPanel.

/**
	 * Initialise the "Things to be Done" panel. Creates the required components
	 * and places them in the panel.
	 *
	 * @param panel The panel to be initialised
	 */
private void initTodoPanel(JPanel panel) {
    panel.setLayout(new BorderLayout());
    todoPane.setOpaque(false);
    //$NON-NLS-1$
    todoPane.setContentType("text/html");
    // An HTMLDocument font size and family already defaults to the UI font default, no need to add that on top.
    //		String bodyRule =
    //				"body { font-family: " + textFont.getFamily() + "; " + "font-size: " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    //				textFont.getSize() + "pt; }"; //$NON-NLS-1$
    //		((HTMLDocument) todoPane.getDocument()).getStyleSheet().addRule(
    //				bodyRule);
    todoPane.setEditable(false);
    JScrollPane scroll = new JScrollPane(todoPane);
    scroll.setBorder(BorderFactory.createEmptyBorder());
    panel.add(scroll, BorderLayout.CENTER);
}
Also used : JScrollPane(javax.swing.JScrollPane) BorderLayout(java.awt.BorderLayout)

Example 64 with JScrollPane

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

the class PurchaseInfoTab method initComponents.

private void initComponents() {
    setOrientation(VERTICAL_SPLIT);
    //$NON-NLS-1$
    FlippingSplitPane splitPane = new FlippingSplitPane("PurchaseTop");
    splitPane.setOrientation(HORIZONTAL_SPLIT);
    {
        // Top Left panel
        FilterBar<CharacterFacade, EquipmentFacade> filterBar = new FilterBar<>();
        {
            // Filters
            filterBar.addDisplayableFilter(new SearchFilterPanel());
            FilterButton<CharacterFacade, EquipmentFacade> premadeFilter = //$NON-NLS-1$
            new FilterButton<>("EqQualified");
            //$NON-NLS-1$
            premadeFilter.setText(LanguageBundle.getString("in_igQualFilter"));
            premadeFilter.setFilter(CharacterFacade::isQualifiedFor);
            FilterButton<CharacterFacade, EquipmentFacade> customFilter = //$NON-NLS-1$
            new FilterButton<>("EqAffordable");
            //$NON-NLS-1$
            customFilter.setText(LanguageBundle.getString("in_igAffordFilter"));
            customFilter.setFilter(new Filter<CharacterFacade, EquipmentFacade>() {

                @Override
                public boolean accept(CharacterFacade context, EquipmentFacade element) {
                    return context.getInfoFactory().getCost(element) <= context.getFundsRef().get().floatValue();
                }
            });
            filterBar.addDisplayableFilter(premadeFilter);
            filterBar.addDisplayableFilter(customFilter);
        }
        JPanel panel = new JPanel(new BorderLayout());
        panel.add(filterBar, BorderLayout.NORTH);
        availableTable.setTreeCellRenderer(equipmentRenderer);
        availableTable.setDisplayableFilter(filterBar);
        panel.add(new JScrollPane(availableTable), BorderLayout.CENTER);
        Box box = Box.createHorizontalBox();
        box.add(Box.createHorizontalStrut(5));
        box.add(autoResizeBox);
        box.add(Box.createHorizontalGlue());
        addCustomButton.setHorizontalTextPosition(SwingConstants.LEADING);
        box.add(addCustomButton);
        box.add(Box.createHorizontalStrut(5));
        addEquipmentButton.setHorizontalTextPosition(SwingConstants.LEADING);
        box.add(addEquipmentButton);
        box.add(Box.createHorizontalStrut(5));
        box.setBorder(new EmptyBorder(0, 0, 5, 0));
        panel.add(box, BorderLayout.SOUTH);
        splitPane.setLeftComponent(panel);
    }
    {
        // Top Right panel
        FilterBar<CharacterFacade, EquipmentFacade> filterBar = new FilterBar<>();
        filterBar.addDisplayableFilter(new SearchFilterPanel());
        JPanel panel = new JPanel(new BorderLayout());
        panel.add(filterBar, BorderLayout.NORTH);
        purchasedTable.setDisplayableFilter(filterBar);
        purchasedTable.setTreeCellRenderer(equipmentRenderer);
        panel.add(new JScrollPane(purchasedTable), BorderLayout.CENTER);
        Box box = Box.createHorizontalBox();
        box.add(Box.createHorizontalStrut(5));
        box.add(removeEquipmentButton);
        box.add(Box.createHorizontalGlue());
        box.setBorder(new EmptyBorder(0, 0, 5, 0));
        panel.add(box, BorderLayout.SOUTH);
        splitPane.setRightComponent(panel);
    }
    setTopComponent(splitPane);
    //$NON-NLS-1$
    splitPane = new FlippingSplitPane("PurchaseBottom");
    splitPane.setOrientation(HORIZONTAL_SPLIT);
    {
        // Bottom Left Panel
        JPanel panel = new JPanel();
        initMoneyPanel(panel);
        splitPane.setLeftComponent(panel);
    }
    {
        // Bottom Right Panel
        //$NON-NLS-1$
        infoPane.setTitle(LanguageBundle.getString("in_igEqInfo"));
        splitPane.setRightComponent(infoPane);
    }
    splitPane.setResizeWeight(0.25);
    setResizeWeight(1);
    setBottomComponent(splitPane);
}
Also used : EquipmentFacade(pcgen.facade.core.EquipmentFacade) JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FilterButton(pcgen.gui2.filter.FilterButton) JComboBox(javax.swing.JComboBox) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox) FlippingSplitPane(pcgen.gui2.tools.FlippingSplitPane) CharacterFacade(pcgen.facade.core.CharacterFacade) FilterBar(pcgen.gui2.filter.FilterBar) BorderLayout(java.awt.BorderLayout) SearchFilterPanel(pcgen.gui2.filter.SearchFilterPanel) EmptyBorder(javax.swing.border.EmptyBorder)

Example 65 with JScrollPane

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

the class RaceInfoTab method initComponents.

private void initComponents() {
    FlippingSplitPane topPane = new FlippingSplitPane("RaceTop");
    setTopComponent(topPane);
    setOrientation(VERTICAL_SPLIT);
    JPanel availPanel = new JPanel(new BorderLayout());
    FilterBar<Object, RaceFacade> bar = new FilterBar<>();
    bar.addDisplayableFilter(new SearchFilterPanel());
    //$NON-NLS-1$
    noRacialHdFilterButton.setText(LanguageBundle.getString("in_irNoRacialHd"));
    //$NON-NLS-1$
    noRacialHdFilterButton.setToolTipText(LanguageBundle.getString("in_irNoRacialHdTip"));
    bar.addDisplayableFilter(noRacialHdFilterButton);
    //$NON-NLS-1$
    qFilterButton.setText(LanguageBundle.getString("in_igQualFilter"));
    bar.addDisplayableFilter(qFilterButton);
    raceTable.setDisplayableFilter(bar);
    availPanel.add(bar, BorderLayout.NORTH);
    raceTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    raceTable.setTreeCellRenderer(qualifiedRenderer);
    availPanel.add(new JScrollPane(raceTable), BorderLayout.CENTER);
    Box box = Box.createHorizontalBox();
    box.add(Box.createHorizontalGlue());
    selectRaceButton.setHorizontalTextPosition(SwingConstants.LEADING);
    box.add(selectRaceButton);
    box.add(Box.createHorizontalStrut(5));
    box.setBorder(new EmptyBorder(0, 0, 5, 0));
    availPanel.add(box, BorderLayout.SOUTH);
    topPane.setLeftComponent(availPanel);
    JPanel selPanel = new JPanel(new BorderLayout());
    FilterBar<Object, RaceFacade> filterBar = new FilterBar<>();
    filterBar.addDisplayableFilter(new SearchFilterPanel());
    selectedTable.setDisplayableFilter(filterBar);
    selectedTable.setTreeCellRenderer(qualifiedRenderer);
    JScrollPane scrollPane = new JScrollPane(selectedTable);
    selPanel.add(scrollPane, BorderLayout.CENTER);
    scrollPane.setPreferredSize(new Dimension(0, 0));
    box = Box.createHorizontalBox();
    box.add(Box.createHorizontalStrut(5));
    box.add(removeButton);
    box.add(Box.createHorizontalGlue());
    box.setBorder(new EmptyBorder(0, 0, 5, 0));
    selPanel.add(box, BorderLayout.SOUTH);
    topPane.setRightComponent(selPanel);
    topPane.setResizeWeight(0.75);
    setBottomComponent(infoPane);
    setResizeWeight(0.75);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FilterBar(pcgen.gui2.filter.FilterBar) BorderLayout(java.awt.BorderLayout) Box(javax.swing.Box) SearchFilterPanel(pcgen.gui2.filter.SearchFilterPanel) Dimension(java.awt.Dimension) EmptyBorder(javax.swing.border.EmptyBorder) FlippingSplitPane(pcgen.gui2.tools.FlippingSplitPane) RaceFacade(pcgen.facade.core.RaceFacade)

Aggregations

JScrollPane (javax.swing.JScrollPane)832 JPanel (javax.swing.JPanel)431 Dimension (java.awt.Dimension)271 JLabel (javax.swing.JLabel)269 BorderLayout (java.awt.BorderLayout)260 JButton (javax.swing.JButton)191 GridBagLayout (java.awt.GridBagLayout)149 JTable (javax.swing.JTable)148 BoxLayout (javax.swing.BoxLayout)140 Insets (java.awt.Insets)122 GridBagConstraints (java.awt.GridBagConstraints)121 ActionEvent (java.awt.event.ActionEvent)120 JTextArea (javax.swing.JTextArea)110 ActionListener (java.awt.event.ActionListener)103 FlowLayout (java.awt.FlowLayout)96 JTextField (javax.swing.JTextField)70 FormLayout (com.jgoodies.forms.layout.FormLayout)60 Container (java.awt.Container)55 JSplitPane (javax.swing.JSplitPane)55 MouseEvent (java.awt.event.MouseEvent)52