use of megamek.common.util.EncodeControl in project megameklab by MegaMek.
the class MekChassisView method initUI.
private void initUI() {
// $NON-NLS-1$
ResourceBundle resourceMap = ResourceBundle.getBundle("megameklab.resources.Views", new EncodeControl());
// $NON-NLS-1$
baseTypesModel = new DefaultComboBoxModel<>(resourceMap.getString("MekChassisView.baseType.values").split(","));
// $NON-NLS-1$
standardTypesModel = new DefaultComboBoxModel<>(resourceMap.getString("MekChassisView.motiveType.values").split(","));
// $NON-NLS-1$
lamTypesModel = new DefaultComboBoxModel<>(resourceMap.getString("MekChassisView.lamType.values").split(","));
// $NON-NLS-1$
qvTypesModel = new DefaultComboBoxModel<>(resourceMap.getString("MekChassisView.qvType.values").split(","));
// $NON-NLS-1$
primitiveTypesModel = new DefaultComboBoxModel<>(resourceMap.getString("MekChassisView.primitiveType.values").split(","));
// $NON-NLS-1$
primitiveMotiveTypesModel = new DefaultComboBoxModel<>(resourceMap.getString("MekChassisView.primitiveMotiveType.values").split(","));
// $NON-NLS-1$
stdMotiveTooltip = resourceMap.getString("MekChassisView.cbMotiveType.tooltip");
// $NON-NLS-1$
lamMotiveTooltip = resourceMap.getString("MekChassisView.cbMotiveType.LAM.tooltip");
// $NON-NLS-1$
qvMotiveTooltip = resourceMap.getString("MekChassisView.cbMotiveType.QuadVee.tooltip");
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("MekChassisView.spnTonnage.text"), labelSize), gbc);
gbc.gridx = 1;
gbc.gridy = 0;
setFieldSize(spnTonnage, spinnerSize);
// $NON-NLS-1$
spnTonnage.setToolTipText(resourceMap.getString("MekChassisView.spnTonnage.tooltip"));
add(spnTonnage, gbc);
spnTonnage.addChangeListener(this);
add(spnTonnage, gbc);
gbc.gridx = 2;
gbc.gridy = 0;
// $NON-NLS-1$
chkOmni.setText(resourceMap.getString("MekChassisView.chkOmni.text"));
// $NON-NLS-1$
chkOmni.setToolTipText(resourceMap.getString("MekChassisView.chkOmni.tooltip"));
add(chkOmni, gbc);
chkOmni.addChangeListener(this);
gbc.gridx = 0;
gbc.gridy = 1;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("MekChassisView.cbBaseType.text"), labelSize), gbc);
gbc.gridx = 1;
gbc.gridy = 1;
gbc.gridwidth = 3;
setFieldSize(cbBaseType, controlSize);
// $NON-NLS-1$
cbBaseType.setToolTipText(resourceMap.getString("MekChassisView.cbBaseType.tooltip"));
add(cbBaseType, gbc);
cbBaseType.addActionListener(this);
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("MekChassisView.cbMotiveType.text"), labelSize), gbc);
gbc.gridx = 1;
gbc.gridy = 2;
gbc.gridwidth = 3;
setFieldSize(cbMotiveType, controlSize);
// $NON-NLS-1$
cbMotiveType.setToolTipText(resourceMap.getString("MekChassisView.cbMotiveType.tooltip"));
add(cbMotiveType, gbc);
cbMotiveType.addActionListener(this);
gbc.gridx = 0;
gbc.gridy = 3;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("MekChassisView.cbStructure.text"), labelSize), gbc);
gbc.gridx = 1;
gbc.gridy = 3;
gbc.gridwidth = 3;
setFieldSize(cbStructure, controlSize);
// $NON-NLS-1$
cbStructure.setToolTipText(resourceMap.getString("MekChassisView.cbStructure.tooltip"));
add(cbStructure, gbc);
cbStructure.addActionListener(this);
gbc.gridx = 0;
gbc.gridy = 4;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("MekChassisView.cbEngine.text"), labelSize), gbc);
gbc.gridx = 1;
gbc.gridy = 4;
gbc.gridwidth = 3;
setFieldSize(cbEngine, controlSize);
// $NON-NLS-1$
cbEngine.setToolTipText(resourceMap.getString("MekChassisView.cbEngine.tooltip"));
add(cbEngine, gbc);
cbEngine.addActionListener(this);
gbc.gridx = 0;
gbc.gridy = 5;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("MekChassisView.cbGyro.text"), labelSize), gbc);
gbc.gridx = 1;
gbc.gridy = 5;
gbc.gridwidth = 3;
setFieldSize(cbGyro, controlSize);
// $NON-NLS-1$
cbGyro.setToolTipText(resourceMap.getString("MekChassisView.cbGyro.tooltip"));
add(cbGyro, gbc);
cbGyro.addActionListener(this);
gbc.gridx = 0;
gbc.gridy = 6;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("MekChassisView.cbCockpit.text"), labelSize), gbc);
gbc.gridx = 1;
gbc.gridy = 6;
gbc.gridwidth = 3;
setFieldSize(cbCockpit, controlSize);
// $NON-NLS-1$
cbCockpit.setToolTipText(resourceMap.getString("MekChassisView.cbCockpit.tooltip"));
add(cbCockpit, gbc);
cbCockpit.addActionListener(this);
gbc.gridx = 0;
gbc.gridy = 7;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(createLabel(resourceMap.getString("MekChassisView.cbEnhancement.text"), labelSize), gbc);
gbc.gridx = 1;
gbc.gridy = 7;
gbc.gridwidth = 3;
setFieldSize(cbEnhancement, controlSize);
// $NON-NLS-1$
cbEnhancement.setNullValue(resourceMap.getString("MekChassisView.cbEnhancement.null"));
// $NON-NLS-1$
cbEnhancement.setToolTipText(resourceMap.getString("MekChassisView.cbEnhancement.tooltip"));
add(cbEnhancement, gbc);
cbEnhancement.addActionListener(this);
// $NON-NLS-1$
chkFullHeadEject.setText(resourceMap.getString("MekChassisView.chkFullHeadEject.text"));
gbc.gridx = 1;
gbc.gridy = 8;
gbc.gridwidth = 3;
add(chkFullHeadEject, gbc);
// $NON-NLS-1$
chkFullHeadEject.setToolTipText(resourceMap.getString("MekChassisView.chkFullHeadEject.tooltip"));
chkFullHeadEject.addActionListener(this);
// $NON-NLS-1$
btnResetChassis.setText(resourceMap.getString("MekChassisView.btnResetChassis.text"));
gbc.gridx = 1;
gbc.gridy = 9;
gbc.gridwidth = 3;
add(btnResetChassis, gbc);
// $NON-NLS-1$
btnResetChassis.setToolTipText(resourceMap.getString("MekChassisView.btnResetChassis.tooltip"));
btnResetChassis.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<>(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++;
}
}
use of megamek.common.util.EncodeControl in project megameklab by MegaMek.
the class PlatoonTypeView 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);
}
use of megamek.common.util.EncodeControl in project megameklab by MegaMek.
the class TransportTab method initUI.
private void initUI() {
// $NON-NLS-1$
ResourceBundle resourceMap = ResourceBundle.getBundle("megameklab.resources.Tabs", new EncodeControl());
setLayout(new GridBagLayout());
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$
add(new JLabel(resourceMap.getString("TransportTab.lblCurrentBays.text")), gbc);
gbc.gridy++;
gbc.gridwidth = 1;
// $NON-NLS-1$
add(new JLabel(resourceMap.getString("TransportTab.lblMaxDoors.text")), gbc);
gbc.gridx = 1;
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"));
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"));
add(btnAddToCargo, gbc);
btnAddToCargo.addActionListener(this);
gbc.gridx = 0;
gbc.gridy++;
gbc.gridwidth = 3;
gbc.gridheight = GridBagConstraints.REMAINDER;
add(new JScrollPane(tblInstalled), gbc);
gbc.gridx = 3;
gbc.gridy = 0;
gbc.gridwidth = 1;
gbc.gridheight = 1;
// $NON-NLS-1$
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"));
add(btnAddBay, gbc);
btnAddBay.addActionListener(this);
gbc.gridy++;
gbc.gridwidth = 2;
gbc.gridheight = GridBagConstraints.REMAINDER;
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);
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);
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