Search in sources :

Example 36 with JPanel

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

the class SpellsKnownTab method initComponents.

private void initComponents() {
    availableTable.setTreeCellRenderer(spellRenderer);
    selectedTable.setTreeCellRenderer(spellRenderer);
    selectedTable.setRowSorter(new SortableTableRowSorter() {

        @Override
        public SortableTableModel getModel() {
            return (SortableTableModel) selectedTable.getModel();
        }
    });
    selectedTable.getRowSorter().toggleSortOrder(0);
    FilterBar<CharacterFacade, SuperNode> filterBar = new FilterBar<>();
    filterBar.addDisplayableFilter(new SearchFilterPanel());
    //$NON-NLS-1$
    qFilterButton.setText(LanguageBundle.getString("in_igQualFilter"));
    filterBar.addDisplayableFilter(qFilterButton);
    FlippingSplitPane upperPane = new FlippingSplitPane("SpellsKnownTop");
    JPanel availPanel = FilterUtilities.configureFilteredTreeViewPane(availableTable, filterBar);
    Box box = Box.createVerticalBox();
    box.add(Box.createVerticalStrut(2));
    {
        Box hbox = Box.createHorizontalBox();
        hbox.add(Box.createHorizontalStrut(5));
        hbox.add(autoKnownBox);
        hbox.add(Box.createHorizontalGlue());
        box.add(hbox);
    }
    //box.add(Box.createVerticalStrut(2));
    {
        Box hbox = Box.createHorizontalBox();
        hbox.add(Box.createHorizontalStrut(5));
        hbox.add(slotsBox);
        hbox.add(Box.createHorizontalGlue());
        hbox.add(Box.createHorizontalStrut(10));
        hbox.add(addButton);
        hbox.add(Box.createHorizontalStrut(5));
        box.add(hbox);
    }
    box.add(Box.createVerticalStrut(5));
    availPanel.add(box, BorderLayout.SOUTH);
    upperPane.setLeftComponent(availPanel);
    box = Box.createVerticalBox();
    box.add(new JScrollPane(selectedTable));
    box.add(Box.createVerticalStrut(4));
    {
        Box hbox = Box.createHorizontalBox();
        hbox.add(Box.createHorizontalStrut(5));
        hbox.add(removeButton);
        hbox.add(Box.createHorizontalStrut(10));
        JButton spellSheetButton = new JButton(LanguageBundle.getString("InfoSpells.select.spellsheet"));
        spellSheetButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                selectSpellSheetButton();
            }
        });
        hbox.add(spellSheetButton);
        hbox.add(Box.createHorizontalStrut(3));
        String text = PCGenSettings.getSelectedSpellSheet();
        if (text != null) {
            text = new File(text).getName();
        }
        spellSheetField.setEditable(false);
        spellSheetField.setText(text);
        spellSheetField.setToolTipText(text);
        hbox.add(spellSheetField);
        hbox.add(Box.createHorizontalStrut(3));
        previewSpellsButton = new JButton(Icons.PrintPreview16.getImageIcon());
        hbox.add(previewSpellsButton);
        hbox.add(Box.createHorizontalStrut(3));
        exportSpellsButton = new JButton(Icons.Print16.getImageIcon());
        hbox.add(exportSpellsButton);
        hbox.add(Box.createHorizontalStrut(5));
        box.add(hbox);
    }
    box.add(Box.createVerticalStrut(5));
    upperPane.setRightComponent(box);
    upperPane.setResizeWeight(0);
    setTopComponent(upperPane);
    FlippingSplitPane bottomPane = new FlippingSplitPane("SpellsKnownBottom");
    bottomPane.setLeftComponent(spellsPane);
    bottomPane.setRightComponent(classPane);
    setBottomComponent(bottomPane);
    setOrientation(VERTICAL_SPLIT);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) SuperNode(pcgen.facade.core.SpellSupportFacade.SuperNode) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) SortableTableRowSorter(pcgen.gui2.util.table.SortableTableRowSorter) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox) SortableTableModel(pcgen.gui2.util.table.SortableTableModel) CharacterFacade(pcgen.facade.core.CharacterFacade) FlippingSplitPane(pcgen.gui2.tools.FlippingSplitPane) FilterBar(pcgen.gui2.filter.FilterBar) ActionListener(java.awt.event.ActionListener) SearchFilterPanel(pcgen.gui2.filter.SearchFilterPanel) File(java.io.File)

Example 37 with JPanel

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

the class SpellsPreparedTab method initComponents.

