Skip to content

Commit

Permalink
Client: Remove Parameters's dependency on remaining Applet APIs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
StenAL committed Dec 31, 2024
1 parent c3d0454 commit 7eb0398
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion client/src/main/java/com/aapeli/applet/AApplet.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
12 changes: 6 additions & 6 deletions client/src/main/java/com/aapeli/client/Parameters.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -44,8 +44,8 @@ public Parameters(Map<String, String> 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) {
Expand Down Expand Up @@ -271,8 +271,8 @@ public boolean callJavaScriptJSON(String json) {
}
}

public Applet getApplet() {
return this.applet;
public Component getRootComponent() {
return this.rootComponent;
}

public void destroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 7eb0398

Please sign in to comment.