diff --git a/megamek/src/megamek/client/ui/swing/AbstractPhaseDisplay.java b/megamek/src/megamek/client/ui/swing/AbstractPhaseDisplay.java index d7f922ae938..bf29073f495 100644 --- a/megamek/src/megamek/client/ui/swing/AbstractPhaseDisplay.java +++ b/megamek/src/megamek/client/ui/swing/AbstractPhaseDisplay.java @@ -33,7 +33,7 @@ public abstract class AbstractPhaseDisplay extends SkinnedJPanel implements protected DistractableAdapter distracted = new DistractableAdapter(); protected MegamekButton butDone; - protected IClientGUI clientgui; + private final IClientGUI clientgui; protected AbstractPhaseDisplay(IClientGUI cg) { this(cg, SkinSpecification.UIComponents.PhaseDisplay.getComp(), diff --git a/megamek/src/megamek/client/ui/swing/ActionPhaseDisplay.java b/megamek/src/megamek/client/ui/swing/ActionPhaseDisplay.java index 5eb0e43bd72..39eb1e399c1 100644 --- a/megamek/src/megamek/client/ui/swing/ActionPhaseDisplay.java +++ b/megamek/src/megamek/client/ui/swing/ActionPhaseDisplay.java @@ -46,7 +46,7 @@ protected ActionPhaseDisplay(ClientGUI cg) { protected UIUtil.FixedXPanel setupDonePanel() { var donePanel = super.setupDonePanel(); butSkipTurn = new MegamekButton("SKIP", SkinSpecification.UIComponents.PhaseDisplayDoneButton.getComp()); - butSkipTurn.setPreferredSize(new Dimension(UIUtil.scaleForGUI(DONE_BUTTON_WIDTH), MIN_BUTTON_SIZE.height * 1)); + butSkipTurn.setPreferredSize(new Dimension(UIUtil.scaleForGUI(DONE_BUTTON_WIDTH), MIN_BUTTON_SIZE.height)); String f = guiScaledFontHTML(UIUtil.uiLightViolet()) + KeyCommandBind.getDesc(KeyCommandBind.DONE_NO_ACTION)+ ""; butSkipTurn.setToolTipText("
" + f + ""); addToDonePanel(donePanel, butSkipTurn); @@ -108,7 +108,7 @@ protected void initDonePanelForNewTurn() { } /** called to reset, show, hide and relabel the Done panel buttons. Override to change button labels and states, - * being sure to call {@link #updateDonePanelButtons(String,String,boolean) UpdateDonePanelButtons} + * being sure to call {@link #updateDonePanelButtons(String, String, boolean, List)} * to set the button labels and states */ abstract protected void updateDonePanel(); @@ -349,6 +349,6 @@ protected void updateDonePanelButtons(final String doneButtonLabel, final String } private void adaptToGUIScale() { - butSkipTurn.setPreferredSize(new Dimension(UIUtil.scaleForGUI(DONE_BUTTON_WIDTH), MIN_BUTTON_SIZE.height * 1)); + butSkipTurn.setPreferredSize(new Dimension(UIUtil.scaleForGUI(DONE_BUTTON_WIDTH), MIN_BUTTON_SIZE.height)); } } diff --git a/megamek/src/megamek/client/ui/swing/ClientGUI.java b/megamek/src/megamek/client/ui/swing/ClientGUI.java index 919362374eb..4c702770154 100644 --- a/megamek/src/megamek/client/ui/swing/ClientGUI.java +++ b/megamek/src/megamek/client/ui/swing/ClientGUI.java @@ -350,17 +350,15 @@ public class ClientGUI extends AbstractClientGUI implements BoardViewListener, * clean up after itself as much as possible, but will not call * System.exit(). */ - public ClientGUI(IClient client, MegaMekController c) { - if (!(client instanceof Client)) { - throw new IllegalArgumentException("TW ClientGUI must use TW Client!"); - } - this.client = (Client) client; + public ClientGUI(Client client, MegaMekController c) { + super(client); + this.client = client; controller = c; panMain.setLayout(cardsMain); panSecondary.setLayout(cardsSecondary); clientGuiPanel.setLayout(new BorderLayout()); - clientGuiPanel.addComponentListener(this); + clientGuiPanel.addComponentListener(resizeListener); clientGuiPanel.add(panMain, BorderLayout.CENTER); clientGuiPanel.add(panSecondary, BorderLayout.SOUTH); diff --git a/megamek/src/megamek/client/ui/swing/MovementDisplay.java b/megamek/src/megamek/client/ui/swing/MovementDisplay.java index a311fc6ef09..bf66e3549ba 100644 --- a/megamek/src/megamek/client/ui/swing/MovementDisplay.java +++ b/megamek/src/megamek/client/ui/swing/MovementDisplay.java @@ -351,7 +351,6 @@ public static MoveCommand[] values(int f, GameOptions opts, boolean forwardIni) public MovementDisplay(final ClientGUI clientgui) { super(clientgui); - this.clientgui = clientgui; if (clientgui != null) { clientgui.getClient().getGame().addGameListener(this); clientgui.getBoardView().addBoardViewListener(this); diff --git a/megamek/src/megamek/client/ui/swing/ReportDisplay.java b/megamek/src/megamek/client/ui/swing/ReportDisplay.java index 33ec8eb3541..28af3e4628c 100644 --- a/megamek/src/megamek/client/ui/swing/ReportDisplay.java +++ b/megamek/src/megamek/client/ui/swing/ReportDisplay.java @@ -86,12 +86,15 @@ public String getHotKeyDesc() { private static final String RD_REPORTDISPLAY = "ReportDisplay."; private static final String RD_TOOLTIP = ".tooltip"; + private final ClientGUI clientgui; + /** * Creates and lays out a new movement phase display for the specified * clientgui.getClient(). */ public ReportDisplay(ClientGUI clientgui) { super(clientgui); + this.clientgui = clientgui; if (clientgui == null) { return; diff --git a/megamek/src/megamek/client/ui/swing/StatusBarPhaseDisplay.java b/megamek/src/megamek/client/ui/swing/StatusBarPhaseDisplay.java index 3e46b6f9dae..3fad3c5e305 100644 --- a/megamek/src/megamek/client/ui/swing/StatusBarPhaseDisplay.java +++ b/megamek/src/megamek/client/ui/swing/StatusBarPhaseDisplay.java @@ -54,7 +54,7 @@ public abstract class StatusBarPhaseDisplay extends AbstractPhaseDisplay protected static final GUIPreferences GUIP = GUIPreferences.getInstance(); private static final int BUTTON_ROWS = 2; private static final String SBPD_KEY_CLEARBUTTON = "clearButton"; - protected ClientGUI clientgui; + protected final ClientGUI clientgui; /** * timer that ends turn if time limit set in options is over diff --git a/megamek/src/megamek/client/ui/swing/lobby/ChatLounge.java b/megamek/src/megamek/client/ui/swing/lobby/ChatLounge.java index 39bbd84b99e..381fabe6696 100644 --- a/megamek/src/megamek/client/ui/swing/lobby/ChatLounge.java +++ b/megamek/src/megamek/client/ui/swing/lobby/ChatLounge.java @@ -268,7 +268,7 @@ public class ChatLounge extends AbstractPhaseDisplay implements private static final GUIPreferences GUIP = GUIPreferences.getInstance(); - protected ClientGUI clientgui; + private ClientGUI clientgui; /** Creates a new chat lounge for the clientgui.getClient(). */ public ChatLounge(ClientGUI clientgui) { diff --git a/megamek/src/megamek/common/strategicBattleSystems/SBFGame.java b/megamek/src/megamek/common/strategicBattleSystems/SBFGame.java index 41431eaf6f8..e1b67ce6458 100644 --- a/megamek/src/megamek/common/strategicBattleSystems/SBFGame.java +++ b/megamek/src/megamek/common/strategicBattleSystems/SBFGame.java @@ -22,18 +22,15 @@ import megamek.common.alphaStrike.AlphaStrikeElement; import megamek.common.annotations.Nullable; import megamek.common.enums.GamePhase; -import megamek.common.event.GameListener; import megamek.common.event.GamePhaseChangeEvent; import megamek.common.options.GameOptions; import megamek.common.options.OptionsConstants; import megamek.common.planetaryconditions.PlanetaryConditions; import org.apache.logging.log4j.LogManager; -import java.util.*; import java.util.Map; import java.util.Collections; import java.util.List; -import java.util.Map; /** * This is an SBF game's game object that holds all game information. As of 2024, this is under construction. @@ -212,35 +209,4 @@ public void replaceAllReports(Map