private void initComponents() {
    availableTable.setTreeCellRenderer(spellRenderer);
    selectedTable.setTreeCellRenderer(spellRenderer);
    selectedTable.setRowSorter(new SortableTableRowSorter() {

        @Override
        public SortableTableModel getModel() {
            return (SortableTableModel) selectedTable.getModel();
        }
    });
    selectedTable.getRowSorter().toggleSortOrder(0);
    FilterBar<CharacterFacade, SuperNode> filterBar = new FilterBar<>();
    filterBar.addDisplayableFilter(new SearchFilterPanel());
    //$NON-NLS-1$
    qFilterButton.setText(LanguageBundle.getString("in_igQualFilter"));
    filterBar.addDisplayableFilter(qFilterButton);
    FlippingSplitPane upperPane = new FlippingSplitPane("SpellsPreparedTop");
    JPanel availPanel = FilterUtilities.configureFilteredTreeViewPane(availableTable, filterBar);
    Box box = Box.createVerticalBox();
    box.add(Box.createVerticalStrut(5));
    {
        Box hbox = Box.createHorizontalBox();
        addMMSpellButton.setHorizontalTextPosition(SwingConstants.LEADING);
        hbox.add(addMMSpellButton);
        box.add(hbox);
    }
    box.add(Box.createVerticalStrut(2));
    {
        Box hbox = Box.createHorizontalBox();
        hbox.add(Box.createHorizontalStrut(5));
        hbox.add(slotsBox);
        hbox.add(Box.createHorizontalGlue());
        hbox.add(Box.createHorizontalStrut(10));
        hbox.add(addSpellButton);
        hbox.add(Box.createHorizontalStrut(5));
        box.add(hbox);
    }
    box.add(Box.createVerticalStrut(5));
    availPanel.add(box, BorderLayout.SOUTH);
    upperPane.setLeftComponent(availPanel);
    box = Box.createVerticalBox();
    box.add(new JScrollPane(selectedTable));
    box.add(Box.createVerticalStrut(4));
    {
        Box hbox = Box.createHorizontalBox();
        hbox.add(Box.createHorizontalStrut(5));
        hbox.add(removeSpellButton);
        hbox.add(Box.createHorizontalStrut(10));
        hbox.add(new JLabel(LanguageBundle.getString("InfoPreparedSpells.preparedList")));
        hbox.add(Box.createHorizontalStrut(3));
        hbox.add(spellListField);
        hbox.add(Box.createHorizontalStrut(3));
        hbox.add(addSpellListButton);
        hbox.add(Box.createHorizontalStrut(3));
        hbox.add(removeSpellListButton);
        hbox.add(Box.createHorizontalStrut(5));
        box.add(hbox);
    }
    box.add(Box.createVerticalStrut(5));
    upperPane.setRightComponent(box);
    upperPane.setResizeWeight(0);
    setTopComponent(upperPane);
    FlippingSplitPane bottomPane = new FlippingSplitPane("SpellsPreparedBottom");
    bottomPane.setLeftComponent(spellsPane);
    bottomPane.setRightComponent(classPane);
    setBottomComponent(bottomPane);
    setOrientation(VERTICAL_SPLIT);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) SuperNode(pcgen.facade.core.SpellSupportFacade.SuperNode) JLabel(javax.swing.JLabel) SortableTableRowSorter(pcgen.gui2.util.table.SortableTableRowSorter) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox) SortableTableModel(pcgen.gui2.util.table.SortableTableModel) CharacterFacade(pcgen.facade.core.CharacterFacade) FlippingSplitPane(pcgen.gui2.tools.FlippingSplitPane) FilterBar(pcgen.gui2.filter.FilterBar) SearchFilterPanel(pcgen.gui2.filter.SearchFilterPanel)

Example 38 with JPanel

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

the class PreferencesPluginsPanel method getCenter.

