Search in sources :

Example 6 with CharacterSex

use of delta.games.lotro.common.CharacterSex in project lotro-companion by dmorcellet.

the class CharacterSummaryPanelController method buildPanel.

private JPanel buildPanel() {
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0);
    // Grab data
    CharacterClass cClass = null;
    Race race = null;
    CharacterSex sex = null;
    if (_summary != null) {
        cClass = _summary.getCharacterClass();
        race = _summary.getRace();
        sex = _summary.getCharacterSex();
    }
    // Class
    ImageIcon classIcon = LotroIconsManager.getClassIcon(cClass, LotroIconsManager.COMPACT_SIZE);
    panel.add(GuiFactory.buildIconLabel(classIcon), c);
    // Character icon
    ImageIcon characterIcon = LotroIconsManager.getCharacterIcon(race, sex);
    c.gridx = 1;
    _characterIconLabel = GuiFactory.buildIconLabel(characterIcon);
    panel.add(_characterIconLabel, c);
    // Name
    _nameLabel = GuiFactory.buildLabel("", 28.0f);
    c.gridx = 2;
    c.anchor = GridBagConstraints.CENTER;
    c.weightx = 1.0;
    c.fill = GridBagConstraints.BOTH;
    panel.add(_nameLabel, c);
    // Level
    _levelLabel = GuiFactory.buildLabel("", 32.0f);
    c.gridx = 3;
    c.weightx = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.EAST;
    panel.add(_levelLabel, c);
    c.gridx = 4;
    JButton edit = GuiFactory.buildButton("Edit...");
    ActionListener al = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            editSummary();
        }
    };
    edit.addActionListener(al);
    panel.add(edit, c);
    update();
    return panel;
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) Race(delta.games.lotro.common.Race) CharacterSex(delta.games.lotro.common.CharacterSex) JButton(javax.swing.JButton) CharacterClass(delta.games.lotro.common.CharacterClass)

Aggregations

CharacterSex (delta.games.lotro.common.CharacterSex)6 Race (delta.games.lotro.common.Race)6 CharacterClass (delta.games.lotro.common.CharacterClass)4 ImageIcon (javax.swing.ImageIcon)3 CharacterData (delta.games.lotro.character.CharacterData)1 CharacterFile (delta.games.lotro.character.CharacterFile)1 CharactersManager (delta.games.lotro.character.CharactersManager)1 CharacterStatsComputer (delta.games.lotro.character.stats.CharacterStatsComputer)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 JButton (javax.swing.JButton)1 JPanel (javax.swing.JPanel)1