use of javax.swing.border.TitledBorder in project pcgen by PCGen.
the class CharacterStatsPanel method initComponents.
/**
* Build and initialise the user interface.
*/
private void initComponents() {
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
JLabel label;
ButtonGroup exclusiveGroup;
Border etched = null;
TitledBorder title1 = BorderFactory.createTitledBorder(etched, in_abilities);
title1.setTitleJustification(TitledBorder.LEFT);
this.setBorder(title1);
this.setLayout(gridbag);
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.NORTHWEST;
c.insets = new Insets(2, 2, 2, 2);
final GameMode gameMode = SettingsHandler.getGame();
int row = 0;
exclusiveGroup = new ButtonGroup();
Utility.buildConstraints(c, 0, row++, 3, 1, 0, 0);
label = new JLabel(LanguageBundle.getFormattedString("in_Prefs_abilitiesGenLabel", //$NON-NLS-1$
gameMode.getDisplayName()));
gridbag.setConstraints(label, c);
this.add(label);
Utility.buildConstraints(c, 0, row, 1, 1, 0, 0);
label = new JLabel(" ");
gridbag.setConstraints(label, c);
this.add(label);
Utility.buildConstraints(c, 1, row++, 2, 1, 0, 0);
abilitiesUserRolledButton = new JRadioButton(LanguageBundle.getString("in_Prefs_abilitiesUserRolled"));
gridbag.setConstraints(abilitiesUserRolledButton, c);
this.add(abilitiesUserRolledButton);
exclusiveGroup.add(abilitiesUserRolledButton);
Utility.buildConstraints(c, 1, row++, 2, 1, 0, 0);
abilitiesAllSameButton = new JRadioButton(LanguageBundle.getString("in_Prefs_abilitiesAllSame") + ": ");
gridbag.setConstraints(abilitiesAllSameButton, c);
this.add(abilitiesAllSameButton);
exclusiveGroup.add(abilitiesAllSameButton);
Utility.buildConstraints(c, 1, row, 1, 1, 0, 0);
label = new JLabel(" ");
gridbag.setConstraints(label, c);
this.add(label);
Utility.buildConstraints(c, 2, row++, 2, 1, 0, 0);
abilityScoreCombo = new JComboBoxEx();
for (int i = gameMode.getStatMin(); i <= gameMode.getStatMax(); ++i) {
abilityScoreCombo.addItem(String.valueOf(i));
}
gridbag.setConstraints(abilityScoreCombo, c);
this.add(abilityScoreCombo);
ReferenceManufacturer<RollMethod> mfg = gameMode.getModeContext().getReferenceContext().getManufacturer(RollMethod.class);
List<RollMethod> rollMethods = mfg.getOrderSortedObjects();
if (!rollMethods.isEmpty()) {
Utility.buildConstraints(c, 1, row++, 2, 1, 0, 0);
abilitiesRolledButton = new JRadioButton("Rolled:");
gridbag.setConstraints(abilitiesRolledButton, c);
this.add(abilitiesRolledButton);
exclusiveGroup.add(abilitiesRolledButton);
Utility.buildConstraints(c, 2, row++, 2, 1, 0, 0);
abilityRolledModeCombo = new JComboBoxEx();
for (RollMethod rm : rollMethods) {
abilityRolledModeCombo.addItem(rm.getDisplayName());
}
gridbag.setConstraints(abilityRolledModeCombo, c);
this.add(abilityRolledModeCombo);
}
Collection<PointBuyMethod> methods = SettingsHandler.getGame().getModeContext().getReferenceContext().getConstructedCDOMObjects(PointBuyMethod.class);
final int purchaseMethodCount = methods.size();
Utility.buildConstraints(c, 1, row++, 2, 1, 0, 0);
abilitiesPurchasedButton = new JRadioButton(LanguageBundle.getString("in_Prefs_abilitiesPurchased") + ": ");
gridbag.setConstraints(abilitiesPurchasedButton, c);
this.add(abilitiesPurchasedButton);
exclusiveGroup.add(abilitiesPurchasedButton);
Utility.buildConstraints(c, 2, row++, 2, 1, 0, 0);
pMode = new String[purchaseMethodCount];
pModeMethodName = new String[purchaseMethodCount];
int i = 0;
for (PointBuyMethod pbm : methods) {
pMode[i] = pbm.getDescription();
pModeMethodName[i] = pbm.getDisplayName();
i++;
}
abilityPurchaseModeCombo = new JComboBoxEx(pMode);
gridbag.setConstraints(abilityPurchaseModeCombo, c);
this.add(abilityPurchaseModeCombo);
//
if (purchaseMethodCount == 0) {
abilityPurchaseModeCombo.setVisible(false);
abilitiesPurchasedButton.setVisible(false);
}
Utility.buildConstraints(c, 1, row++, 1, 1, 0, 0);
label = new JLabel(" ");
gridbag.setConstraints(label, c);
this.add(label);
Utility.buildConstraints(c, 1, row++, 3, 1, 0, 0);
JButton purchaseModeButton = new JButton(LanguageBundle.getString("in_Prefs_purchaseModeConfig"));
gridbag.setConstraints(purchaseModeButton, c);
this.add(purchaseModeButton);
purchaseModeButton.addActionListener(new PurchaseModeButtonListener());
Utility.buildConstraints(c, 5, 20, 1, 1, 1, 1);
c.fill = GridBagConstraints.BOTH;
label = new JLabel(" ");
gridbag.setConstraints(label, c);
this.add(label);
}
use of javax.swing.border.TitledBorder in project pcgen by PCGen.
the class RadioChooserDialog method buildButtonPanel.
/**
* Create the panel of radio buttons.
*/
private void buildButtonPanel() {
ListFacade<InfoFacade> availableList = chooser.getAvailableList();
int row = 0;
avaRadioButton = new JRadioButton[availableList.getSize()];
avaGroup = new ButtonGroup();
// Create the buttons
for (InfoFacade infoFacade : availableList) {
avaRadioButton[row] = new JRadioButton(infoFacade.toString(), false);
avaGroup.add(avaRadioButton[row]);
avaRadioButton[row].addActionListener(this);
++row;
}
int numRows = row;
if (numRows > 0) {
avaRadioButton[0].setSelected(true);
selectedButton = avaRadioButton[0];
}
// Layout the buttons
GridBagLayout gridbag = new GridBagLayout();
buttonPanel = new JPanel();
TitledBorder title = BorderFactory.createTitledBorder(null, "");
buttonPanel.setBorder(title);
buttonPanel.setLayout(gridbag);
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
if (numRows > 11) {
buildTwoColLayout(numRows, c, gridbag);
} else {
for (int i = 0; i < numRows; ++i) {
int cr = i;
c.anchor = GridBagConstraints.WEST;
Utility.buildConstraints(c, 0, cr, 2, 1, 1, 0);
gridbag.setConstraints(avaRadioButton[i], c);
buttonPanel.add(avaRadioButton[i]);
}
}
}
use of javax.swing.border.TitledBorder in project pcgen by PCGen.
the class MainAbout method buildSponsorsPanel.
private JPanel buildSponsorsPanel() {
TitledBorder title = BorderFactory.createTitledBorder(null, //$NON-NLS-1$
LanguageBundle.getString("in_abt_sponsorsTitle"));
title.setTitleJustification(TitledBorder.CENTER);
JLabelPane sponsorLabel = new JLabelPane();
JScrollPane sp = new JScrollPane(sponsorLabel);
sp.setBorder(title);
JPanel panel = new JPanel(new BorderLayout());
sponsorLabel.setBackground(panel.getBackground());
panel.add(sp, BorderLayout.CENTER);
Collection<Sponsor> sponsors = Globals.getGlobalContext().getReferenceContext().getConstructedCDOMObjects(Sponsor.class);
StringBuilder sb = new StringBuilder();
sb.append("<html><b>");
sb.append(LanguageBundle.getString("in_abt_ourSponsors")).append("</b><br>");
for (Sponsor sponsor : sponsors) {
if ("PCGEN".equals(sponsor.getKeyName())) {
continue;
}
sb.append("<img src='").append(sponsor.getBannerImage()).append("'><br>");
}
sb.append("</html>");
sponsorLabel.setText(sb.toString());
return panel;
}
use of javax.swing.border.TitledBorder in project pcgen by PCGen.
the class ExperienceAdjusterView method initComponents.
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
jPanel5 = new javax.swing.JPanel();
panelChar = new javax.swing.JPanel();
characterList = new javax.swing.JList();
spCharLabel = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jLabel4 = new javax.swing.JLabel();
enemyList = new javax.swing.JList();
jPanel6 = new javax.swing.JPanel();
jPanel7 = new javax.swing.JPanel();
jLabel7 = new javax.swing.JLabel();
experienceToAdd = new javax.swing.JTextField(6);
addExperienceToCharButton = new javax.swing.JButton();
jPanel8 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
experienceFromCombat = new javax.swing.JLabel();
experienceMultNameLabel = new javax.swing.JLabel();
experienceMultSlider = new javax.swing.JSlider();
addExperienceToPartyButton = new javax.swing.JButton();
experienceMultLabel = new javax.swing.JLabel();
adjustCRButton = new javax.swing.JButton();
addEnemyButton = new javax.swing.JButton();
removeEnemyButton = new javax.swing.JButton();
scrollPaneChar = new JScrollPane(characterList);
scrollPaneEnemy = new JScrollPane(enemyList);
setLayout(new GridLayout(0, 1));
//$NON-NLS-1$
jPanel5.setBorder(new TitledBorder(LanguageBundle.getString("in_plugin_xp_char")));
jPanel5.setLayout(new java.awt.GridLayout(1, 0));
panelChar.setLayout(new java.awt.BorderLayout());
//$NON-NLS-1$
spCharLabel.setText(LanguageBundle.getString("in_plugin_xp_nameLvlXp"));
panelChar.add(spCharLabel, BorderLayout.NORTH);
panelChar.add(scrollPaneChar, java.awt.BorderLayout.CENTER);
jPanel5.add(panelChar);
jPanel1.setLayout(new java.awt.BorderLayout());
//$NON-NLS-1$
jLabel4.setText(LanguageBundle.getString("in_plugin_xp_nameCr"));
jPanel1.add(jLabel4, java.awt.BorderLayout.NORTH);
jPanel1.add(scrollPaneEnemy, java.awt.BorderLayout.CENTER);
add(jPanel5);
jPanel6.setLayout(new java.awt.GridLayout(1, 0));
//$NON-NLS-1$
jPanel6.setBorder(new TitledBorder(LanguageBundle.getString("in_plugin_xp_enemies")));
jPanel6.add(jPanel1);
jPanel7.setLayout(new java.awt.GridBagLayout());
// the button is after to allow the use of Tab after entering a value then pressing the button
//$NON-NLS-1$
jLabel7.setText(LanguageBundle.getString("in_plugin_xp_xpTo"));
//$NON-NLS-1$
addExperienceToCharButton.setText(LanguageBundle.getString("in_plugin_xp_selectedChar"));
addExperienceToCharButton.setEnabled(false);
gridBagConstraints = new java.awt.GridBagConstraints();
//$NON-NLS-1$
jPanel7.add(new JLabel(LanguageBundle.getString("in_plugin_xp_add")), gridBagConstraints);
jPanel7.add(experienceToAdd, gridBagConstraints);
jPanel7.add(jLabel7, gridBagConstraints);
jPanel7.add(addExperienceToCharButton, gridBagConstraints);
gridBagConstraints.weightx = 1.0;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
// add an empty horizontal glue like panel
jPanel7.add(new JPanel(), gridBagConstraints);
// Updates the button if there is a selected character
characterList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
addExperienceToCharButton.setEnabled(!characterList.isSelectionEmpty());
}
}
});
jPanel7.setBorder(BorderFactory.createEmptyBorder(0, BORDER_SIZE, 0, 0));
jPanel5.add(jPanel7);
jPanel8.setLayout(new java.awt.GridBagLayout());
//$NON-NLS-1$
jLabel5.setText(LanguageBundle.getString("in_plugin_xp_xpFromCombat"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = 2;
jPanel8.add(jLabel5, gridBagConstraints);
experienceFromCombat.setText(Integer.toString(0));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
jPanel8.add(experienceFromCombat, gridBagConstraints);
//$NON-NLS-1$
experienceMultNameLabel.setText(LanguageBundle.getString("in_plugin_xp_normal"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
jPanel8.add(experienceMultNameLabel, gridBagConstraints);
experienceMultSlider.setMaximum(10);
experienceMultSlider.setMinimum(-5);
experienceMultSlider.setValue(0);
// TODO the false value (the slider's) should not be visible, only the real one should
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridheight = 2;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
jPanel8.add(experienceMultSlider, gridBagConstraints);
experienceMultSlider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
double realValue = getSliderRealValue();
if (CoreUtility.doublesEqual(realValue, 0.5)) {
getExperienceMultNameLabel().setText(//$NON-NLS-1$
LanguageBundle.getString("in_plugin_xp_half"));
} else if (realValue <= 0.7) {
getExperienceMultNameLabel().setText(//$NON-NLS-1$
LanguageBundle.getString("in_plugin_xp_easier"));
} else if ((realValue > 0.7) && (realValue < 1.5)) {
getExperienceMultNameLabel().setText(//$NON-NLS-1$
LanguageBundle.getString("in_plugin_xp_normal"));
} else if (realValue >= 1.5) {
getExperienceMultNameLabel().setText(//$NON-NLS-1$
LanguageBundle.getString("in_plugin_xp_harder"));
}
if (CoreUtility.doublesEqual(realValue, 2)) {
getExperienceMultNameLabel().setText(//$NON-NLS-1$
LanguageBundle.getString("in_plugin_xp_twice"));
}
getExperienceMultLabel().setText(LanguageBundle.getPrettyMultiplier(realValue));
model.setMultiplier(realValue);
}
});
//$NON-NLS-1$
addExperienceToPartyButton.setText(LanguageBundle.getString("in_plugin_xp_addXpToParty"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 3;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
jPanel8.add(addExperienceToPartyButton, gridBagConstraints);
experienceMultLabel.setText(LanguageBundle.getPrettyMultiplier(1.0d));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
jPanel8.add(experienceMultLabel, gridBagConstraints);
//$NON-NLS-1$
adjustCRButton.setText(LanguageBundle.getString("in_plugin_xp_adjustCr"));
adjustCRButton.setEnabled(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 5;
gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
jPanel8.add(adjustCRButton, gridBagConstraints);
//$NON-NLS-1$
addEnemyButton.setText(LanguageBundle.getString("in_plugin_xp_addEnemy"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 6;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
jPanel8.add(addEnemyButton, gridBagConstraints);
//$NON-NLS-1$
removeEnemyButton.setText(LanguageBundle.getString("in_plugin_xp_removeEnemy"));
removeEnemyButton.setEnabled(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 5;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.insets = new java.awt.Insets(12, BORDER_SIZE, 0, 0);
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
jPanel8.add(removeEnemyButton, gridBagConstraints);
// Update buttons on selection change
enemyList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
adjustCRButton.setEnabled(!enemyList.isSelectionEmpty());
removeEnemyButton.setEnabled(!enemyList.isSelectionEmpty());
}
}
});
jPanel8.setBorder(BorderFactory.createEmptyBorder(0, BORDER_SIZE, 0, 0));
jPanel6.add(jPanel8);
add(jPanel6);
}
use of javax.swing.border.TitledBorder in project pcgen by PCGen.
the class PreferencesExperiencePanel method initComponents.
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
private void initComponents() {
//GEN-BEGIN:initComponents
mainPanel = new JPanel();
expPanel = new JPanel();
experienceGroup = new ButtonGroup();
experienceRB1 = new JRadioButton();
experienceRB2 = new JRadioButton();
setLayout(new BorderLayout());
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
expPanel.setLayout(new BoxLayout(expPanel, BoxLayout.Y_AXIS));
expPanel.setBorder(new TitledBorder(null, //$NON-NLS-1$
LanguageBundle.getString("in_plugin_xp_calc"), //$NON-NLS-1$
TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION));
experienceRB1.setSelected(true);
experienceRB1.setText(//$NON-NLS-1$
LanguageBundle.getString("in_plugin_xp_byParty"));
experienceGroup.add(experienceRB1);
expPanel.add(experienceRB1);
experienceRB2.setText(//$NON-NLS-1$
LanguageBundle.getString("in_plugin_xp_byPC"));
experienceGroup.add(experienceRB2);
expPanel.add(experienceRB2);
mainPanel.add(expPanel);
JScrollPane jScrollPane1 = new JScrollPane();
jScrollPane1.setViewportView(mainPanel);
add(jScrollPane1, BorderLayout.CENTER);
}
Aggregations