From 7eb03982537c1317c8da22a35eb3e3a46c897699 Mon Sep 17 00:00:00 2001 From: Sten Laane <21343173+StenAL@users.noreply.github.com> Date: Sat, 28 Dec 2024 14:02:35 +0200 Subject: [PATCH] Client: Remove Parameters's dependency on remaining Applet APIs The only place that uses the applet is TellFriendHandler and the method it calls opens a pop-up and accepts any Java AWT component. Therefore, it is safe to rename to applet field in Parameters is to rootComponent to remove the coupling from the deprecated Applet class. --- client/src/main/java/com/aapeli/applet/AApplet.java | 2 +- .../src/main/java/com/aapeli/client/Parameters.java | 12 ++++++------ .../java/com/aapeli/client/TellFriendHandler.java | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/src/main/java/com/aapeli/applet/AApplet.java b/client/src/main/java/com/aapeli/applet/AApplet.java index bffd4dbc..f51156cc 100644 --- a/client/src/main/java/com/aapeli/applet/AApplet.java +++ b/client/src/main/java/com/aapeli/applet/AApplet.java @@ -73,7 +73,7 @@ public abstract class AApplet extends Applet implements Runnable, ActionListener public AApplet(Parameters parameters) { super(); this.param = parameters; - parameters.setApplet(this); + parameters.setRootComponent(this); } public void init() { diff --git a/client/src/main/java/com/aapeli/client/Parameters.java b/client/src/main/java/com/aapeli/client/Parameters.java index 98388467..835d940c 100644 --- a/client/src/main/java/com/aapeli/client/Parameters.java +++ b/client/src/main/java/com/aapeli/client/Parameters.java @@ -1,7 +1,7 @@ package com.aapeli.client; import com.aapeli.tools.Tools; -import java.applet.Applet; +import java.awt.Component; import java.awt.Desktop; import java.io.IOException; import java.net.URI; @@ -15,7 +15,7 @@ public final class Parameters { private static final String PLAYFORIA_SITE_NAME = "playforia"; private static final String PLAYFORIA_QUIT_PAGE = "http://www.playforia.com/"; private static final String QUIT_TARGET = "_top"; - private Applet applet; + private Component rootComponent; private String serverIp; private Locale locale; private String siteName; @@ -44,8 +44,8 @@ public Parameters(Map params) { this.init(); } - public void setApplet(Applet applet) { - this.applet = applet; + public void setRootComponent(Component rootComponent) { + this.rootComponent = rootComponent; } public static boolean getBooleanValue(String key) { @@ -271,8 +271,8 @@ public boolean callJavaScriptJSON(String json) { } } - public Applet getApplet() { - return this.applet; + public Component getRootComponent() { + return this.rootComponent; } public void destroy() { diff --git a/client/src/main/java/com/aapeli/client/TellFriendHandler.java b/client/src/main/java/com/aapeli/client/TellFriendHandler.java index eefecec0..5846eade 100644 --- a/client/src/main/java/com/aapeli/client/TellFriendHandler.java +++ b/client/src/main/java/com/aapeli/client/TellFriendHandler.java @@ -135,7 +135,7 @@ protected void method1703() { private void method1704() { this.tellFriendWindow = new TellFriendWindow(this.aTextManager1501, this.anImageManager1502, this); - this.tellFriendWindow.method241(this.aParameters1500.getApplet()); + this.tellFriendWindow.method241(this.aParameters1500.getRootComponent()); this.anInt1506 = 2; }