Search in sources :

Example 1 with CharactersSelectorPanelController

use of delta.games.lotro.gui.character.chooser.CharactersSelectorPanelController in project lotro-companion by dmorcellet.

the class CharacterLevelPanelController method buildPanel.

private JPanel buildPanel() {
    JPanel panel = GuiFactory.buildBackgroundPanel(new BorderLayout());
    _chartController = new CharacterLevelChartController(_stats);
    JPanel chartPanel = _chartController.getPanel();
    panel.add(chartPanel, BorderLayout.CENTER);
    JPanel toonsControlPanel = GuiFactory.buildPanel(new GridBagLayout());
    {
        // Toons show/hide
        List<CharacterFile> toons = _stats.getToonsList();
        _toonSelectionController = new CharactersSelectorPanelController(toons);
        for (CharacterFile toon : toons) {
            _toonSelectionController.setToonSelected(toon, true);
            _toonSelectionController.setToonEnabled(toon, true);
        }
        _toonSelectionController.setGridConfiguration(1, 10);
        JPanel selectionPanel = _toonSelectionController.getPanel();
        GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0);
        toonsControlPanel.add(selectionPanel, c);
        _toonSelectionController.getListenersManager().addListener(this);
        // Choose toons button
        JButton chooser = GuiFactory.buildButton("Choose characters...");
        ActionListener al = new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                doChooseToons();
            }
        };
        chooser.addActionListener(al);
        chooser.setAlignmentY(Component.CENTER_ALIGNMENT);
        c.gridy++;
        toonsControlPanel.add(chooser, c);
    }
    panel.add(toonsControlPanel, BorderLayout.EAST);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) CharacterFile(delta.games.lotro.character.CharacterFile) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) CharactersSelectorPanelController(delta.games.lotro.gui.character.chooser.CharactersSelectorPanelController) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

CharacterFile (delta.games.lotro.character.CharacterFile)1 CharactersSelectorPanelController (delta.games.lotro.gui.character.chooser.CharactersSelectorPanelController)1 BorderLayout (java.awt.BorderLayout)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 JButton (javax.swing.JButton)1 JPanel (javax.swing.JPanel)1