Search in sources :

Example 21 with ItemSelectionListener

use of delta.common.ui.swing.combobox.ItemSelectionListener in project lotro-companion by dmorcellet.

the class StatCurvesConfigurationPanel method buildPanel.

private JPanel buildPanel() {
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0);
    // Level
    panel.add(GuiFactory.buildLabel("Level:"), c);
    c.gridx++;
    _level = CharacterUiUtils.buildLevelCombo();
    _level.selectItem(Integer.valueOf(_config.getLevel()));
    panel.add(_level.getComboBox(), c);
    ItemSelectionListener<Integer> listener = new ItemSelectionListener<Integer>() {

        @Override
        public void itemSelected(Integer item) {
            updateLevel(item.intValue());
        }
    };
    _level.addListener(listener);
    // Max rating
    c.gridx = 0;
    c.gridy++;
    panel.add(GuiFactory.buildLabel("Max rating:"), c);
    c.gridx++;
    _maxRating = new IntegerEditionController(GuiFactory.buildTextField(""));
    _maxRating.setValueRange(Integer.valueOf(1), Integer.valueOf(5000000));
    _maxRating.setValue(Integer.valueOf((int) _config.getMaxRating()));
    _maxRating.getTextField().setColumns(5);
    panel.add(_maxRating.getTextField(), c);
    ActionListener al = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            updateMaxRating();
        }
    };
    _maxRating.getTextField().addActionListener(al);
    c.gridx++;
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionListener(java.awt.event.ActionListener) ItemSelectionListener(delta.common.ui.swing.combobox.ItemSelectionListener) IntegerEditionController(delta.common.ui.swing.text.IntegerEditionController) ActionEvent(java.awt.event.ActionEvent)

Example 22 with ItemSelectionListener

use of delta.common.ui.swing.combobox.ItemSelectionListener in project lotro-companion by dmorcellet.

the class WarbandsFilterController method build.

