Search in sources :

Example 16 with JPanel

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

the class SummaryInfoTab method initRightPanel.

private void initRightPanel(JPanel rightPanel) {
    rightPanel.setLayout(new GridBagLayout());
    /*
		 * initialize Components
		 */
    racePanel.setOpaque(false);
    classPanel.setOpaque(false);
    ageField.setHorizontalAlignment(SwingConstants.RIGHT);
    expField.setHorizontalAlignment(SwingConstants.RIGHT);
    nextlevelField.setHorizontalAlignment(SwingConstants.RIGHT);
    nextlevelField.setEnabled(false);
    expmodField.setHorizontalAlignment(SwingConstants.RIGHT);
    //$NON-NLS-1$
    raceComboBox.setPrototypeDisplayValue("PrototypeDisplayValue");
    //$NON-NLS-1$
    classComboBox.setPrototypeDisplayValue("PrototypeDisplayValue");
    expaddButton.setMargin(new Insets(0, 8, 0, 8));
    expsubtractButton.setMargin(new Insets(0, 8, 0, 8));
    hpButton.setMargin(new Insets(0, 0, 0, 0));
    JPanel expmodPanel = new JPanel(new GridBagLayout());
    JPanel levelPanel = new JPanel();
    //$NON-NLS-1$
    JLabel raceLabel = createLabel("in_sumRace");
    //$NON-NLS-1$
    JLabel ageLabel = createLabel("in_sumAge");
    //$NON-NLS-1$
    JLabel classLabel = createLabel("in_sumClass");
    //$NON-NLS-1$
    JLabel hpLabel = createLabel("in_sumTotalHP");
    //$NON-NLS-1$
    JLabel expLabel = createLabel("in_sumCurrentXp");
    //$NON-NLS-1$
    JLabel nextlevelLabel = createLabel("in_sumNextlevel");
    //$NON-NLS-1$
    JLabel xpTableLabel = createLabel("in_sumXpTable");
    //$NON-NLS-1$
    JLabel expmodLabel = createLabel("in_sumExpMod");
    expmodLabel.setHorizontalAlignment(SwingConstants.CENTER);
    initLevelPanel(levelPanel);
    /*
		 * initialize constant variables
		 */
    Insets racePanelInsets = racePanel.getInsets();
    Insets classPanelInsets = classPanel.getInsets();
    /*
		 * racePanel
		 */
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(racePanelInsets.top, racePanelInsets.left, 0, 0);
    gbc.gridwidth = 2;
    rightPanel.add(raceLabel, gbc);
    gbc.insets = new Insets(racePanelInsets.top, 1, 1, racePanelInsets.right);
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    rightPanel.add(raceComboBox, gbc);
    gbc.insets = new Insets(0, racePanelInsets.left, 0, 1);
    gbc.gridwidth = 1;
    rightPanel.add(ageLabel, gbc);
    gbc.insets = new Insets(1, 1, 1, 1);
    rightPanel.add(ageField, gbc);
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.insets = new Insets(1, 1, 1, racePanelInsets.right);
    rightPanel.add(ageComboBox, gbc);
    gbc.insets = new Insets(1, racePanelInsets.left, racePanelInsets.bottom, racePanelInsets.right);
    rightPanel.add(createMonsterButton, gbc);
    /*
		 * classPanel
		 */
    gbc.gridwidth = 2;
    gbc.insets = new Insets(classPanelInsets.top, classPanelInsets.left, 0, 0);
    rightPanel.add(classLabel, gbc);
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.insets = new Insets(classPanelInsets.top, 0, 0, classPanelInsets.right);
    rightPanel.add(classComboBox, gbc);
    gbc.weighty = 1;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(7, classPanelInsets.left, 0, classPanelInsets.right);
    rightPanel.add(levelPanel, gbc);
    gbc.insets.top = 0;
    gbc.insets.bottom = 10;
    gbc.weighty = 0;
    {
        JPanel hpPanel = new JPanel(new FlowLayout());
        hpPanel.add(hpLabel);
        hpPanel.add(Box.createHorizontalStrut(3));
        hpPanel.add(totalHPLabel);
        hpPanel.add(hpButton);
        rightPanel.add(hpPanel, gbc);
    }
    gbc.insets.bottom = 0;
    //gbc.ipady = 20;
    GridBagConstraints leftgbc = new GridBagConstraints();
    leftgbc.insets = new Insets(0, classPanelInsets.left, 0, 0);
    leftgbc.gridwidth = 2;
    leftgbc.fill = GridBagConstraints.BOTH;
    GridBagConstraints rightgbc = new GridBagConstraints();
    rightgbc.insets = new Insets(0, 0, 0, classPanelInsets.right);
    rightgbc.gridwidth = GridBagConstraints.REMAINDER;
    rightgbc.fill = GridBagConstraints.BOTH;
    rightPanel.add(expLabel, leftgbc);
    rightPanel.add(expField, rightgbc);
    rightPanel.add(nextlevelLabel, leftgbc);
    rightPanel.add(nextlevelField, rightgbc);
    rightPanel.add(xpTableLabel, leftgbc);
    rightPanel.add(xpTableComboBox, rightgbc);
    gbc.insets.top = 10;
    rightPanel.add(expmodLabel, gbc);
    {
        GridBagConstraints gbc2 = new GridBagConstraints();
        gbc2.fill = GridBagConstraints.HORIZONTAL;
        gbc2.weightx = 1.0;
        gbc2.insets = new Insets(0, 1, 0, 1);
        expmodPanel.add(expaddButton, gbc2);
        expmodPanel.add(expsubtractButton, gbc2);
    }
    leftgbc.insets.bottom = classPanelInsets.bottom;
    leftgbc.weightx = 0.3;
    rightPanel.add(expmodPanel, leftgbc);
    rightgbc.insets.bottom = classPanelInsets.bottom;
    rightgbc.weightx = 0.7;
    rightPanel.add(expmodField, rightgbc);
    gbc = new GridBagConstraints();
    gbc.gridx = gbc.gridy = 0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.gridheight = 3;
    gbc.fill = GridBagConstraints.BOTH;
    rightPanel.add(racePanel, gbc);
    gbc.gridy = 3;
    gbc.gridheight = GridBagConstraints.REMAINDER;
    rightPanel.add(classPanel, gbc);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel)

