Trying to fix applet ........

This commit is contained in:
Clisprail
2014-02-23 01:08:37 +01:00
parent 18f10207cc
commit 9528a00cd9
4 changed files with 10 additions and 26 deletions
+1 -1
View File
@@ -166,7 +166,7 @@ public class Context {
BotUI.getInstance().validate();
final GamePanel panel = GamePanel.getInstance();
panel.removeLoader();
panel.setContext(this);
panel.add(gameApplet);
gameApplet.setSize(765, 503);
java.util.Timer t = new java.util.Timer();
t.schedule(new TimerTask() {
+7 -7
View File
@@ -26,7 +26,7 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener {
private static final long serialVersionUID = -2126184292879805519L;
private static BotUI instance;
private static JDialog dialog;
//private static JDialog dialog;
public static BotUI getInstance() {
return instance == null ? instance = new BotUI() : instance;
@@ -40,7 +40,7 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener {
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setIconImage(Images.getResource("/org/parabot/core/ui/images/icon.png"));
this.setLayout(new BorderLayout());
this.addComponentListener(this);
//this.addComponentListener(this);
int iToolbarHeight = 24;
int iGameHeight = 503;
@@ -91,9 +91,9 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener {
this.add(panel, BorderLayout.CENTER);
pack();
setLocationRelativeTo(null);
//setLocationRelativeTo(null);
setVisible(true);
new BotDialog(this);
//new BotDialog(this);
LogArea.log("parabot " + Configuration.BOT_VERSION + " started");
}
@@ -116,16 +116,16 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener {
}
protected void setDialog(JDialog dialog) {
BotUI.dialog = dialog;
//BotUI.dialog = dialog;
}
@Override
public void componentMoved(ComponentEvent e) {
if(dialog == null) {
/*if(dialog == null) {
return;
}
Point gameLocation = GamePanel.getInstance().getLocationOnScreen();
dialog.setLocation(gameLocation.x, gameLocation.y);
dialog.setLocation(gameLocation.x, gameLocation.y);*/
}
@Override
@@ -1,6 +1,5 @@
package org.parabot.core.ui.components;
import java.applet.Applet;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
@@ -20,8 +19,6 @@ public class GamePanel extends JPanel {
private static final long serialVersionUID = 1L;
private static GamePanel instance;
private static VerboseLoader loader = VerboseLoader.get();
public Context context;
private GamePanel() {
setFocusable(true);
@@ -47,20 +44,7 @@ public class GamePanel extends JPanel {
* @param context
*/
public void setContext(final Context c) {
if(context != null) {
context.getApplet().setVisible(false);
}
context = c;
if(c == null) {
return;
}
final Applet gameApplet = context.getApplet();
if(!c.added) {
add(gameApplet);
c.added = true;
return;
}
gameApplet.setVisible(true);
add(c.getApplet());
}
@@ -23,7 +23,7 @@ public abstract class ServerExecuter {
Context context = Context.getInstance(provider);
BotToolbar.getInstance().addTab(context, serverName);
context.load();
PaintComponent.getInstance().startPainting(context.getPaintDebugger());
//PaintComponent.getInstance().startPainting(context.getPaintDebugger());
} catch (Throwable t) {
t.printStackTrace();
}