You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.5 KiB
55 lines
1.5 KiB
4 years ago
|
package com.jotuntech.sketcher.client;
|
||
|
|
||
|
import java.awt.HeadlessException;
|
||
|
|
||
|
import javax.swing.JApplet;
|
||
|
import javax.swing.JOptionPane;
|
||
|
|
||
|
import com.jotuntech.sketcher.common.Log;
|
||
|
|
||
|
public class ClientApplet extends JApplet {
|
||
|
private Client client;
|
||
|
String login, password, hostname;
|
||
|
int port;
|
||
|
boolean ads;
|
||
|
|
||
|
public ClientApplet() throws HeadlessException {
|
||
|
super();
|
||
|
}
|
||
|
|
||
|
public void init() {
|
||
|
login = getParameter("nick");
|
||
|
password = getParameter("secret");
|
||
|
hostname = getParameter("server");
|
||
|
port = Integer.valueOf(getParameter("port"));
|
||
|
ads = "1".equals(getParameter("ads"));
|
||
|
|
||
|
Log.info("Sketcher applet is initializing.");
|
||
|
}
|
||
|
|
||
|
public void start() {
|
||
|
System.gc();
|
||
|
Log.info("Sketcher applet is starting.");
|
||
|
if(Runtime.getRuntime().totalMemory() < 92274688) {
|
||
|
JOptionPane.showMessageDialog(this, "There is too little Java heap memory space for Sketcher to function.\nYour platform likely requires manual configuration. Please pass the\nfollowing run-time parameters to your Java Virtual Machine:\n\n -ms96M -mx384M\n\nContact the website administrator for further assistance.");
|
||
|
}
|
||
|
client = new Client(hostname, port, login, password, ads);
|
||
|
getContentPane().removeAll();
|
||
|
getContentPane().add(client.getUserInterface());
|
||
|
client.start();
|
||
|
}
|
||
|
|
||
|
public void stop() {
|
||
|
Log.info("Sketcher applet is stopping.");
|
||
|
client.close("Exit");
|
||
|
System.gc();
|
||
|
}
|
||
|
|
||
|
public void destroy() {
|
||
|
Log.info("Sketcher applet is being destroyed.");
|
||
|
getContentPane().removeAll();
|
||
|
client = null;
|
||
|
}
|
||
|
}
|
||
|
|