use of java.awt.Container in project pcgen by PCGen.
the class LanguageChooserDialog method initComponents.
private void initComponents() {
setTitle(chooser.getName());
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
//detach listeners from the chooser
treeViewModel.setDelegate(null);
listModel.setListFacade(null);
chooser.getRemainingSelections().removeReferenceListener(LanguageChooserDialog.this);
}
});
Container pane = getContentPane();
pane.setLayout(new BorderLayout());
JSplitPane split = new JSplitPane();
JPanel leftPane = new JPanel(new BorderLayout());
//leftPane.add(new JLabel("Available Languages"), BorderLayout.NORTH);
availTable.setAutoCreateRowSorter(true);
availTable.setTreeViewModel(treeViewModel);
availTable.getRowSorter().toggleSortOrder(0);
availTable.addActionListener(this);
leftPane.add(new JScrollPane(availTable), BorderLayout.CENTER);
JPanel buttonPane1 = new JPanel(new FlowLayout());
//$NON-NLS-1$
JButton addButton = new JButton(LanguageBundle.getString("in_sumLangAddLanguage"));
addButton.setActionCommand("ADD");
addButton.addActionListener(this);
buttonPane1.add(addButton);
buttonPane1.add(new JLabel(Icons.Forward16.getImageIcon()));
leftPane.add(buttonPane1, BorderLayout.SOUTH);
split.setLeftComponent(leftPane);
JPanel rightPane = new JPanel(new BorderLayout());
JPanel labelPane = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridwidth = GridBagConstraints.REMAINDER;
//$NON-NLS-1$
labelPane.add(//$NON-NLS-1$
new JLabel(LanguageBundle.getString("in_sumLangRemain")), new GridBagConstraints());
remainingLabel.setText(chooser.getRemainingSelections().get().toString());
labelPane.add(remainingLabel, gbc);
//$NON-NLS-1$
labelPane.add(new JLabel(LanguageBundle.getString("in_sumSelectedLang")), gbc);
rightPane.add(labelPane, BorderLayout.NORTH);
list.setModel(listModel);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.addActionListener(this);
rightPane.add(new JScrollPane(list), BorderLayout.CENTER);
JPanel buttonPane2 = new JPanel(new FlowLayout());
buttonPane2.add(new JLabel(Icons.Back16.getImageIcon()));
//$NON-NLS-1$
JButton removeButton = new JButton(LanguageBundle.getString("in_sumLangRemoveLanguage"));
removeButton.setActionCommand("REMOVE");
removeButton.addActionListener(this);
buttonPane2.add(removeButton);
rightPane.add(buttonPane2, BorderLayout.SOUTH);
split.setRightComponent(rightPane);
pane.add(split, BorderLayout.CENTER);
JPanel bottomPane = new JPanel(new FlowLayout());
//$NON-NLS-1$
JButton button = new JButton(LanguageBundle.getString("in_ok"));
//$NON-NLS-1$
button.setMnemonic(LanguageBundle.getMnemonic("in_mn_ok"));
button.setActionCommand("OK");
button.addActionListener(this);
bottomPane.add(button);
//$NON-NLS-1$
button = new JButton(LanguageBundle.getString("in_cancel"));
//$NON-NLS-1$
button.setMnemonic(LanguageBundle.getMnemonic("in_mn_cancel"));
button.setActionCommand("CANCEL");
button.addActionListener(this);
bottomPane.add(button);
pane.add(bottomPane, BorderLayout.SOUTH);
}
use of java.awt.Container in project pcgen by PCGen.
the class SpellChoiceDialog method initComponents.
private void initComponents() {
Container pane = getContentPane();
pane.setLayout(new BorderLayout());
pane.add(spellChoicePanel, BorderLayout.CENTER);
okButton.addActionListener(this);
cancelButton.addActionListener(this);
Box buttons = Box.createHorizontalBox();
buttons.add(buttonPanel);
buttons.add(Box.createHorizontalGlue());
buttons.add(okButton);
buttons.add(Box.createHorizontalStrut(10));
buttons.add(cancelButton);
buttons.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
pane.add(buttons, BorderLayout.SOUTH);
Utility.installEscapeCloseOperation(this);
}
use of java.awt.Container in project pcgen by PCGen.
the class PostLevelUpDialog method initComponents.
private void initComponents() {
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
Container pane = getContentPane();
pane.setLayout(new BorderLayout());
JTable table = new JTable(tableModel) {
@Override
public TableCellEditor getCellEditor(int row, int column) {
if (column == LevelTableModel.COL_ROLLED_HP && row < numLevels) {
//TODO: the max roll should be calculated in a different manner
String hd = levels.getClassTaken(levels.getElementAt(row + oldLevel)).getHD();
int max = NumberUtils.toInt(hd);
return new SpinnerEditor(new SpinnerNumberModel(1, 1, max, 1));
}
return super.getCellEditor(row, column);
}
@Override
public TableCellRenderer getCellRenderer(int row, int column) {
if (column == LevelTableModel.COL_ROLLED_HP && row < numLevels) {
return new SpinnerRenderer();
}
return super.getCellRenderer(row, column);
}
};
table.setCellSelectionEnabled(false);
table.setRowHeight(new JSpinner().getPreferredSize().height);
JTableHeader header = table.getTableHeader();
header.setReorderingAllowed(false);
JScrollPane scrollPane = new JScrollPane(table);
pane.add(scrollPane, BorderLayout.CENTER);
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalGlue());
//$NON-NLS-1$
JButton button = new JButton(LanguageBundle.getString("in_close"));
//$NON-NLS-1$
button.setMnemonic(LanguageBundle.getMnemonic("in_mn_close"));
//$NON-NLS-1$
button.setActionCommand("Close");
button.addActionListener(this);
box.add(button);
pane.add(box, BorderLayout.SOUTH);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
//Make sure to remove the listeners so that the garbage collector can
//dispose of this dialog and prevent a memory leak
levels.removeHitPointListener(tableModel);
}
});
Utility.installEscapeCloseOperation(this);
}
use of java.awt.Container in project pcgen by PCGen.
the class DebugDialog method initComponents.
private void initComponents() {
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.add(logPanel, BorderLayout.CENTER);
contentPane.add(memoryPanel, BorderLayout.SOUTH);
setDefaultCloseOperation(HIDE_ON_CLOSE);
}
use of java.awt.Container in project pcgen by PCGen.
the class SplashScreen method initComponents.
private void initComponents() {
JComponent pane = new JPanel(new BorderLayout());
pane.setBorder(BorderFactory.createLineBorder(Color.BLACK, 3));
Component splashLabel = new JLabel(Icons.SplashPcgen_Ennie.getImageIcon());
pane.add(splashLabel, BorderLayout.NORTH);
loadingLabel.setBorder(BorderFactory.createEmptyBorder(10, 7, 10, 10));
pane.add(loadingLabel, BorderLayout.CENTER);
loadProgress.setStringPainted(true);
pane.add(loadProgress, BorderLayout.SOUTH);
Container cont = getContentPane();
cont.setLayout(new GridLayout(1, 1));
cont.add(pane);
pack();
setLocationRelativeTo(null);
}
Aggregations