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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations