diff --git a/megameklab/src/megameklab/ui/MenuBar.java b/megameklab/src/megameklab/ui/MenuBar.java index 7c34eb119..b2d251737 100644 --- a/megameklab/src/megameklab/ui/MenuBar.java +++ b/megameklab/src/megameklab/ui/MenuBar.java @@ -14,6 +14,7 @@ */ package megameklab.ui; +import megamek.client.ui.dialogs.CostDisplayDialog; import megamek.client.ui.swing.UnitLoadingDialog; import megamek.common.*; import megamek.common.annotations.Nullable; @@ -808,7 +809,7 @@ private JMenu createUnitCostBreakdownMenu() { miCurrentUnitCostBreakdown.setName("miCurrentUnitCostBreakdown"); miCurrentUnitCostBreakdown.setMnemonic(KeyEvent.VK_U); miCurrentUnitCostBreakdown.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.ALT_DOWN_MASK)); - miCurrentUnitCostBreakdown.addActionListener(evt -> UnitUtil.showUnitCostBreakDown(getFrame(), getFrame().getEntity())); + miCurrentUnitCostBreakdown.addActionListener(evt -> new CostDisplayDialog(getFrame(), getFrame().getEntity()).setVisible(true)); unitCostBreakdownMenu.add(miCurrentUnitCostBreakdown); final JMenuItem miUnitCostBreakdownFromCache = new JMenuItem(resources.getString("FromCache.text")); @@ -928,7 +929,7 @@ private void jMenuGetUnitBreakdownFromCache_actionPerformed() { UnitLoadingDialog unitLoadingDialog = new UnitLoadingDialog(getFrame()); unitLoadingDialog.setVisible(true); MegaMekLabUnitSelectorDialog viewer = new MegaMekLabUnitSelectorDialog(getFrame(), unitLoadingDialog); - UnitUtil.showUnitCostBreakDown(getFrame(), viewer.getChosenEntity()); + new CostDisplayDialog(getFrame(), viewer.getChosenEntity()).setVisible(true); } private void jMenuGetUnitWeightBreakdownFromCache_actionPerformed() { @@ -998,7 +999,7 @@ private void jMenuGetUnitBreakdownFromFile_actionPerformed() { } try { - UnitUtil.showUnitCostBreakDown(getFrame(), new MechFileParser(unitFile).getEntity()); + new CostDisplayDialog(getFrame(), new MechFileParser(unitFile).getEntity()).setVisible(true); } catch (Exception ex) { JOptionPane.showMessageDialog(getFrame(), String.format(resources.getString("message.invalidUnit.format"), diff --git a/megameklab/src/megameklab/util/UnitUtil.java b/megameklab/src/megameklab/util/UnitUtil.java index be2928ebe..79468b06e 100644 --- a/megameklab/src/megameklab/util/UnitUtil.java +++ b/megameklab/src/megameklab/util/UnitUtil.java @@ -14,6 +14,7 @@ package megameklab.util; import megamek.client.ui.dialogs.BVDisplayDialog; +import megamek.client.ui.dialogs.CostDisplayDialog; import megamek.common.*; import megamek.common.annotations.Nullable; import megamek.common.verifier.*; @@ -3481,15 +3482,6 @@ public static void showUnitSpecs(Entity unit, JFrame frame) { } } - public static void showUnitCostBreakDown(final JFrame frame, final @Nullable Entity entity) { - if (entity == null) { - return; - } - entity.calculateBattleValue(true, true); - entity.getCost(true); - new BVDisplayDialog(frame, entity).setVisible(true); - } - public static void showUnitWeightBreakDown(Entity unit, JFrame frame) { TestEntity testEntity = getEntityVerifier(unit); @@ -3533,7 +3525,6 @@ public static void showBVCalculations(final JFrame frame, final @Nullable Entity if (entity == null) { return; } - entity.calculateBattleValue(true, true); new BVDisplayDialog(frame, entity).setVisible(true); }