private JPanel build() {
    JPanel panel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
    // Regions
    String[] regions = getRegions();
    _region = new ComboBoxController<String>();
    _region.addEmptyItem(" ");
    for (String region : regions) {
        _region.addItem(region, region);
    }
    ItemSelectionListener<String> regionListener = new ItemSelectionListener<String>() {

        @Override
        public void itemSelected(String region) {
            _filter.setRegion(region);
            updateFilter();
        }
    };
    _region.addListener(regionListener);
    panel.add(GuiFactory.buildLabel("Region:"));
    panel.add(_region.getComboBox());
    // Sizes
    Size[] sizes = { Size.SOLO, Size.SMALL_FELLOWSHIP, Size.FELLOWSHIP, Size.RAID };
    _size = new ComboBoxController<Size>();
    _size.addEmptyItem(" ");
    for (Size size : sizes) {
        _size.addItem(size, size.toString());
    }
    ItemSelectionListener<Size> sizeListener = new ItemSelectionListener<Size>() {

        @Override
        public void itemSelected(Size size) {
            _filter.setSize(size);
            updateFilter();
        }
    };
    _size.addListener(sizeListener);
    panel.add(GuiFactory.buildLabel("Size:"));
    panel.add(_size.getComboBox());
    // Levels
    Integer[] minLevels = getMinLevels();
    _minLevel = new ComboBoxController<Integer>();
    _minLevel.addEmptyItem(" ");
    for (Integer minLevel : minLevels) {
        _minLevel.addItem(minLevel, minLevel.toString());
    }
    ItemSelectionListener<Integer> minLevelListener = new ItemSelectionListener<Integer>() {

        @Override
        public void itemSelected(Integer minLevel) {
            _filter.setMinLevel(minLevel);
            updateFilter();
        }
    };
    _minLevel.addListener(minLevelListener);
    panel.add(GuiFactory.buildLabel("Minimum level:"));
    panel.add(_minLevel.getComboBox());
    // Reset
    _reset = GuiFactory.buildButton("Reset");
    _reset.addActionListener(this);
    panel.add(_reset);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ItemSelectionListener(delta.common.ui.swing.combobox.ItemSelectionListener) Size(delta.games.lotro.common.Size)

Example 23 with ItemSelectionListener

use of delta.common.ui.swing.combobox.ItemSelectionListener in project lotro-companion by dmorcellet.

the class NewToonDialogController method buildNewToonPanel.

private JPanel buildNewToonPanel() {
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    // Toon name
    _toonName = GuiFactory.buildTextField("");
    _toonName.setColumns(TOON_NAME_SIZE);
    // Server
    _server = CharacterUiUtils.buildServerCombo();
    TypedProperties props = Config.getInstance().getParameters();
    String defaultServer = props.getStringProperty("default.server", null);
    if (defaultServer != null) {
        _server.selectItem(defaultServer);
    }
    // Class
    _class = new CharacterClassController();
    // Race
    _race = CharacterUiUtils.buildRaceCombo(false);
    ItemSelectionListener<Race> listener = new ItemSelectionListener<Race>() {

        @Override
        public void itemSelected(Race race) {
            _class.setRace(race);
        }
    };
    _race.addListener(listener);
    // Sex
    _sex = CharacterUiUtils.buildSexCombo();
    Insets insets = new Insets(5, 5, 5, 5);
    GridBagConstraints gbc = new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, insets, 0, 0);
    panel.add(GuiFactory.buildLabel("Name:"), gbc);
    gbc.gridx = 0;
    gbc.gridy = 1;
    panel.add(GuiFactory.buildLabel("Server:"), gbc);
    gbc.gridx = 0;
    gbc.gridy = 2;
    panel.add(GuiFactory.buildLabel("Race:"), gbc);
    gbc.gridx = 0;
    gbc.gridy = 3;
    panel.add(GuiFactory.buildLabel("Class:"), gbc);
    gbc.gridx = 0;
    gbc.gridy = 4;
    panel.add(GuiFactory.buildLabel("Sex:"), gbc);
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    panel.add(_toonName, gbc);
    gbc.gridx = 1;
    gbc.gridy = 1;
    panel.add(_server.getComboBox(), gbc);
    gbc.gridx = 1;
    gbc.gridy = 2;
    panel.add(_race.getComboBox(), gbc);
    gbc.gridx = 1;
    gbc.gridy = 3;
    panel.add(_class.getComboBoxController().getComboBox(), gbc);
    gbc.gridx = 1;
    gbc.gridy = 4;
    panel.add(_sex.getComboBox(), gbc);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ItemSelectionListener(delta.common.ui.swing.combobox.ItemSelectionListener) Race(delta.games.lotro.common.Race) TypedProperties(delta.common.utils.misc.TypedProperties)

Aggregations

ItemSelectionListener (delta.common.ui.swing.combobox.ItemSelectionListener)23 JPanel (javax.swing.JPanel)10 FlowLayout (java.awt.FlowLayout)8 GridBagConstraints (java.awt.GridBagConstraints)7 GridBagLayout (java.awt.GridBagLayout)7 Insets (java.awt.Insets)7 ComboBoxController (delta.common.ui.swing.combobox.ComboBoxController)2 DynamicTextEditionController (delta.common.ui.swing.text.DynamicTextEditionController)2 TextListener (delta.common.ui.swing.text.TextListener)2 Race (delta.games.lotro.common.Race)2 Profession (delta.games.lotro.lore.crafting.Profession)2 JLabel (javax.swing.JLabel)2 IntegerEditionController (delta.common.ui.swing.text.IntegerEditionController)1 DateEditionController (delta.common.ui.swing.text.dates.DateEditionController)1 TypedProperties (delta.common.utils.misc.TypedProperties)1 CharacterEvent (delta.games.lotro.character.events.CharacterEvent)1 LogItemType (delta.games.lotro.character.log.CharacterLogItem.LogItemType)1 CharacterClass (delta.games.lotro.common.CharacterClass)1 Size (delta.games.lotro.common.Size)1 VirtueId (delta.games.lotro.common.VirtueId)1