use of java.awt.GridBagConstraints in project pcgen by PCGen.
the class CoreViewFrame method initialize.
public void initialize(CharacterFacade character) {
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
getContentPane().setLayout(gridbag);
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.NORTHWEST;
c.insets = new Insets(2, 2, 2, 2);
int col = 0;
Utility.buildConstraints(c, col, 0, 1, 1, 100, 20);
JLabel label = new JLabel(LanguageBundle.getFormattedString(//$NON-NLS-1$
"in_CoreView_Perspective"));
gridbag.setConstraints(label, c);
getContentPane().add(label);
Utility.buildConstraints(c, col++, 1, 1, 1, 0, 20);
gridbag.setConstraints(perspectiveChooser, c);
getContentPane().add(perspectiveChooser);
Utility.buildConstraints(c, 0, 2, col, 1, 0, 1000);
viewTable.setAutoCreateRowSorter(true);
JScrollPane pane = new JScrollPane(viewTable);
pane.setPreferredSize(new Dimension(500, 300));
gridbag.setConstraints(pane, c);
getContentPane().add(pane);
setTitle("Core Debug View");
getContentPane().setSize(500, 400);
pack();
Utility.centerComponent(this, true);
}
use of java.awt.GridBagConstraints in project pcgen by PCGen.
the class OptionsPathDialog method initComponents.
private void initComponents() {
setResizable(false);
setTitle("Directory for options.ini location");
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
getContentPane().setLayout(new GridBagLayout());
GridBagConstraints gridBagConstraints = new GridBagConstraints();
JLabel label = new JLabel("Select a directory to store PCGen options in:");
gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.insets = new Insets(4, 4, 0, 4);
getContentPane().add(label, gridBagConstraints);
gridBagConstraints.insets = new Insets(2, 0, 2, 0);
getContentPane().add(new JSeparator(), gridBagConstraints);
label = new JLabel("If you have an existing options.ini file," + "then select the directory containing that file");
gridBagConstraints.insets = new Insets(4, 4, 4, 4);
getContentPane().add(label, gridBagConstraints);
ActionListener handler = new ActionHandler();
ButtonGroup group = new ButtonGroup();
gridBagConstraints.insets = new Insets(0, 4, 0, 4);
addRadioButton("<html><b>PCGen Dir</b>: This is the directory that PCGen is installed into", SettingsFilesPath.pcgen.name(), group, handler, gridBagConstraints);
// Remark: do mac user really need to be able to put the file either in a specific mac dir or home?
if (SystemUtils.IS_OS_MAC_OSX) {
addRadioButton("<html><b>Mac User Dir</b>", SettingsFilesPath.mac_user.name(), group, handler, gridBagConstraints);
} else if (SystemUtils.IS_OS_UNIX) {
// putting it the same way as mac. merging all and using a system config dir instead would be better IMHO.
addRadioButton("<html><b>Freedesktop configuration sub-directory</b> Use for most Linux/BSD", SettingsFilesPath.FD_USER.name(), group, handler, gridBagConstraints);
}
addRadioButton("<html><b>Home Dir</b>: This is your home directory", SettingsFilesPath.user.name(), group, handler, gridBagConstraints);
addRadioButton("Select a directory to use", "select", group, handler, gridBagConstraints);
dirField.setText(ConfigurationSettings.getSettingsDirFromFilePath(selectedDir));
dirField.setEditable(false);
gridBagConstraints.gridwidth = GridBagConstraints.RELATIVE;
gridBagConstraints.weightx = 1;
gridBagConstraints.insets = new Insets(0, 4, 0, 0);
getContentPane().add(dirField, gridBagConstraints);
dirButton.setText("...");
dirButton.setEnabled(false);
dirButton.addActionListener(handler);
dirButton.setActionCommand("custom");
dirButton.setMargin(new Insets(2, 2, 2, 2));
GridBagConstraints bagConstraints = new GridBagConstraints();
bagConstraints.gridwidth = GridBagConstraints.REMAINDER;
bagConstraints.insets = new Insets(0, 0, 0, 4);
getContentPane().add(dirButton, bagConstraints);
JButton okButton = new JButton("OK");
okButton.setPreferredSize(new Dimension(75, 23));
okButton.setActionCommand("ok");
okButton.addActionListener(handler);
bagConstraints.insets = new Insets(4, 0, 4, 0);
getContentPane().add(okButton, bagConstraints);
getRootPane().setDefaultButton(okButton);
pack();
setLocationRelativeTo(null);
}
use of java.awt.GridBagConstraints in project voltdb by VoltDB.
the class ZaurusEditor method initGUI.
private void initGUI() {
// without connection there are no tables
// vAllTables is a local variable with all table names in the database
// vHoldTableNames holds the table names which have a ZaurusTableForm
Vector vAllTables = getAllTables();
if (vAllTables == null) {
return;
}
// initialize a new list for the table names which have a form in pForm
vHoldTableNames = new Vector(20);
vHoldForms = new Vector(20);
// this holds the card panel pForm for the forms in the top
// a card panel pButton below
// the both card panels form a panel which is centered in this
// and a status line in the south
this.setLayout(new BorderLayout(3, 3));
// >>> the top of this: the entry forms in pForm
// pFormButs holds in the center the forms card panel pForm and
// in the south the button card panel pButton
Panel pFormButs = new Panel();
pFormButs.setLayout(new BorderLayout(3, 3));
pForm = new Panel();
lForm = new CardLayout(2, 2);
pForm.setLayout(lForm);
// the search panel containing the list of all tables and
// the entry fields for search words in the Center
Panel pEntry = new Panel();
pEntry.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.insets = new Insets(3, 3, 3, 3);
c.gridwidth = 1;
c.gridheight = 1;
c.weightx = c.weighty = 1;
c.anchor = GridBagConstraints.WEST;
c.gridy = 0;
c.gridx = 0;
pEntry.add(new Label("Search table"), c);
c.gridx = 1;
// get all table names and show a drop down list of them in cTables
cTables = new Choice();
for (Enumeration e = vAllTables.elements(); e.hasMoreElements(); ) {
cTables.addItem((String) e.nextElement());
}
c.gridwidth = 2;
pEntry.add(cTables, c);
c.gridy = 1;
c.gridx = 0;
c.gridwidth = 1;
pEntry.add(new Label("Search words"), c);
c.gridx = 1;
c.gridwidth = 2;
fSearchWords = new TextField(8);
pEntry.add(fSearchWords, c);
// use search words
c.gridwidth = 1;
c.gridy = 2;
c.gridx = 0;
pEntry.add(new Label("Use search words"), c);
gAllWords = new CheckboxGroup();
Checkbox[] checkboxes = new Checkbox[2];
checkboxes[0] = new Checkbox("all", gAllWords, true);
c.gridx = 1;
pEntry.add(checkboxes[0], c);
checkboxes[1] = new Checkbox("any ", gAllWords, false);
c.gridx = 2;
pEntry.add(checkboxes[1], c);
// ignore case
c.gridy = 3;
c.gridx = 0;
pEntry.add(new Label("Ignore case"), c);
gIgnoreCase = new CheckboxGroup();
Checkbox[] checkboxes1 = new Checkbox[2];
checkboxes1[0] = new Checkbox("yes", gIgnoreCase, true);
c.gridx = 1;
pEntry.add(checkboxes1[0], c);
checkboxes1[1] = new Checkbox("no", gIgnoreCase, false);
c.gridx = 2;
pEntry.add(checkboxes1[1], c);
// Match column exactly
c.gridy = 4;
c.gridx = 0;
pEntry.add(new Label("Match whole col"), c);
gNoMatchWhole = new CheckboxGroup();
Checkbox[] checkboxes2 = new Checkbox[2];
checkboxes2[0] = new Checkbox("no", gNoMatchWhole, true);
c.gridx = 1;
pEntry.add(checkboxes2[0], c);
checkboxes2[1] = new Checkbox("yes ", gNoMatchWhole, false);
c.gridx = 2;
pEntry.add(checkboxes2[1], c);
pForm.add("search", pEntry);
pFormButs.add("Center", pForm);
// the buttons
this.initButtons();
pButton = new Panel();
lButton = new CardLayout(2, 2);
pButton.setLayout(lButton);
pButton.add("search", pSearchButs);
pButton.add("edit", pEditButs);
pButton.add("insert", pInsertButs);
pFormButs.add("South", pButton);
this.add("Center", pFormButs);
// >>> the South: status line at the bottom
Font fFont = new Font("Dialog", Font.PLAIN, 10);
ZaurusEditor.tStatus = new TextField("");
ZaurusEditor.tStatus.setEditable(false);
this.add("South", ZaurusEditor.tStatus);
}
use of java.awt.GridBagConstraints 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 java.awt.GridBagConstraints in project pcgen by PCGen.
the class CastSpell method addDescriptionPanel.
private void addDescriptionPanel() {
GridBagConstraints gridBagConstraints = null;
descPanel = new JPanel(new BorderLayout());
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = gridBagRow;
gridBagConstraints.gridwidth = 3;
gridBagConstraints.gridheight = 1;
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.insets = new Insets(3, 3, 3, 3);
mainPanel.add(descPanel, gridBagConstraints);
gridBagRow++;
}
Aggregations