use of megamek.common.util.EncodeControl in project megameklab by MegaMek.
the class CVTransportView method initUI.
private void initUI() {
// $NON-NLS-1$
ResourceBundle resourceMap = ResourceBundle.getBundle("megameklab.resources.Views", new EncodeControl());
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.WEST;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("CVTransportView.lblFixed.text"), labelSize), gbc);
gbc.gridx = 2;
gbc.gridy = 0;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("CVTransportView.lblPod.text"), labelSize), gbc);
gbc.gridx = 0;
gbc.gridy = 1;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("CVTransportView.lblTroopSpace.text"), labelSizeLg), gbc);
gbc.gridx = 1;
setFieldSize(spnFixedTroop, editorSize);
add(spnFixedTroop, gbc);
spnFixedTroop.addChangeListener(this);
gbc.gridx = 2;
setFieldSize(spnPodTroop, editorSize);
add(spnPodTroop, gbc);
spnPodTroop.addChangeListener(this);
for (BayData bayType : BayData.values()) {
if (!bayType.isCargoBay()) {
continue;
}
String tooltip = String.format(resourceMap.getString("CVTransportView.bay.tooltipFormat"), 1 / bayType.getWeight());
gbc.gridx = 0;
gbc.gridy++;
add(createLabel(bayType.getDisplayName(), labelSizeLg), gbc);
gbc.gridx = 1;
SpinnerNumberModel model = new SpinnerNumberModel(0.0, 0.0, null, 0.5);
JSpinner spinner = new JSpinner(model);
spinner.setToolTipText(tooltip);
spinner.setName(bayType.toString());
setFieldSize(spinner, editorSize);
fixedSpinnerModels.put(bayType, model);
fixedSpinners.put(bayType, spinner);
add(spinner, gbc);
spinner.addChangeListener(this);
gbc.gridx = 2;
model = new SpinnerNumberModel(0.0, 0.0, null, 0.5);
spinner = new JSpinner(model);
spinner.setToolTipText(tooltip);
spinner.setName(bayType.toString());
setFieldSize(spinner, editorSize);
podSpinnerModels.put(bayType, model);
podSpinners.put(bayType, spinner);
add(spinner, gbc);
spinner.addChangeListener(this);
}
}
use of megamek.common.util.EncodeControl in project megameklab by MegaMek.
the class DropshipChassisView method initUI.
public void initUI() {
// $NON-NLS-1$
ResourceBundle resourceMap = ResourceBundle.getBundle("megameklab.resources.Views", new EncodeControl());
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
cbBaseType.setModel(new DefaultComboBoxModel<>(resourceMap.getString("DropshipChassisView.cbBaseType.values").split(",")));
cbChassisType.setModel(new DefaultComboBoxModel<>(resourceMap.getString("DropshipChassisView.cbChassisType.values").split(",")));
gbc.gridx = 0;
gbc.gridy = 0;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("DropshipChassisView.spnTonnage.text"), labelSize), gbc);
gbc.gridx = 1;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
// $NON-NLS-1$
spnTonnage.setToolTipText(resourceMap.getString("DropshipChassisView.spnTonnage.tooltip"));
add(spnTonnage, gbc);
spnTonnage.addChangeListener(this);
// $NON-NLS-1$
chkMilitary.setText(resourceMap.getString("DropshipChassisView.chkFunction.text"));
gbc.gridx = 2;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
// $NON-NLS-1$
chkMilitary.setToolTipText(resourceMap.getString("DropshipChassisView.chkFunction.tooltip"));
add(chkMilitary, gbc);
chkMilitary.addActionListener(this);
// $NON-NLS-1$
chkKFBoom.setText(resourceMap.getString("DropshipChassisView.chkKFBoom.text"));
gbc.gridx = 3;
gbc.gridy = 0;
// $NON-NLS-1$
chkKFBoom.setToolTipText(resourceMap.getString("DropshipChassisView.chkKFBoom.tooltip"));
add(chkKFBoom, gbc);
chkKFBoom.addActionListener(this);
chkKFBoom.setVisible(false);
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("DropshipChassisView.cbBaseType.text"), labelSize), gbc);
gbc.gridx = 1;
gbc.gridy = 2;
gbc.gridwidth = 3;
setFieldSize(cbBaseType, controlSize);
// $NON-NLS-1$
cbBaseType.setToolTipText(resourceMap.getString("DropshipChassisView.cbBaseType.tooltip"));
add(cbBaseType, gbc);
cbBaseType.addActionListener(this);
gbc.gridx = 0;
gbc.gridy = 3;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("DropshipChassisView.cbChassisType.text"), labelSize), gbc);
gbc.gridx = 1;
gbc.gridy = 3;
gbc.gridwidth = 3;
setFieldSize(cbChassisType, controlSize);
// $NON-NLS-1$
cbChassisType.setToolTipText(resourceMap.getString("DropshipChassisView.cbChassisType.tooltip"));
add(cbChassisType, gbc);
cbChassisType.addActionListener(this);
gbc.gridx = 0;
gbc.gridy = 4;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("DropshipChassisView.spnSI.text"), labelSize), gbc);
gbc.gridx = 1;
gbc.gridy = 4;
gbc.gridwidth = 3;
setFieldSize(spnSI, controlSize);
// $NON-NLS-1$
spnSI.setToolTipText(resourceMap.getString("DropshipChassisView.spnSI.tooltip"));
add(spnSI, gbc);
spnSI.addChangeListener(this);
}
use of megamek.common.util.EncodeControl in project megameklab by MegaMek.
the class HeatSinkView method initUI.
private void initUI() {
// $NON-NLS-1$
ResourceBundle resourceMap = ResourceBundle.getBundle("megameklab.resources.Views", new EncodeControl());
// $NON-NLS-1$
mechDisplayNames = resourceMap.getString("HeatSinkView.mechNames.values").split(",");
// $NON-NLS-1$
aeroDisplayNames = resourceMap.getString("HeatSinkView.aeroNames.values").split(",");
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("HeatSinkView.cbHSType.text"), labelSize), gbc);
gbc.gridx = 1;
gbc.gridy = 0;
gbc.gridwidth = 4;
setFieldSize(cbHSType, controlSize);
// $NON-NLS-1$
cbHSType.setToolTipText(resourceMap.getString("HeatSinkView.cbHSType.tooltip"));
add(cbHSType, gbc);
cbHSType.addActionListener(this);
spnCount.setModel(countModel);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("HeatSinkView.spnCount.text"), labelSize), gbc);
gbc.gridx = 1;
gbc.gridy = 1;
setFieldSize(spnCount.getEditor(), editorSize);
// $NON-NLS-1$
spnCount.setToolTipText(resourceMap.getString("HeatSinkView.spnCount.tooltip"));
add(spnCount, gbc);
spnCount.addChangeListener(this);
gbc.gridx = 3;
gbc.gridy = 1;
lblCritFreeText.setText(resourceMap.getString("HeatSinkView.lblCritFree.text"));
add(lblCritFreeText, gbc);
gbc.gridx = 4;
gbc.gridy = 1;
// $NON-NLS-1$
lblCritFreeCount.setToolTipText(resourceMap.getString("HeatSinkView.lblCritFree.tooltip"));
add(lblCritFreeCount, gbc);
spnBaseCount.setModel(baseCountModel);
gbc.gridx = 0;
gbc.gridy = 2;
// $NON-NLS-1$
lblBaseCount.setText(resourceMap.getString("HeatSinkView.spnBaseCount.text"));
add(lblBaseCount, gbc);
gbc.gridx = 1;
gbc.gridy = 2;
setFieldSize(spnBaseCount.getEditor(), editorSize);
// $NON-NLS-1$
spnBaseCount.setToolTipText(resourceMap.getString("HeatSinkView.spnBaseCount.tooltip"));
add(spnBaseCount, gbc);
spnBaseCount.addChangeListener(this);
gbc.gridx = 0;
gbc.gridy = 3;
lblWeightFreeText.setText(resourceMap.getString("HeatSinkView.lblWeightFree.text"));
add(lblWeightFreeText, gbc);
gbc.gridx = 1;
gbc.gridy = 3;
// $NON-NLS-1$
lblWeightFreeCount.setToolTipText(resourceMap.getString("HeatSinkView.lblWeightFree.tooltip"));
add(lblWeightFreeCount, gbc);
}
use of megamek.common.util.EncodeControl in project megameklab by MegaMek.
the class MVFArmorView method initUI.
private void initUI() {
// $NON-NLS-1$
ResourceBundle resourceMap = ResourceBundle.getBundle("megameklab.resources.Views", new EncodeControl());
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("ArmorView.cbArmorType.text"), labelSize), gbc);
gbc.gridx = 1;
gbc.gridy = 0;
gbc.gridwidth = 2;
setFieldSize(cbArmorType, controlSize);
cbArmorType.setNullValue(EquipmentType.armorNames[EquipmentType.T_ARMOR_PATCHWORK]);
// $NON-NLS-1$
cbArmorType.setToolTipText(resourceMap.getString("ArmorView.cbArmorType.tooltip"));
add(cbArmorType, gbc);
cbArmorType.addActionListener(this);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("ArmorView.spnTonnage.text"), labelSize), gbc);
gbc.gridx = 1;
gbc.gridy = 1;
setFieldSize(spnTonnage, spinnerSizeLg);
// $NON-NLS-1$
spnTonnage.setToolTipText(resourceMap.getString("ArmorView.spnTonnage.tooltip"));
add(spnTonnage, gbc);
spnTonnage.addChangeListener(this);
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridwidth = 3;
// $NON-NLS-1$
btnMaximize.setText(resourceMap.getString("ArmorView.btnMaximize.text"));
btnMaximize.setActionCommand(CMD_MAXIMIZE);
setFieldSize(btnMaximize, controlSize);
// $NON-NLS-1$
btnMaximize.setToolTipText(resourceMap.getString("ArmorView.btnMaximize.tooltip"));
add(btnMaximize, gbc);
btnMaximize.addActionListener(this);
gbc.gridx = 0;
gbc.gridy = 3;
gbc.gridwidth = 3;
// $NON-NLS-1$
btnUseRemaining.setText(resourceMap.getString("ArmorView.btnRemaining.text"));
btnUseRemaining.setActionCommand(CMD_REMAINING);
setFieldSize(btnUseRemaining, controlSize);
// $NON-NLS-1$
btnUseRemaining.setToolTipText(resourceMap.getString("ArmorView.btnRemaining.tooltip"));
add(btnUseRemaining, gbc);
btnUseRemaining.addActionListener(this);
}
use of megamek.common.util.EncodeControl in project megameklab by MegaMek.
the class CIPlatoonTypeView method initUI.
private void initUI() {
// $NON-NLS-1$
ResourceBundle resourceMap = ResourceBundle.getBundle("megameklab.resources.Views", new EncodeControl());
// $NON-NLS-1$
motiveNames = resourceMap.getString("PlatoonTypeView.cbMotiveType.values").split(",");
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(0, 0, 1, 2);
// $NON-NLS-1$
add(new JLabel(resourceMap.getString("PlatoonTypeView.cbMotiveType.text")), gbc);
gbc.gridx = 1;
gbc.gridy = 0;
gbc.gridwidth = 3;
setFieldSize(cbMotiveType, controlSize);
// $NON-NLS-1$
cbMotiveType.setToolTipText(resourceMap.getString("PlatoonTypeView.cbMotiveType.tooltip"));
add(cbMotiveType, gbc);
cbMotiveType.addActionListener(this);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(new JLabel(resourceMap.getString("PlatoonTypeView.spnNumSquads.text")), gbc);
gbc.gridx = 1;
gbc.gridy = 1;
gbc.gridwidth = 3;
setFieldSize(spnNumSquads, spinnerSize);
// $NON-NLS-1$
spnNumSquads.setToolTipText(resourceMap.getString("PlatoonTypeView.spnNumSquads.tooltip"));
add(spnNumSquads, gbc);
spnNumSquads.addChangeListener(this);
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(new JLabel(resourceMap.getString("PlatoonTypeView.spnSquadSize.text")), gbc);
gbc.gridx = 1;
gbc.gridy = 2;
gbc.gridwidth = 3;
setFieldSize(spnSquadSize, spinnerSize);
// $NON-NLS-1$
spnSquadSize.setToolTipText(resourceMap.getString("PlatoonTypeView.spnSquadSize.tooltip"));
add(spnSquadSize, gbc);
spnSquadSize.addChangeListener(this);
gbc.insets = new Insets(0, 5, 0, 5);
gbc.gridx = 0;
gbc.gridy = 3;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(new JLabel(resourceMap.getString("PlatoonTypeView.lblMaxSize.text")), gbc);
gbc.gridx = 1;
gbc.gridy = 3;
// $NON-NLS-1$
lblMaxSize.setToolTipText(resourceMap.getString("PlatoonTypeView.lblMaxSize.tooltip"));
add(lblMaxSize, gbc);
gbc.gridx = 2;
gbc.gridy = 3;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(new JLabel(resourceMap.getString("PlatoonTypeView.lblMaxSquadSize.text")), gbc);
gbc.gridx = 3;
gbc.gridy = 3;
// $NON-NLS-1$
lblMaxSquadSize.setToolTipText(resourceMap.getString("PlatoonTypeView.lblMaxSquadSize.tooltip"));
add(lblMaxSquadSize, gbc);
}
Aggregations