@Override
protected JComponent getCenter() {
    DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Root");
    DefaultMutableTreeNode characterNode;
    DefaultMutableTreeNode pcGenNode;
    DefaultMutableTreeNode appearanceNode;
    DefaultMutableTreeNode gameModeNode;
    panelList = new ArrayList<>(15);
    // Build the settings panel
    settingsPanel = new JPanel();
    settingsPanel.setLayout(new CardLayout());
    settingsPanel.setPreferredSize(new Dimension(780, 420));
    // Build the selection tree
    characterNode = new DefaultMutableTreeNode(in_character);
    settingsPanel.add(buildEmptyPanel("", LanguageBundle.getString("in_Prefs_charTip")), in_character);
    characterStatsPanel = new CharacterStatsPanel(this);
    addPanelToTree(characterNode, characterStatsPanel);
    hitPointsPanel = new HitPointsPanel();
    addPanelToTree(characterNode, hitPointsPanel);
    houseRulesPanel = new HouseRulesPanel();
    addPanelToTree(characterNode, houseRulesPanel);
    monsterPanel = new MonsterPanel();
    addPanelToTree(characterNode, monsterPanel);
    defaultsPanel = new DefaultsPanel();
    addPanelToTree(characterNode, defaultsPanel);
    rootNode.add(characterNode);
    appearanceNode = new DefaultMutableTreeNode(in_appearance);
    settingsPanel.add(buildEmptyPanel("", LanguageBundle.getString("in_Prefs_appearanceTip")), in_appearance);
    colorsPanel = new ColorsPanel();
    addPanelToTree(appearanceNode, colorsPanel);
    displayOptionsPanel = new DisplayOptionsPanel();
    addPanelToTree(appearanceNode, displayOptionsPanel);
    levelUpPanel = new LevelUpPanel();
    addPanelToTree(appearanceNode, levelUpPanel);
    lookAndFeelPanel = new LookAndFeelPanel(this);
    addPanelToTree(appearanceNode, lookAndFeelPanel);
    //		tabsPanel = new TabsPanel();
    //		addPanelToTree(appearanceNode, tabsPanel);
    rootNode.add(appearanceNode);
    pcGenNode = new DefaultMutableTreeNode(Constants.APPLICATION_NAME);
    settingsPanel.add(buildEmptyPanel("", LanguageBundle.getString("in_Prefs_pcgenTip")), Constants.APPLICATION_NAME);
    equipmentPanel = new EquipmentPanel();
    addPanelToTree(pcGenNode, equipmentPanel);
    languagePanel = new LanguagePanel();
    addPanelToTree(pcGenNode, languagePanel);
    locationPanel = new LocationPanel();
    addPanelToTree(pcGenNode, locationPanel);
    inputPanel = new InputPanel();
    addPanelToTree(pcGenNode, inputPanel);
    outputPanel = new OutputPanel();
    addPanelToTree(pcGenNode, outputPanel);
    sourcesPanel = new SourcesPanel();
    addPanelToTree(pcGenNode, sourcesPanel);
    rootNode.add(pcGenNode);
    String in_gamemode = LanguageBundle.getString("in_mnuSettingsCampaign");
    gameModeNode = new DefaultMutableTreeNode(in_gamemode);
    settingsPanel.add(buildEmptyPanel("", LanguageBundle.getString("in_mnuSettingsCampaignTip")), in_gamemode);
    copySettingsPanel = new CopySettingsPanel();
    addPanelToTree(gameModeNode, copySettingsPanel);
    rootNode.add(gameModeNode);
    DefaultMutableTreeNode pluginNode = new DefaultMutableTreeNode(//$NON-NLS-1$
    LanguageBundle.getString("in_Prefs_plugins"));
    addPluginPanes(rootNode, pluginNode);
    settingsModel = new DefaultTreeModel(rootNode);
    settingsTree = new JTree(settingsModel);
    settingsTree.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0));
    settingsTree.setRootVisible(false);
    settingsTree.setShowsRootHandles(true);
    settingsTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    settingsScroll = new JScrollPane(settingsTree, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    // Turn off the icons
    DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
    renderer.setLeafIcon(null);
    renderer.setOpenIcon(null);
    renderer.setClosedIcon(null);
    settingsTree.setCellRenderer(renderer);
    // Expand all of the branch nodes
    settingsTree.expandPath(new TreePath(characterNode.getPath()));
    settingsTree.expandPath(new TreePath(pcGenNode.getPath()));
    settingsTree.expandPath(new TreePath(appearanceNode.getPath()));
    settingsTree.expandPath(new TreePath(gameModeNode.getPath()));
    settingsTree.expandPath(new TreePath(pluginNode.getPath()));
    // Add the listener which switches panels when a node of the tree is selected
    settingsTree.addTreeSelectionListener(new TreeSelectionListener() {

        @Override
        public void valueChanged(TreeSelectionEvent e) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) settingsTree.getLastSelectedPathComponent();
            if (node == null) {
                return;
            }
            CardLayout cl = (CardLayout) (settingsPanel.getLayout());
            cl.show(settingsPanel, String.valueOf(node));
        }
    });
    // Build the split pane
    splitPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, settingsScroll, settingsPanel, "Prefs");
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerSize(10);
    return splitPane;
}
Also used : JPanel(javax.swing.JPanel) LocationPanel(pcgen.gui2.prefs.LocationPanel) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) SourcesPanel(pcgen.gui2.prefs.SourcesPanel) OutputPanel(pcgen.gui2.prefs.OutputPanel) TreeSelectionListener(javax.swing.event.TreeSelectionListener) HitPointsPanel(pcgen.gui2.prefs.HitPointsPanel) CopySettingsPanel(pcgen.gui2.prefs.CopySettingsPanel) DefaultTreeCellRenderer(javax.swing.tree.DefaultTreeCellRenderer) HouseRulesPanel(pcgen.gui2.prefs.HouseRulesPanel) DisplayOptionsPanel(pcgen.gui2.prefs.DisplayOptionsPanel) LevelUpPanel(pcgen.gui2.prefs.LevelUpPanel) ColorsPanel(pcgen.gui2.prefs.ColorsPanel) LanguagePanel(pcgen.gui2.prefs.LanguagePanel) EquipmentPanel(pcgen.gui2.prefs.EquipmentPanel) JScrollPane(javax.swing.JScrollPane) CardLayout(java.awt.CardLayout) CharacterStatsPanel(pcgen.gui2.prefs.CharacterStatsPanel) InputPanel(pcgen.gui2.prefs.InputPanel) Dimension(java.awt.Dimension) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) FlippingSplitPane(pcgen.gui2.tools.FlippingSplitPane) JTree(javax.swing.JTree) DefaultsPanel(pcgen.gui2.prefs.DefaultsPanel) TreePath(javax.swing.tree.TreePath) MonsterPanel(pcgen.gui2.prefs.MonsterPanel) LookAndFeelPanel(pcgen.gui2.prefs.LookAndFeelPanel) TreeSelectionEvent(javax.swing.event.TreeSelectionEvent)

