mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-03 00:37:55 +00:00
Updates for painting...
This commit is contained in:
@@ -4,6 +4,7 @@ import org.parabot.core.asm.ASMClassLoader;
|
||||
import org.parabot.core.classpath.ClassPath;
|
||||
import org.parabot.core.paint.PaintDebugger;
|
||||
import org.parabot.core.parsers.hooks.HookParser;
|
||||
import org.parabot.core.ui.BotDialog;
|
||||
import org.parabot.core.ui.BotUI;
|
||||
import org.parabot.core.ui.components.GamePanel;
|
||||
import org.parabot.environment.api.interfaces.Paintable;
|
||||
@@ -180,7 +181,7 @@ public class Context {
|
||||
Core.verbose("Initializing keyboard...");
|
||||
serverProvider.initKeyboard();
|
||||
Core.verbose("Done.");
|
||||
BotUI.getInstance().validate();
|
||||
BotDialog.getInstance().validate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.parabot.core.ui;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.JDialog;
|
||||
|
||||
import org.parabot.core.ui.components.PaintComponent;
|
||||
@@ -13,21 +13,32 @@ import org.parabot.core.ui.components.PaintComponent;
|
||||
*/
|
||||
public class BotDialog extends JDialog {
|
||||
private static final long serialVersionUID = 521800552287194673L;
|
||||
private static BotDialog instance;
|
||||
|
||||
public BotDialog(BotUI botUI) {
|
||||
private BotDialog(BotUI botUI) {
|
||||
super(botUI);
|
||||
botUI.setDialog(this);
|
||||
|
||||
setLayout(new BorderLayout());
|
||||
|
||||
botUI.setDialog(this);
|
||||
|
||||
setUndecorated(true);
|
||||
setBackground(new Color(0, 0, 0, 0));
|
||||
getRootPane().setOpaque(false);
|
||||
setContentPane(PaintComponent.getInstance(botUI.getSize()));
|
||||
setBackground(new Color(0, 0, 0, 0));
|
||||
setFocusableWindowState(true);
|
||||
setPreferredSize(botUI.getSize());
|
||||
setSize(botUI.getSize());
|
||||
setFocusable(false);
|
||||
setVisible(true);
|
||||
|
||||
setContentPane(PaintComponent.getInstance(botUI.getSize()));
|
||||
botUI.setVisible(true);
|
||||
//setAlwaysOnTop(true);
|
||||
}
|
||||
|
||||
public static BotDialog getInstance(BotUI botUI) {
|
||||
return instance == null ? instance = new BotDialog(botUI) : instance;
|
||||
}
|
||||
|
||||
public static BotDialog getInstance() {
|
||||
return getInstance(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowListener;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -22,7 +24,7 @@ import java.awt.event.ComponentListener;
|
||||
* @author Dane, Everel
|
||||
*
|
||||
*/
|
||||
public class BotUI extends JFrame implements ActionListener, ComponentListener {
|
||||
public class BotUI extends JFrame implements ActionListener, ComponentListener, WindowListener {
|
||||
|
||||
private static final long serialVersionUID = -2126184292879805519L;
|
||||
private static BotUI instance;
|
||||
@@ -41,6 +43,7 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener {
|
||||
this.setIconImage(Images.getResource("/org/parabot/core/ui/images/icon.png"));
|
||||
this.setLayout(new BorderLayout());
|
||||
this.addComponentListener(this);
|
||||
this.addWindowListener(this);
|
||||
this.setIgnoreRepaint(true);
|
||||
|
||||
int iToolbarHeight = 24;
|
||||
@@ -93,8 +96,7 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener {
|
||||
|
||||
pack();
|
||||
setLocationRelativeTo(null);
|
||||
setVisible(true);
|
||||
new BotDialog(this);
|
||||
BotDialog.getInstance(this);
|
||||
|
||||
LogArea.log("parabot " + Configuration.BOT_VERSION + " started");
|
||||
}
|
||||
@@ -143,4 +145,46 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener {
|
||||
public void componentHidden(ComponentEvent e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowActivated(WindowEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowClosed(WindowEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
System.out.println("close");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowDeactivated(WindowEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowDeiconified(WindowEvent arg0) {
|
||||
BotDialog.getInstance().setVisible(false);
|
||||
BotDialog.getInstance().setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowIconified(WindowEvent arg0) {
|
||||
//BotDialog.getInstance().setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowOpened(WindowEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ public class PaintComponent extends JComponent implements Runnable {
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
g2.setComposite(AlphaComposite.Clear);
|
||||
g2.fillRect(0, 0, dimensions.width, dimensions.height);
|
||||
g2.setComposite(AlphaComposite.SrcOver);
|
||||
|
||||
@@ -2,8 +2,6 @@ package org.parabot.core.ui.utils;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import org.parabot.core.ui.BotUI;
|
||||
|
||||
/**
|
||||
*
|
||||
* Log messages to the log user interface which is attached to the bot user interface
|
||||
@@ -19,7 +17,7 @@ public class UILog {
|
||||
|
||||
public static void log(final String title, final String message,
|
||||
int messageType) {
|
||||
JOptionPane.showMessageDialog(BotUI.getInstance(), message, title,
|
||||
JOptionPane.showMessageDialog(null, message, title,
|
||||
messageType);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ public class ServerWidget extends JPanel implements MouseListener,
|
||||
|
||||
public void load(final ServerDescription desc) {
|
||||
ServerSelector.getInstance().dispose();
|
||||
BotUI.getInstance().setVisible(true);
|
||||
BotUI.getInstance();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Reference in New Issue
Block a user