Re-added BotDialog

This commit is contained in:
Clisprail
2014-02-23 13:12:49 +01:00
parent da47acd493
commit 5055aa9a8a
5 changed files with 13 additions and 11 deletions
@@ -188,7 +188,7 @@ public class ClassPath {
protected void loadClass(InputStream in) throws IOException { protected void loadClass(InputStream in) throws IOException {
ClassReader cr = new ClassReader(in); ClassReader cr = new ClassReader(in);
ClassNode cn = new ClassNode(); ClassNode cn = new ClassNode();
cr.accept(cn, ClassReader.EXPAND_FRAMES); cr.accept(cn, 0);
classes.put(cn.name, cn); classes.put(cn.name, cn);
} }
@@ -24,6 +24,7 @@ public class BotDialog extends JDialog {
setContentPane(PaintComponent.getInstance(botUI.getSize())); setContentPane(PaintComponent.getInstance(botUI.getSize()));
setPreferredSize(botUI.getSize()); setPreferredSize(botUI.getSize());
setSize(botUI.getSize()); setSize(botUI.getSize());
setIgnoreRepaint(true);
setVisible(true); setVisible(true);
} }
+8 -7
View File
@@ -26,7 +26,7 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener {
private static final long serialVersionUID = -2126184292879805519L; private static final long serialVersionUID = -2126184292879805519L;
private static BotUI instance; private static BotUI instance;
//private static JDialog dialog; private static JDialog dialog;
public static BotUI getInstance() { public static BotUI getInstance() {
return instance == null ? instance = new BotUI() : instance; return instance == null ? instance = new BotUI() : instance;
@@ -40,7 +40,8 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener {
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setIconImage(Images.getResource("/org/parabot/core/ui/images/icon.png")); this.setIconImage(Images.getResource("/org/parabot/core/ui/images/icon.png"));
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
//this.addComponentListener(this); this.addComponentListener(this);
this.setIgnoreRepaint(true);
int iToolbarHeight = 24; int iToolbarHeight = 24;
int iGameHeight = 503; int iGameHeight = 503;
@@ -91,9 +92,9 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener {
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
pack(); pack();
//setLocationRelativeTo(null); setLocationRelativeTo(null);
setVisible(true); setVisible(true);
//new BotDialog(this); new BotDialog(this);
LogArea.log("parabot " + Configuration.BOT_VERSION + " started"); LogArea.log("parabot " + Configuration.BOT_VERSION + " started");
} }
@@ -116,16 +117,16 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener {
} }
protected void setDialog(JDialog dialog) { protected void setDialog(JDialog dialog) {
//BotUI.dialog = dialog; BotUI.dialog = dialog;
} }
@Override @Override
public void componentMoved(ComponentEvent e) { public void componentMoved(ComponentEvent e) {
/*if(dialog == null) { if(dialog == null) {
return; return;
} }
Point gameLocation = GamePanel.getInstance().getLocationOnScreen(); Point gameLocation = GamePanel.getInstance().getLocationOnScreen();
dialog.setLocation(gameLocation.x, gameLocation.y);*/ dialog.setLocation(gameLocation.x, gameLocation.y);
} }
@Override @Override
@@ -34,7 +34,7 @@ public class PaintComponent extends JComponent implements Runnable {
setPreferredSize(dimensions); setPreferredSize(dimensions);
setSize(dimensions); setSize(dimensions);
setOpaque(false); setOpaque(false);
setDoubleBuffered(true); setIgnoreRepaint(true);
} }
public static PaintComponent getInstance(Dimension dimensions) { public static PaintComponent getInstance(Dimension dimensions) {
@@ -66,7 +66,7 @@ public class PaintComponent extends JComponent implements Runnable {
@Override @Override
public void run() { public void run() {
while(true) { while(true) {
Time.sleep(15); Time.sleep(100);
repaint(); repaint();
} }
} }
@@ -23,7 +23,7 @@ public abstract class ServerExecuter {
Context context = Context.getInstance(provider); Context context = Context.getInstance(provider);
BotToolbar.getInstance().addTab(context, serverName); BotToolbar.getInstance().addTab(context, serverName);
context.load(); context.load();
//PaintComponent.getInstance().startPainting(context.getPaintDebugger()); PaintComponent.getInstance().startPainting(context.getPaintDebugger());
} catch (Throwable t) { } catch (Throwable t) {
t.printStackTrace(); t.printStackTrace();
} }