use of java.awt.GridBagConstraints 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 java.awt.GridBagConstraints in project pcgen by PCGen.
the class SummaryInfoTab method addGridBagLayer.
private void addGridBagLayer(JPanel panel, Font font, Insets insets, String text, JComponent comp) {
GridBagConstraints gbc = new GridBagConstraints();
JLabel label = new JLabel(LanguageBundle.getString(text));
label.setFont(font);
gbc.anchor = java.awt.GridBagConstraints.WEST;
gbc.gridwidth = 2;
panel.add(label, gbc);
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.fill = GridBagConstraints.BOTH;
if (insets != null) {
gbc.insets = insets;
}
panel.add(comp, gbc);
}
use of java.awt.GridBagConstraints 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 java.awt.GridBagConstraints 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();
}
use of java.awt.GridBagConstraints in project pcgen by PCGen.
the class SkillInfoTab method initComponents.
private void initComponents() {
setOrientation(VERTICAL_SPLIT);
setResizeWeight(0.70);
JSpinner spinner = new JSpinner();
//$NON-NLS-1$
spinner.setEditor(new JSpinner.NumberEditor(spinner, "#0.#"));
skillTable.setDefaultRenderer(Float.class, new SpinnerRenderer(spinner));
skillTable.setDefaultRenderer(Integer.class, new TableCellUtilities.AlignRenderer(SwingConstants.CENTER));
skillTable.setDefaultRenderer(String.class, new TableCellUtilities.AlignRenderer(SwingConstants.CENTER));
skillTable.setRowHeight(26);
FilterBar<CharacterFacade, SkillFacade> filterBar = new FilterBar<>();
filterBar.addDisplayableFilter(new SearchFilterPanel());
//$NON-NLS-1$
cFilterButton.setText(LanguageBundle.getString("in_classString"));
cFilterButton.setEnabled(false);
filterBar.addDisplayableFilter(cFilterButton);
//$NON-NLS-1$
trainedFilterButton.setText(LanguageBundle.getString("in_trained"));
trainedFilterButton.setEnabled(false);
filterBar.addDisplayableFilter(trainedFilterButton);
JPanel availPanel = FilterUtilities.configureFilteredTreeViewPane(skillTable, filterBar);
availPanel.setPreferredSize(new Dimension(650, 300));
JScrollPane tableScrollPane;
JPanel tablePanel = new JPanel(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
constraints.fill = java.awt.GridBagConstraints.BOTH;
constraints.weightx = 1.0;
constraints.ipady = 0;
constraints.weighty = 1.0;
SkillPointTableModel.initializeTable(skillpointTable);
tableScrollPane = new JScrollPane(skillpointTable);
tablePanel.add(tableScrollPane, constraints);
htmlPane.setOpaque(false);
htmlPane.setEditable(false);
htmlPane.setFocusable(false);
//$NON-NLS-1$
htmlPane.setContentType("text/html");
skillFilterBox.setRenderer(new DefaultListCellRenderer());
JScrollPane selScrollPane = new JScrollPane(htmlPane);
JPanel skillPanel = new JPanel(new BorderLayout());
skillPanel.add(skillFilterBox, BorderLayout.NORTH);
skillPanel.add(selScrollPane, BorderLayout.CENTER);
selScrollPane.setPreferredSize(new Dimension(530, 300));
FlippingSplitPane topPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, availPanel, skillPanel, "SkillTop");
setTopComponent(topPane);
FlippingSplitPane bottomPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, "SkillBottom");
bottomPane.setLeftComponent(tablePanel);
tablePanel.setPreferredSize(new Dimension(650, 100));
bottomPane.setRightComponent(infoPane);
infoPane.setPreferredSize(new Dimension(530, 100));
setBottomComponent(bottomPane);
}
Aggregations