Search in sources :

Example 1 with TechComboBox

use of megameklab.com.ui.util.TechComboBox in project megameklab by MegaMek.

the class PatchworkArmorView method initUI.

private void initUI() {
    // $NON-NLS-1$
    ResourceBundle resourceMap = ResourceBundle.getBundle("megameklab.resources.Views", new EncodeControl());
    setLayout(new GridBagLayout());
    setBorder(BorderFactory.createTitledBorder(// $NON-NLS-1$
    null, // $NON-NLS-1$
    resourceMap.getString("ArmorAllocationView.panPatwork.title"), TitledBorder.TOP, TitledBorder.DEFAULT_POSITION));
    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.insets = new Insets(0, 5, 0, 5);
    for (int loc = 0; loc < MAX_LOC; loc++) {
        JLabel label = new JLabel();
        TechComboBox<EquipmentType> combo = new TechComboBox<>(eq -> eq.getName());
        combo.setActionCommand(Integer.toString(loc));
        combo.addActionListener(this);
        labels.add(label);
        combos.add(combo);
        gbc.gridx = 0;
        gbc.anchor = GridBagConstraints.EAST;
        add(label, gbc);
        gbc.gridx = 1;
        gbc.anchor = GridBagConstraints.WEST;
        add(combo, gbc);
        gbc.gridy++;
    }
}
Also used : TechComboBox(megameklab.com.ui.util.TechComboBox) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) EncodeControl(megamek.common.util.EncodeControl) JLabel(javax.swing.JLabel) ResourceBundle(java.util.ResourceBundle) EquipmentType(megamek.common.EquipmentType)

Aggregations

GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 ResourceBundle (java.util.ResourceBundle)1 JLabel (javax.swing.JLabel)1 EquipmentType (megamek.common.EquipmentType)1 EncodeControl (megamek.common.util.EncodeControl)1 TechComboBox (megameklab.com.ui.util.TechComboBox)1