Search in sources :

Example 21 with Container

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);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) FlowLayout(java.awt.FlowLayout) GridBagLayout(java.awt.GridBagLayout) JButton(javax.swing.JButton) WindowAdapter(java.awt.event.WindowAdapter) JLabel(javax.swing.JLabel) Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) WindowEvent(java.awt.event.WindowEvent) JSplitPane(javax.swing.JSplitPane)

Example 22 with Container

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);
}
Also used : Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) Box(javax.swing.Box)

Example 23 with Container

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);
}
Also used : JScrollPane(javax.swing.JScrollPane) SpinnerEditor(pcgen.gui2.util.table.TableCellUtilities.SpinnerEditor) JButton(javax.swing.JButton) JTableHeader(javax.swing.table.JTableHeader) WindowAdapter(java.awt.event.WindowAdapter) Box(javax.swing.Box) SpinnerRenderer(pcgen.gui2.util.table.TableCellUtilities.SpinnerRenderer) SpinnerNumberModel(javax.swing.SpinnerNumberModel) Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable) WindowEvent(java.awt.event.WindowEvent) JSpinner(javax.swing.JSpinner)

Example 24 with Container

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);
}
Also used : Container(java.awt.Container) BorderLayout(java.awt.BorderLayout)

Example 25 with Container

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);
}
Also used : JPanel(javax.swing.JPanel) Container(java.awt.Container) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) JComponent(javax.swing.JComponent) JLabel(javax.swing.JLabel) JComponent(javax.swing.JComponent) Component(java.awt.Component)

Aggregations

Container (java.awt.Container)206 JPanel (javax.swing.JPanel)63 JLabel (javax.swing.JLabel)61 JButton (javax.swing.JButton)53 JScrollPane (javax.swing.JScrollPane)51 BoxLayout (javax.swing.BoxLayout)47 FlowLayout (java.awt.FlowLayout)45 ActionEvent (java.awt.event.ActionEvent)38 BorderLayout (java.awt.BorderLayout)36 Dimension (java.awt.Dimension)33 ActionListener (java.awt.event.ActionListener)26 Component (java.awt.Component)25 JmriJFrame (jmri.util.JmriJFrame)20 JFrame (javax.swing.JFrame)18 Border (javax.swing.border.Border)18 JTextArea (javax.swing.JTextArea)17 JTable (javax.swing.JTable)15 JTextField (javax.swing.JTextField)15 Color (java.awt.Color)13 Point (java.awt.Point)13