mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-06 08:39:33 +00:00
Added changes requested
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package org.parabot.core.ui;
|
package org.parabot.core.ui;
|
||||||
|
|
||||||
import org.parabot.core.Context;
|
import org.parabot.core.Context;
|
||||||
|
import org.parabot.core.Directories;
|
||||||
import org.parabot.core.ui.components.GamePanel;
|
import org.parabot.core.ui.components.GamePanel;
|
||||||
import org.parabot.core.ui.components.VerboseLoader;
|
import org.parabot.core.ui.components.VerboseLoader;
|
||||||
import org.parabot.core.ui.images.Images;
|
import org.parabot.core.ui.images.Images;
|
||||||
@@ -65,27 +66,7 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean deleteDirectory(File directory) {
|
|
||||||
if (directory.exists()) {
|
|
||||||
File[] files = directory.listFiles();
|
|
||||||
if (files != null) {
|
|
||||||
for (int i = 0; i < files.length; i++) {
|
|
||||||
if (files[i].isDirectory()) {
|
|
||||||
deleteDirectory(files[i]);
|
|
||||||
} else {
|
|
||||||
files[i].delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (directory.delete());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void createDirectory(File directory) {
|
|
||||||
if (!directory.exists()) {
|
|
||||||
directory.mkdir();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createMenu() {
|
private void createMenu() {
|
||||||
JMenuBar menuBar = new JMenuBar();
|
JMenuBar menuBar = new JMenuBar();
|
||||||
@@ -214,8 +195,7 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
|
|||||||
BotDialog.getInstance().setVisible(!dialog.isVisible());
|
BotDialog.getInstance().setVisible(!dialog.isVisible());
|
||||||
break;
|
break;
|
||||||
case "Clear cache":
|
case "Clear cache":
|
||||||
deleteDirectory(new File("C:/Users/Eric/Documents/Parabot/cache"));
|
Directories.clearCache();
|
||||||
createDirectory(new File("C:/Users/Eric/Documents/Parabot/cache"));
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
System.out.println("Invalid command: " + command);
|
System.out.println("Invalid command: " + command);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import java.awt.image.RescaleOp;
|
|||||||
/**
|
/**
|
||||||
* An informative JPanel which tells the user what bot is doing
|
* An informative JPanel which tells the user what bot is doing
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel, EmmaStone
|
||||||
*/
|
*/
|
||||||
public class VerboseLoader extends JPanel implements ProgressListener {
|
public class VerboseLoader extends JPanel implements ProgressListener {
|
||||||
private static final long serialVersionUID = 7412412644921803896L;
|
private static final long serialVersionUID = 7412412644921803896L;
|
||||||
@@ -144,7 +144,6 @@ public class VerboseLoader extends JPanel implements ProgressListener {
|
|||||||
login.setOpaque(false);
|
login.setOpaque(false);
|
||||||
|
|
||||||
login.addActionListener(new ActionListener() {
|
login.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (manager.login(userInput.getText(), passInput.getText(), false)) {
|
if (manager.login(userInput.getText(), passInput.getText(), false)) {
|
||||||
@@ -157,17 +156,17 @@ public class VerboseLoader extends JPanel implements ProgressListener {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 5)));
|
loginPanel.add(Box.createRigidArea(new Dimension(0, 8)));
|
||||||
loginPanel.add(usernameLabel);
|
loginPanel.add(usernameLabel);
|
||||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 5)));
|
loginPanel.add(Box.createRigidArea(new Dimension(0, 4)));
|
||||||
loginPanel.add(userInput);
|
loginPanel.add(userInput);
|
||||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 5)));
|
loginPanel.add(Box.createRigidArea(new Dimension(0, 4)));
|
||||||
loginPanel.add(passwordLabel);
|
loginPanel.add(passwordLabel);
|
||||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 5)));
|
loginPanel.add(Box.createRigidArea(new Dimension(0, 4)));
|
||||||
loginPanel.add(passInput);
|
loginPanel.add(passInput);
|
||||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 5)));
|
loginPanel.add(Box.createRigidArea(new Dimension(0, 2)));
|
||||||
loginPanel.add(login);
|
loginPanel.add(login);
|
||||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 5)));
|
loginPanel.add(Box.createRigidArea(new Dimension(0, 4)));
|
||||||
|
|
||||||
add(loginPanel, new GridBagConstraints());
|
add(loginPanel, new GridBagConstraints());
|
||||||
}
|
}
|
||||||
@@ -205,10 +204,10 @@ public class VerboseLoader extends JPanel implements ProgressListener {
|
|||||||
g.setStroke(new BasicStroke(5));
|
g.setStroke(new BasicStroke(5));
|
||||||
g.setPaint(Color.WHITE);
|
g.setPaint(Color.WHITE);
|
||||||
|
|
||||||
g.draw(new Line2D.Float(0, 0, this.getWidth(), 0));
|
g.draw(new Line2D.Float(0, 1, this.getWidth(), 1)); //TOP
|
||||||
g.draw(new Line2D.Float(0, 0, 0, 120));
|
g.draw(new Line2D.Float(0, 0, 0, 120)); //LEFT
|
||||||
g.draw(new Line2D.Float(0, 120, this.getWidth(), 120));
|
g.draw(new Line2D.Float(0, 120, this.getWidth(), 120)); //BOTTOM
|
||||||
g.draw(new Line2D.Float(this.getWidth() - 6, 0, this.getWidth() - 6, 120));
|
g.draw(new Line2D.Float(this.getWidth() - 6, 0, this.getWidth() - 6, 120)); //RIGHT
|
||||||
|
|
||||||
g.setColor(Color.white);
|
g.setColor(Color.white);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user