Search in sources :

Example 1 with EntityMovementMode

use of megamek.common.EntityMovementMode in project megameklab by MegaMek.

the class CVChassisView method initUI.

private void initUI() {
    // $NON-NLS-1$
    ResourceBundle resourceMap = ResourceBundle.getBundle("megameklab.resources.Views", new EncodeControl());
    // $NON-NLS-1$
    turretNames = resourceMap.getString("CVChassisView.turrets.values").split(",");
    for (EntityMovementMode m : MOTIVE_TYPES) {
        motiveNames.put(m, resourceMap.getString("MovementMode." + m.toString()));
    }
    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.WEST;
    // $NON-NLS-1$
    add(createLabel(resourceMap.getString("CVChassisView.spnTonnage.text"), labelSize), gbc);
    gbc.gridx = 1;
    gbc.gridy = 0;
    setFieldSize(spnTonnage, spinnerSize);
    // $NON-NLS-1$
    spnTonnage.setToolTipText(resourceMap.getString("CVChassisView.spnTonnage.tooltip"));
    add(spnTonnage, gbc);
    spnTonnage.addChangeListener(this);
    // $NON-NLS-1$
    chkOmni.setText(resourceMap.getString("CVChassisView.chkOmni.text"));
    gbc.gridx = 2;
    // $NON-NLS-1$
    chkOmni.setToolTipText(resourceMap.getString("CVChassisView.chkOmni.tooltip"));
    add(chkOmni, gbc);
    chkOmni.addActionListener(this);
    // $NON-NLS-1$
    chkSuperheavy.setText(resourceMap.getString("CVChassisView.chkSuperheavy.text"));
    gbc.gridx = 3;
    // $NON-NLS-1$
    chkSuperheavy.setToolTipText(resourceMap.getString("CVChassisView.chkSuperheavy.tooltip"));
    add(chkSuperheavy, gbc);
    chkSuperheavy.addActionListener(this);
    cbMotiveType.setModel(new DefaultComboBoxModel<>(MOTIVE_TYPES));
    gbc.gridx = 0;
    gbc.gridy = 1;
    // $NON-NLS-1$
    add(createLabel(resourceMap.getString("CVChassisView.cbMotiveType.text"), labelSize), gbc);
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.gridwidth = 3;
    setFieldSize(cbMotiveType, controlSize);
    // $NON-NLS-1$
    cbMotiveType.setToolTipText(resourceMap.getString("CVChassisView.cbMotiveType.tooltip"));
    add(cbMotiveType, gbc);
    cbMotiveType.addActionListener(this);
    gbc.gridx = 0;
    gbc.gridy = 2;
    gbc.gridwidth = 1;
    // $NON-NLS-1$
    add(createLabel(resourceMap.getString("CVChassisView.cbEngine.text"), labelSize), gbc);
    gbc.gridx = 1;
    gbc.gridy = 2;
    gbc.gridwidth = 3;
    setFieldSize(cbEngine, controlSize);
    // $NON-NLS-1$
    cbEngine.setToolTipText(resourceMap.getString("CVChassisView.cbEngine.tooltip"));
    add(cbEngine, gbc);
    cbEngine.addActionListener(this);
    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.gridwidth = 1;
    // $NON-NLS-1$
    add(createLabel(resourceMap.getString("CVChassisView.cbTurrets.text"), labelSize), gbc);
    gbc.gridx = 1;
    gbc.gridy = 3;
    gbc.gridwidth = 3;
    setFieldSize(cbTurrets, controlSize);
    // $NON-NLS-1$
    cbTurrets.setToolTipText(resourceMap.getString("CVChassisView.cbTurrets.tooltip"));
    add(cbTurrets, gbc);
    cbTurrets.addActionListener(this);
    gbc.gridx = 0;
    gbc.gridy = 4;
    gbc.gridwidth = 3;
    // $NON-NLS-1$
    JLabel lbl = createLabel(resourceMap.getString("CVChassisView.spnTurretWt.text"), labelSize);
    add(lbl, gbc);
    gbc.gridx = 3;
    gbc.gridy = 4;
    setFieldSize(spnChassisTurretWt, spinnerSize);
    // $NON-NLS-1$
    spnChassisTurretWt.setToolTipText(resourceMap.getString("CVChassisView.spnTurretWt.tooltip"));
    add(spnChassisTurretWt, gbc);
    spnChassisTurretWt.addChangeListener(this);
    omniComponents.add(lbl);
    omniComponents.add(spnChassisTurretWt);
    gbc.gridx = 0;
    gbc.gridy = 5;
    gbc.gridwidth = 3;
    // $NON-NLS-1$
    lbl = createLabel(resourceMap.getString("CVChassisView.spnTurret2Wt.text"), labelSize);
    add(lbl, gbc);
    gbc.gridx = 3;
    gbc.gridy = 5;
    gbc.gridwidth = 1;
    setFieldSize(spnChassisTurret2Wt, spinnerSize);
    // $NON-NLS-1$
    spnChassisTurret2Wt.setToolTipText(resourceMap.getString("CVChassisView.spnTurret2Wt.tooltip"));
    add(spnChassisTurret2Wt, gbc);
    spnChassisTurret2Wt.addChangeListener(this);
    omniComponents.add(lbl);
    omniComponents.add(spnChassisTurret2Wt);
    // $NON-NLS-1$
    JButton btnResetChassis = new JButton(resourceMap.getString("CVChassisView.btnResetChassis.text"));
    btnResetChassis.setActionCommand(CMD_RESET_CHASSIS);
    gbc.gridx = 1;
    gbc.gridy = 6;
    gbc.gridwidth = 3;
    setFieldSize(btnResetChassis, controlSize);
    // $NON-NLS-1$
    btnResetChassis.setToolTipText(resourceMap.getString("CVChassisView.btnResetChassis.tooltip"));
    add(btnResetChassis, gbc);
    btnResetChassis.addActionListener(this);
    omniComponents.add(btnResetChassis);
}
Also used : EntityMovementMode(megamek.common.EntityMovementMode) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) EncodeControl(megamek.common.util.EncodeControl) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) ResourceBundle(java.util.ResourceBundle)

