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;
}
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;
}
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;
}
Aggregations