Example 17 with JPanel

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

the class SummaryInfoTab method initComponents.

private void initComponents() {
    this.setFocusCycleRoot(true);
    this.setFocusTraversalPolicyProvider(true);
    this.setFocusTraversalPolicy(new SummaryTabFocusTraversalPolicy());
    LanguageTableModel.initializeTable(languageTable);
    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    //$NON-NLS-1$
    setPanelTitle(basicsPanel, LanguageBundle.getString("in_sumCharacterBasics"));
    basicsPanel.setLayout(new GridBagLayout());
    deityComboBox.setRenderer(infoBoxRenderer);
    raceComboBox.setRenderer(infoBoxRenderer);
    classComboBox.setRenderer(classBoxRenderer);
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 0.1;
    gbc.weighty = 0.7;
    add(basicsPanel, gbc);
    //$NON-NLS-1$
    setPanelTitle(todoPanel, LanguageBundle.getString("in_tipsString"));
    initTodoPanel(todoPanel);
    gbc.gridy = 1;
    gbc.gridheight = GridBagConstraints.REMAINDER;
    add(todoPanel, gbc);
    initMiddlePanel(scoresPanel);
    gbc.gridy = GridBagConstraints.RELATIVE;
    gbc.weightx = 1;
    add(scoresPanel, gbc);
    JPanel rightPanel = new JPanel();
    //$NON-NLS-1$
    setPanelTitle(racePanel, LanguageBundle.getString("in_raceString"));
    //$NON-NLS-1$
    setPanelTitle(classPanel, LanguageBundle.getString("in_sumClassLevel"));
    initRightPanel(rightPanel);
    gbc.weightx = 0.1;
    gbc.weighty = 1;
    add(rightPanel, gbc);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout)

Example 18 with JPanel

use of javax.swing.JPanel 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 19 with JPanel

use of javax.swing.JPanel 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)

Example 20 with JPanel

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

the class AbilityChooserTab method initComponents.

private void initComponents() {
    setOrientation(VERTICAL_SPLIT);
    availableTreeViewPanel.setDefaultRenderer(Boolean.class, new BooleanRenderer());
    availableTreeViewPanel.setTreeCellRenderer(qualifiedRenderer);
    selectedTreeViewPanel.setTreeCellRenderer(abilityRenderer);
    FilterBar<CharacterFacade, AbilityFacade> filterBar = new FilterBar<>();
    filterBar.addDisplayableFilter(new SearchFilterPanel());
    //$NON-NLS-1$
    qFilterButton.setText(LanguageBundle.getString("in_igQualFilter"));
    filterBar.addDisplayableFilter(qFilterButton);
    JPanel availPanel = FilterUtilities.configureFilteredTreeViewPane(availableTreeViewPanel, filterBar);
    Box box = Box.createHorizontalBox();
    box.add(Box.createHorizontalGlue());
    addButton.setHorizontalTextPosition(SwingConstants.LEADING);
    box.add(addButton);
    box.add(Box.createHorizontalStrut(5));
    box.setBorder(new EmptyBorder(0, 0, 5, 0));
    availPanel.add(box, BorderLayout.SOUTH);
    JPanel selPanel = new JPanel(new BorderLayout());
    selPanel.add(new JScrollPane(selectedTreeViewPanel), BorderLayout.CENTER);
    AbilityTreeTableModel.initializeTreeTable(selectedTreeViewPanel);
    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);
    FlippingSplitPane topPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, availPanel, selPanel, "abilityTop");
    setTopComponent(topPane);
    FilterButton<CharacterFacade, AbilityCategoryFacade> gainedFilterButton = new FilterButton<>("AbilityGained", true);
    //$NON-NLS-1$
    gainedFilterButton.setText(LanguageBundle.getString("in_gained"));
    gainedFilterButton.setEnabled(true);
    gainedFilterButton.setFilter(new Filter<CharacterFacade, AbilityCategoryFacade>() {

        @Override
        public boolean accept(CharacterFacade context, AbilityCategoryFacade element) {
            return context.getActiveAbilityCategories().containsElement(element);
        }
    });
    categoryBar.addDisplayableFilter(gainedFilterButton);
    JPanel filterPanel = new JPanel(new BorderLayout());
    filterPanel.add(categoryBar, BorderLayout.NORTH);
    filterPanel.add(new JScrollPane(categoryTable), BorderLayout.CENTER);
    FlippingSplitPane bottomPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, "abilityBottom");
    bottomPane.setLeftComponent(filterPanel);
    bottomPane.setRightComponent(infoPane);
    setBottomComponent(bottomPane);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) AbilityCategoryFacade(pcgen.facade.core.AbilityCategoryFacade) FilterButton(pcgen.gui2.filter.FilterButton) Box(javax.swing.Box) CharacterFacade(pcgen.facade.core.CharacterFacade) FlippingSplitPane(pcgen.gui2.tools.FlippingSplitPane) FilterBar(pcgen.gui2.filter.FilterBar) BorderLayout(java.awt.BorderLayout) AbilityFacade(pcgen.facade.core.AbilityFacade) SearchFilterPanel(pcgen.gui2.filter.SearchFilterPanel) EmptyBorder(javax.swing.border.EmptyBorder)

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