Example 2 with EntityMovementMode

use of megamek.common.EntityMovementMode in project megameklab by MegaMek.

the class CVChassisView method initUI.

private void initUI() {
    ResourceBundle resourceMap = ResourceBundle.getBundle("megameklab.resources.Views", new EncodeControl());
    turretNames = resourceMap.getString("CVChassisView.turrets.values").split(",");
    for (EntityMovementMode m : MOTIVE_TYPES) {
        motiveNames.put(m, m.toString());
    }
    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.WEST;
    add(createLabel(resourceMap.getString("CVChassisView.spnTonnage.text"), labelSize), gbc);
    gbc.gridx = 1;
    gbc.gridy = 0;
    setFieldSize(spnTonnage, spinnerSize);
    spnTonnage.setToolTipText(resourceMap.getString("CVChassisView.spnTonnage.tooltip"));
    add(spnTonnage, gbc);
    spnTonnage.addChangeListener(this);
    // $NON-NLS-1$
    chkOmni.setText(resourceMap.getString("CVChassisView.chkOmni.text"));
    gbc.gridx = 2;
    // $NON-NLS-1$
    chkOmni.setToolTipText(resourceMap.getString("CVChassisView.chkOmni.tooltip"));
    add(chkOmni, gbc);
    chkOmni.addActionListener(this);
    // $NON-NLS-1$
    chkSuperheavy.setText(resourceMap.getString("CVChassisView.chkSuperheavy.text"));
    gbc.gridx = 3;
    // $NON-NLS-1$
    chkSuperheavy.setToolTipText(resourceMap.getString("CVChassisView.chkSuperheavy.tooltip"));
    add(chkSuperheavy, gbc);
    chkSuperheavy.addActionListener(this);
    gbc.gridy++;
    // $NON-NLS-1$
    chkTrailer.setText(resourceMap.getString("CVChassisView.chkTrailer.text"));
    gbc.gridx = 0;
    gbc.gridwidth = 2;
    // $NON-NLS-1$
    chkTrailer.setToolTipText(resourceMap.getString("CVChassisView.chkTrailer.tooltip"));
    chkTrailer.setHorizontalAlignment(SwingConstants.RIGHT);
    add(chkTrailer, gbc);
    chkTrailer.addActionListener(this);
    // $NON-NLS-1$
    chkControlSystems.setText(resourceMap.getString("CVChassisView.chkControlSystems.text"));
    gbc.gridx = 2;
    // $NON-NLS-1$
    chkControlSystems.setToolTipText(resourceMap.getString("CVChassisView.chkControlSystems.tooltip"));
    add(chkControlSystems, gbc);
    chkControlSystems.addActionListener(this);
    gbc.gridwidth = 1;
    gbc.gridy++;
    cbMotiveType.setModel(new DefaultComboBoxModel<>(MOTIVE_TYPES));
    gbc.gridx = 0;
    // $NON-NLS-1$
    add(createLabel(resourceMap.getString("CVChassisView.cbMotiveType.text"), labelSize), gbc);
    gbc.gridx = 1;
    gbc.gridwidth = 3;
    setFieldSize(cbMotiveType, controlSize);
    // $NON-NLS-1$
    cbMotiveType.setToolTipText(resourceMap.getString("CVChassisView.cbMotiveType.tooltip"));
    add(cbMotiveType, gbc);
    cbMotiveType.addActionListener(this);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.gridwidth = 1;
    // $NON-NLS-1$
    add(createLabel(resourceMap.getString("CVChassisView.cbEngine.text"), labelSize), gbc);
    gbc.gridx = 1;
    gbc.gridwidth = 3;
    setFieldSize(cbEngine, controlSize);
    // $NON-NLS-1$
    cbEngine.setToolTipText(resourceMap.getString("CVChassisView.cbEngine.tooltip"));
    add(cbEngine, gbc);
    cbEngine.addActionListener(this);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.gridwidth = 2;
    add(createLabel(resourceMap.getString("CVChassisView.spnExtraSeats.text"), labelSize), gbc);
    gbc.gridx = 2;
    gbc.gridwidth = 2;
    setFieldSize(spnExtraSeats, spinnerSize);
    spnExtraSeats.setToolTipText("CVChassisView.spnExtraSeats.tooltip");
    add(spnExtraSeats, gbc);
    spnExtraSeats.addChangeListener(this);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.gridwidth = 1;
    // $NON-NLS-1$
    add(createLabel(resourceMap.getString("CVChassisView.cbTurrets.text"), labelSize), gbc);
    gbc.gridx = 1;
    gbc.gridwidth = 3;
    setFieldSize(cbTurrets, controlSize);
    // $NON-NLS-1$
    cbTurrets.setToolTipText(resourceMap.getString("CVChassisView.cbTurrets.tooltip"));
    add(cbTurrets, gbc);
    cbTurrets.addActionListener(this);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.gridwidth = 3;
    // $NON-NLS-1$
    JLabel lbl = createLabel(resourceMap.getString("CVChassisView.spnTurretWt.text"), labelSize);
    add(lbl, gbc);
    gbc.gridx = 3;
    setFieldSize(spnChassisTurretWt, spinnerSize);
    // $NON-NLS-1$
    spnChassisTurretWt.setToolTipText(resourceMap.getString("CVChassisView.spnTurretWt.tooltip"));
    add(spnChassisTurretWt, gbc);
    spnChassisTurretWt.addChangeListener(this);
    omniComponents.add(lbl);
    omniComponents.add(spnChassisTurretWt);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.gridwidth = 3;
    // $NON-NLS-1$
    lbl = createLabel(resourceMap.getString("CVChassisView.spnTurret2Wt.text"), labelSize);
    add(lbl, gbc);
    gbc.gridx = 3;
    gbc.gridwidth = 1;
    setFieldSize(spnChassisTurret2Wt, spinnerSize);
    // $NON-NLS-1$
    spnChassisTurret2Wt.setToolTipText(resourceMap.getString("CVChassisView.spnTurret2Wt.tooltip"));
    add(spnChassisTurret2Wt, gbc);
    spnChassisTurret2Wt.addChangeListener(this);
    omniComponents.add(lbl);
    omniComponents.add(spnChassisTurret2Wt);
    gbc.gridy++;
    // $NON-NLS-1$
    JButton btnResetChassis = new JButton(resourceMap.getString("CVChassisView.btnResetChassis.text"));
    btnResetChassis.setActionCommand(CMD_RESET_CHASSIS);
    gbc.gridx = 1;
    gbc.gridwidth = 3;
    setFieldSize(btnResetChassis, controlSize);
    // $NON-NLS-1$
    btnResetChassis.setToolTipText(resourceMap.getString("CVChassisView.btnResetChassis.tooltip"));
    add(btnResetChassis, gbc);
    btnResetChassis.addActionListener(this);
    omniComponents.add(btnResetChassis);
}
Also used : EntityMovementMode(megamek.common.EntityMovementMode) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) EncodeControl(megamek.common.util.EncodeControl)

Aggregations

GridBagConstraints (java.awt.GridBagConstraints)2 GridBagLayout (java.awt.GridBagLayout)2 EntityMovementMode (megamek.common.EntityMovementMode)2 EncodeControl (megamek.common.util.EncodeControl)2 ResourceBundle (java.util.ResourceBundle)1 JButton (javax.swing.JButton)1 JLabel (javax.swing.JLabel)1