use of megamek.common.util.EncodeControl in project megameklab by MegaMek.
the class WSChassisView 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("AdvAeroChassisView.cbBaseType.values").split(",")));
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 2;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("AdvAeroChassisView.spnTonnage.text"), labelSize), gbc);
gbc.gridx = 2;
gbc.gridy = 0;
gbc.gridwidth = 2;
gbc.fill = GridBagConstraints.HORIZONTAL;
// $NON-NLS-1$
spnTonnage.setToolTipText(resourceMap.getString("AdvAeroChassisView.spnTonnage.tooltip"));
add(spnTonnage, gbc);
spnTonnage.addChangeListener(this);
// $NON-NLS-1$
chkSail.setText(resourceMap.getString("AdvAeroChassisView.chkSail.text"));
gbc.gridx = 4;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.NONE;
gbc.gridwidth = 1;
// $NON-NLS-1$
chkSail.setToolTipText(resourceMap.getString("AdvAeroChassisView.chkSail.tooltip"));
add(chkSail, gbc);
chkSail.addActionListener(this);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 2;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("AdvAeroChassisView.cbBaseType.text"), labelSize), gbc);
gbc.gridx = 2;
gbc.gridy = 1;
gbc.gridwidth = 2;
gbc.fill = GridBagConstraints.HORIZONTAL;
setFieldSize(cbBaseType, controlSize);
// $NON-NLS-1$
cbBaseType.setToolTipText(resourceMap.getString("AdvAeroChassisView.cbBaseType.tooltip"));
add(cbBaseType, gbc);
cbBaseType.addActionListener(this);
// $NON-NLS-1$
chkMilitary.setText(resourceMap.getString("AdvAeroChassisView.chkMilitary.text"));
gbc.gridx = 4;
gbc.gridy = 1;
gbc.fill = GridBagConstraints.NONE;
gbc.gridwidth = 1;
// $NON-NLS-1$
chkMilitary.setToolTipText(resourceMap.getString("AdvAeroChassisView.chkMilitary.tooltip"));
add(chkMilitary, gbc);
chkMilitary.addActionListener(this);
// $NON-NLS-1$
chkLFBattery.setText(resourceMap.getString("AdvAeroChassisView.chkLFBattery.text"));
gbc.gridx = 2;
gbc.gridy = 2;
gbc.fill = GridBagConstraints.NONE;
gbc.gridwidth = 2;
// $NON-NLS-1$
chkLFBattery.setToolTipText(resourceMap.getString("AdvAeroChassisView.chkLFBattery.tooltip"));
add(chkLFBattery, gbc);
chkLFBattery.addActionListener(this);
gbc.gridx = 0;
gbc.gridy = 3;
// $NON-NLS-1$
lblRange.setText(resourceMap.getString("AdvAeroChassisView.spnRange.text"));
gbc.gridwidth = 2;
add(lblRange, gbc);
gbc.gridx = 2;
gbc.gridy = 3;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridwidth = 2;
// $NON-NLS-1$
spnRange.setToolTipText(resourceMap.getString("AdvAeroChassisView.spnRange.tooltip"));
add(spnRange, gbc);
spnRange.addChangeListener(this);
gbc.gridx = 0;
gbc.gridy = 4;
gbc.gridwidth = 2;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("AdvAeroChassisView.spnSI.text"), labelSize), gbc);
gbc.gridx = 2;
gbc.gridy = 4;
gbc.gridwidth = 2;
setFieldSize(spnSI, controlSize);
// $NON-NLS-1$
spnSI.setToolTipText(resourceMap.getString("AdvAeroChassisView.spnSI.tooltip"));
add(spnSI, gbc);
spnSI.addChangeListener(this);
// $NON-NLS-1$
chkModular.setText(resourceMap.getString("AdvAeroChassisView.chkModular.text"));
gbc.gridx = 4;
gbc.gridy = 4;
gbc.fill = GridBagConstraints.NONE;
gbc.gridwidth = 1;
// $NON-NLS-1$
chkModular.setToolTipText(resourceMap.getString("AdvAeroChassisView.chkModular.tooltip"));
add(chkModular, gbc);
chkModular.addActionListener(this);
}
use of megamek.common.util.EncodeControl in project megameklab by MegaMek.
the class CIWeaponView method initUI.
private void initUI() {
// $NON-NLS-1$
ResourceBundle resourceMap = ResourceBundle.getBundle("megameklab.resources.Views", new EncodeControl());
// $NON-NLS-1$
fgMotiveMsg = resourceMap.getString("InfantryWeaponView.txtGuns.badMotive");
// $NON-NLS-1$
noneMsg = resourceMap.getString("InfantryWeaponView.none");
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("InfantryWeaponView.txtPrimary.text")), gbc);
gbc.gridx = 1;
gbc.gridy = 0;
gbc.gridwidth = 3;
// $NON-NLS-1$
txtPrimary.setToolTipText(resourceMap.getString("InfantryWeaponView.txtPrimary.tooltip"));
setFieldSize(txtPrimary, controlSize);
txtPrimary.setEditable(false);
add(txtPrimary, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(new JLabel(resourceMap.getString("InfantryWeaponView.txtSecondary.text")), gbc);
gbc.gridx = 1;
gbc.gridy = 1;
gbc.gridwidth = 3;
setFieldSize(txtSecondary, controlSize);
// $NON-NLS-1$
txtSecondary.setToolTipText(resourceMap.getString("InfantryWeaponView.txtSecondary.tooltip"));
txtSecondary.setEditable(false);
add(txtSecondary, gbc);
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(new JLabel(resourceMap.getString("InfantryWeaponView.cbNumSecondary.text")), gbc);
gbc.gridx = 1;
gbc.gridy = 2;
gbc.gridwidth = 3;
setFieldSize(cbNumSecondary, controlSize);
// $NON-NLS-1$
cbNumSecondary.setToolTipText(resourceMap.getString("InfantryWeaponView.cbNumSecondary.tooltip"));
add(cbNumSecondary, gbc);
cbNumSecondary.addActionListener(this);
gbc.gridx = 0;
gbc.gridy = 3;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(new JLabel(resourceMap.getString("InfantryWeaponView.txtGuns.text")), gbc);
gbc.gridx = 1;
gbc.gridy = 3;
gbc.gridwidth = 3;
setFieldSize(txtGuns, controlSize);
// $NON-NLS-1$
txtGuns.setToolTipText(resourceMap.getString("InfantryWeaponView.txtGuns.tooltip"));
txtGuns.setEditable(false);
add(txtGuns, gbc);
gbc.gridx = 0;
gbc.gridy = 4;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(new JLabel(resourceMap.getString("InfantryWeaponView.cbNumGuns.text")), gbc);
gbc.gridx = 1;
gbc.gridy = 4;
gbc.gridwidth = 3;
setFieldSize(cbNumGuns, controlSize);
// $NON-NLS-1$
cbNumGuns.setToolTipText(resourceMap.getString("InfantryWeaponView.cbNumGuns.tooltip"));
add(cbNumGuns, gbc);
cbNumGuns.addActionListener(this);
// $NON-NLS-1$
chkAntiMek.setText(resourceMap.getString("InfantryWeaponView.chkAntiMek.text"));
gbc.gridx = 0;
gbc.gridy = 5;
gbc.gridwidth = 2;
chkAntiMek.setHorizontalTextPosition(SwingConstants.LEFT);
// $NON-NLS-1$
chkAntiMek.setToolTipText(resourceMap.getString("InfantryWeaponView.chkAntiMek.tooltip"));
add(chkAntiMek, gbc);
chkAntiMek.addActionListener(this);
}
use of megamek.common.util.EncodeControl in project megameklab by MegaMek.
the class MovementView method initUI.
private void initUI() {
// $NON-NLS-1$
ResourceBundle resourceMap = ResourceBundle.getBundle("megameklab.resources.Views", new EncodeControl());
// $NON-NLS-1$
walkNames = resourceMap.getString("MovementView.lblWalk.values").split(",");
// $NON-NLS-1$
runNames = resourceMap.getString("MovementView.lblRun.values").split(",");
// $NON-NLS-1$
jumpNames = resourceMap.getString("MovementView.lblJump.values").split(",");
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(new JLabel(resourceMap.getString("MovementView.lblBase.text")), gbc);
gbc.gridx = 2;
gbc.gridy = 0;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(new JLabel(resourceMap.getString("MovementView.lblFinal.text")), gbc);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 1;
add(lblWalk, gbc);
gbc.gridx = 1;
gbc.gridy = 1;
gbc.fill = GridBagConstraints.NONE;
// $NON-NLS-1$
spnWalk.setToolTipText(resourceMap.getString("MovementView.spnWalk.tooltip"));
add(spnWalk, gbc);
gbc.gridx = 2;
gbc.gridy = 1;
gbc.fill = GridBagConstraints.NONE;
// $NON-NLS-1$
txtWalkFinal.setToolTipText(resourceMap.getString("MovementView.txtWalkFinal.tooltip"));
add(txtWalkFinal, gbc);
spnWalk.addChangeListener(this);
gbc.gridx = 0;
gbc.gridy = 2;
add(lblRun, gbc);
gbc.gridx = 1;
gbc.gridy = 2;
// $NON-NLS-1$
txtRunBase.setToolTipText(resourceMap.getString("MovementView.txtRunBase.tooltip"));
add(txtRunBase, gbc);
gbc.gridx = 2;
gbc.gridy = 2;
gbc.fill = GridBagConstraints.NONE;
// $NON-NLS-1$
txtRunFinal.setToolTipText(resourceMap.getString("MovementView.txtRunFinal.tooltip"));
add(txtRunFinal, gbc);
gbc.gridx = 0;
gbc.gridy = 3;
add(lblJump, gbc);
gbc.gridx = 1;
gbc.gridy = 3;
// $NON-NLS-1$
spnJump.setToolTipText(resourceMap.getString("MovementView.spnJump.tooltip"));
add(spnJump, gbc);
gbc.gridx = 2;
gbc.gridy = 3;
gbc.fill = GridBagConstraints.NONE;
// $NON-NLS-1$
txtJumpFinal.setToolTipText(resourceMap.getString("MovementView.txtJumpFinal.tooltip"));
add(txtJumpFinal, gbc);
spnJump.addChangeListener(this);
// $NON-NLS-1$
lblJumpType.setText(resourceMap.getString("MovementView.cbJumpType.text"));
// $NON-NLS-1$
cbJumpType.setNullValue(resourceMap.getString("MovementView.cbJumpType.null"));
gbc.gridx = 0;
gbc.gridy = 4;
add(lblJumpType, gbc);
gbc.gridx = 1;
gbc.gridy = 4;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridwidth = 2;
// $NON-NLS-1$
cbJumpType.setToolTipText(resourceMap.getString("MovementView.cbJumpType.tooltip"));
add(cbJumpType, gbc);
cbJumpType.addActionListener(this);
setFieldSize(spnWalk.getEditor(), editorSize);
setFieldSize(txtWalkFinal, editorSize);
txtWalkFinal.setEditable(false);
txtWalkFinal.setHorizontalAlignment(SwingConstants.RIGHT);
setFieldSize(txtRunBase, editorSize);
setFieldSize(txtRunFinal, editorSize);
txtRunBase.setEditable(false);
txtRunFinal.setEditable(false);
txtRunFinal.setHorizontalAlignment(SwingConstants.RIGHT);
setFieldSize(spnJump.getEditor(), editorSize);
setFieldSize(txtJumpFinal, editorSize);
txtJumpFinal.setEditable(false);
txtJumpFinal.setHorizontalAlignment(SwingConstants.RIGHT);
}
use of megamek.common.util.EncodeControl 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<>(EquipmentType::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++;
}
}
use of megamek.common.util.EncodeControl in project megameklab by MegaMek.
the class TransportTab method initUI.
private void initUI() {
ResourceBundle resourceMap = ResourceBundle.getBundle("megameklab.resources.Tabs", new EncodeControl());
setLayout(new BorderLayout());
if (getEntity().hasETypeFlag(Entity.ETYPE_JUMPSHIP)) {
JPanel panHardpoints = new JPanel();
// $NON-NLS-1$
lblDockingHardpoints.setText(resourceMap.getString("TransportTab.spnDockingHardpoints.text"));
panHardpoints.add(lblDockingHardpoints);
panHardpoints.add(spnDockingHardpoints);
Dimension size = new Dimension(60, 25);
spnDockingHardpoints.setPreferredSize(size);
add(panHardpoints, BorderLayout.NORTH);
spnDockingHardpoints.addChangeListener(this);
// $NON-NLS-1$
spnDockingHardpoints.setToolTipText(resourceMap.getString("TransportTab.spnDockingHardpoints.tooltip"));
// $NON-NLS-1$
panHardpoints.add(new JLabel(resourceMap.getString("TransportTab.spnMaxHardpoints.text")));
panHardpoints.add(lblMaxHardpoints);
// $NON-NLS-1$
lblMaxHardpoints.setToolTipText(resourceMap.getString("TransportTab.spnMaxHardpoints.tooltip"));
} else {
Dimension size = new Dimension(60, 25);
spnTroopSpace.setPreferredSize(size);
spnPodTroopSpace.setPreferredSize(size);
panTroopspace.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
// $NON-NLS-1$
panTroopspace.add(new JLabel(resourceMap.getString("TransportTab.spnTroopspace.text")), gbc);
// $NON-NLS-1$
spnTroopSpace.setToolTipText(resourceMap.getString("TransportTab.spnTroopspace.tooltip"));
spnTroopSpace.addChangeListener(this);
gbc.gridx = 1;
panTroopspace.add(spnTroopSpace, gbc);
if (getEntity().isSupportVehicle()) {
gbc.gridx = 0;
gbc.gridy = 1;
// $NON-NLS-1$
panTroopspace.add(new JLabel(resourceMap.getString("TransportTab.spnPodTroopspace.text")), gbc);
// $NON-NLS-1$
spnTroopSpace.setToolTipText(resourceMap.getString("TransportTab.spnPodTroopspace.tooltip"));
gbc.gridx = 1;
panTroopspace.add(spnPodTroopSpace, gbc);
spnPodTroopSpace.addChangeListener(this);
}
add(panTroopspace, BorderLayout.NORTH);
}
JPanel bayPanel = new JPanel(new GridBagLayout());
add(bayPanel, BorderLayout.CENTER);
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(5, 5, 5, 5);
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 2;
// $NON-NLS-1$
bayPanel.add(new JLabel(resourceMap.getString("TransportTab.lblCurrentBays.text")), gbc);
gbc.gridy++;
if (getEntity().isAero()) {
gbc.gridwidth = 1;
// $NON-NLS-1$
bayPanel.add(new JLabel(resourceMap.getString("TransportTab.lblMaxDoors.text")), gbc);
gbc.gridx = 1;
bayPanel.add(lblMaxDoors, gbc);
}
gbc.gridx = 0;
gbc.gridy++;
gbc.gridwidth = 1;
// $NON-NLS-1$
btnRemoveBay.setText(resourceMap.getString("TransportTab.btnRemoveBay.text"));
// $NON-NLS-1$
btnRemoveBay.setToolTipText(resourceMap.getString("TransportTab.btnRemoveBay.tooltip"));
bayPanel.add(btnRemoveBay, gbc);
btnRemoveBay.addActionListener(this);
gbc.gridx = 1;
// $NON-NLS-1$
btnAddToCargo.setText(resourceMap.getString("TransportTab.btnAddToCargo.text"));
// $NON-NLS-1$
btnAddToCargo.setToolTipText(resourceMap.getString("TransportTab.btnAddToCargo.tooltip"));
bayPanel.add(btnAddToCargo, gbc);
btnAddToCargo.addActionListener(this);
gbc.gridx = 0;
gbc.gridy++;
gbc.gridwidth = 3;
gbc.gridheight = GridBagConstraints.REMAINDER;
bayPanel.add(new JScrollPane(tblInstalled), gbc);
gbc.gridx = 3;
gbc.gridy = 0;
gbc.gridwidth = 1;
gbc.gridheight = 1;
// $NON-NLS-1$
bayPanel.add(new JLabel(resourceMap.getString("TransportTab.lblAvailableBays.text")), gbc);
gbc.gridy = 2;
// $NON-NLS-1$
btnAddBay.setText(resourceMap.getString("TransportTab.btnAddBay.text"));
// $NON-NLS-1$
btnAddBay.setToolTipText(resourceMap.getString("TransportTab.btnAddBay.tooltip"));
bayPanel.add(btnAddBay, gbc);
btnAddBay.addActionListener(this);
gbc.gridy++;
gbc.gridwidth = 2;
gbc.gridheight = GridBagConstraints.REMAINDER;
bayPanel.add(new JScrollPane(tblAvailable), gbc);
tblInstalled.setRowHeight(24);
TableColumn col = tblInstalled.getColumnModel().getColumn(InstalledBaysModel.COL_SIZE);
col.setCellEditor(new SpinnerCellEditor(InstalledBaysModel.COL_SIZE));
DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
// $NON-NLS-1$
renderer.setToolTipText(resourceMap.getString("TransportTab.colSize.tooltip"));
col.setCellRenderer(renderer);
col = tblInstalled.getColumnModel().getColumn(InstalledBaysModel.COL_DOORS);
col.setCellEditor(new SpinnerCellEditor(InstalledBaysModel.COL_DOORS));
renderer = new DefaultTableCellRenderer();
// $NON-NLS-1$
renderer.setToolTipText(resourceMap.getString("TransportTab.colDoors.tooltip"));
col.setCellRenderer(renderer);
col = tblInstalled.getColumnModel().getColumn(InstalledBaysModel.COL_TONNAGE);
col.setCellEditor(new SpinnerCellEditor(InstalledBaysModel.COL_TONNAGE));
renderer = new DefaultTableCellRenderer();
// $NON-NLS-1$
renderer.setToolTipText(resourceMap.getString("TransportTab.colTonnage.tooltip"));
col.setCellRenderer(renderer);
col = tblInstalled.getColumnModel().getColumn(InstalledBaysModel.COL_PERSONNEL);
renderer = new DefaultTableCellRenderer();
// $NON-NLS-1$
renderer.setToolTipText(resourceMap.getString("TransportTab.colPersonnel.tooltip"));
col.setCellRenderer(renderer);
col = tblInstalled.getColumnModel().getColumn(InstalledBaysModel.COL_FACING);
podColumn = tblInstalled.getColumnModel().getColumn(InstalledBaysModel.COL_POD);
if (getEntity().hasETypeFlag(Entity.ETYPE_JUMPSHIP)) {
JComboBox<Integer> cb = new JComboBox<>(new Integer[] { Jumpship.LOC_NOSE, Jumpship.LOC_FLS, Jumpship.LOC_FRS, Jumpship.LOC_ALS, Jumpship.LOC_ARS, Jumpship.LOC_AFT });
col.setCellEditor(new DefaultCellEditor(cb));
cb.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
int loc = Entity.LOC_NONE;
if (null != value) {
loc = (Integer) value;
}
setText(getEntity().getLocationName(loc));
return this;
}
});
renderer = new DefaultTableCellRenderer();
renderer.setToolTipText(resourceMap.getString("TransportTab.colFacing.tooltip"));
col.setCellRenderer(renderer);
} else {
tblInstalled.getColumnModel().removeColumn(col);
}
if (!getEntity().isSupportVehicle()) {
tblInstalled.getColumnModel().removeColumn(podColumn);
}
tblInstalled.setShowGrid(false);
tblInstalled.setIntercellSpacing(new Dimension(0, 0));
tblAvailable.setShowGrid(false);
tblAvailable.setIntercellSpacing(new Dimension(0, 0));
tblInstalled.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tblInstalled.getSelectionModel().addListSelectionListener(e -> checkButtons());
tblAvailable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tblAvailable.getSelectionModel().addListSelectionListener(e -> checkButtons());
tblInstalled.setDragEnabled(true);
tblInstalled.setDropMode(DropMode.INSERT_ROWS);
tblInstalled.setTransferHandler(new BayReorderTransferHandler());
refresh();
}
Aggregations