Example 39 with JPanel

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

the class PreferencesPluginsPanel method initComponents.

private void initComponents() {
    jScrollPane1 = new JScrollPane();
    mainPanel = new JPanel();
    setLayout(new BorderLayout());
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    for (String key : pluginMap.keySet()) {
        mainPanel.add(pluginMap.get(key));
    }
    jScrollPane1.setViewportView(mainPanel);
    add(jScrollPane1, BorderLayout.CENTER);
    //$NON-NLS-1$
    add(new JLabel(LanguageBundle.getString("in_Prefs_restartInfo")), BorderLayout.SOUTH);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel)

Example 40 with JPanel

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

the class PrintPreviewDialog method initLayout.

private void initLayout() {
    Container pane = getContentPane();
    pane.setLayout(new BorderLayout());
    {
        //layout top bar
        JPanel bar = new JPanel(new GridBagLayout());
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.anchor = GridBagConstraints.BASELINE;
        gbc.insets = new Insets(8, 6, 8, 2);
        bar.add(new JLabel("Select Template:"), gbc);
        gbc.insets = new Insets(8, 2, 8, 6);
        gbc.weightx = 1;
        bar.add(sheetBox, gbc);
        pane.add(bar, BorderLayout.NORTH);
    }
    {
        Box vbox = Box.createVerticalBox();
        previewPanelParent.setPreferredSize(new Dimension(600, 800));
        vbox.add(previewPanelParent);
        vbox.add(progressBar);
        pane.add(vbox, BorderLayout.CENTER);
    }
    {
        Box hbox = Box.createHorizontalBox();
        hbox.add(new JLabel("Page:"));
        hbox.add(Box.createHorizontalStrut(4));
        hbox.add(pageBox);
        hbox.add(Box.createHorizontalStrut(10));
        hbox.add(new JLabel("Zoom:"));
        hbox.add(Box.createHorizontalStrut(4));
        hbox.add(zoomBox);
        hbox.add(Box.createHorizontalStrut(5));
        hbox.add(zoomInButton);
        hbox.add(Box.createHorizontalStrut(5));
        hbox.add(zoomOutButton);
        hbox.add(Box.createHorizontalGlue());
        hbox.add(printButton);
        hbox.add(Box.createHorizontalStrut(5));
        hbox.add(cancelButton);
        hbox.setBorder(BorderFactory.createEmptyBorder(8, 5, 8, 5));
        pane.add(hbox, BorderLayout.SOUTH);
    }
}
Also used : JPanel(javax.swing.JPanel) Container(java.awt.Container) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) BorderLayout(java.awt.BorderLayout) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) JComboBox(javax.swing.JComboBox) Box(javax.swing.Box) Dimension(java.awt.Dimension)

Aggregations

JPanel (javax.swing.JPanel)4464 JLabel (javax.swing.JLabel)1842 BorderLayout (java.awt.BorderLayout)1454 JButton (javax.swing.JButton)1174 Dimension (java.awt.Dimension)1097 GridBagLayout (java.awt.GridBagLayout)1071 ActionEvent (java.awt.event.ActionEvent)1013 GridBagConstraints (java.awt.GridBagConstraints)954 JScrollPane (javax.swing.JScrollPane)901 ActionListener (java.awt.event.ActionListener)865 BoxLayout (javax.swing.BoxLayout)792 Insets (java.awt.Insets)724 FlowLayout (java.awt.FlowLayout)667 JTextField (javax.swing.JTextField)532 JCheckBox (javax.swing.JCheckBox)456 GridLayout (java.awt.GridLayout)375 JComboBox (javax.swing.JComboBox)268 EmptyBorder (javax.swing.border.EmptyBorder)252 JTable (javax.swing.JTable)224 Color (java.awt.Color)210