diff --git a/src/org/rev317/min/ui/BotMenu.java b/src/org/rev317/min/ui/BotMenu.java index 6a2a37e..46f0ec9 100644 --- a/src/org/rev317/min/ui/BotMenu.java +++ b/src/org/rev317/min/ui/BotMenu.java @@ -2,21 +2,17 @@ package org.rev317.min.ui; import org.parabot.core.Context; import org.parabot.core.paint.PaintDebugger; -import org.parabot.environment.scripts.randoms.Random; import org.rev317.min.debug.*; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.ArrayList; /** * @author JKetelaar, Everel */ public class BotMenu implements ActionListener { - private RandomUI randomUI; - public BotMenu(JMenuBar bar) { PaintDebugger debugger = Context.getInstance().getPaintDebugger(); @@ -58,23 +54,6 @@ public class BotMenu implements ActionListener { debug.add(bank); debug.add(mouse); - JMenuItem randoms = new JMenuItem("Randoms"); - bar.getMenu(0).add(randoms, 0); - - randoms.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (randomUI == null){ - randomUI = new RandomUI(); - } - ArrayList randoms = new ArrayList<>(); - for (Random r : Context.getInstance().getRandomHandler().getRandoms()){ - randoms.add(r.getName()); - } - randomUI.openFrame(randoms); - } - }); - bar.add(debug); } diff --git a/src/org/rev317/min/ui/RandomUI.java b/src/org/rev317/min/ui/RandomUI.java deleted file mode 100644 index 784bf22..0000000 --- a/src/org/rev317/min/ui/RandomUI.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.rev317.min.ui; - -import org.parabot.core.Context; -import org.parabot.core.Core; -import org.parabot.environment.scripts.randoms.Random; - -import javax.swing.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; - -/** - * @author JKetelaar - */ -public class RandomUI implements ActionListener { - - private JFrame frame; - private ArrayList checkBoxes; - - public void openFrame(ArrayList randoms) { - frame = new JFrame(); - frame.setBounds(100, 100, 351, 100 + (randoms.size() * 35)); - frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - frame.getContentPane().setLayout(null); - - JButton btnSubmit = new JButton("Submit"); - btnSubmit.setBounds(228, 35 + (randoms.size() * 35), 117, 29); - frame.getContentPane().add(btnSubmit); - - JLabel lblRandoms = new JLabel("Randoms:"); - lblRandoms.setBounds(6, 6, 250, 16); - frame.getContentPane().add(lblRandoms); - - if (randoms.size() > 0) { - checkBoxes = new ArrayList<>(); - for (int i = 0; i < randoms.size(); i++) { - JCheckBox checkBox = new JCheckBox(randoms.get(i)); - checkBox.setBounds(6, 35 + (i * 35), 250, 23); - frame.getContentPane().add(checkBox); - if (isActive(randoms.get(i))) { - checkBox.setSelected(true); - } - checkBoxes.add(checkBox); - } - }else{ - JLabel lblNone = new JLabel("None (yet)."); - lblNone.setBounds(6, 35, 120, 16); - frame.getContentPane().add(lblNone); - } - - btnSubmit.addActionListener(this); - this.frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - this.frame.setVisible(true); - } - - @Override - public void actionPerformed(ActionEvent e) { - Context.getInstance().getRandomHandler().clearActiveRandoms(); - if (checkBoxes != null && checkBoxes.size() > 0) { - for (JCheckBox checkBox : this.checkBoxes) { - if (checkBox.isSelected()) { - for (Random r : Context.getInstance().getRandomHandler().getRandoms()) { - if (r.getName().equalsIgnoreCase(checkBox.getText().toLowerCase())) { - Core.verbose("Actived random '" + r.getName() + "'"); - Context.getInstance().getRandomHandler().setActive(r.getName()); - } - } - } - } - } - this.frame.dispose(); - } - - private boolean isActive(String random){ - for (Random r : Context.getInstance().getRandomHandler().getActiveRandoms()){ - if (r.getName().equalsIgnoreCase(random.toLowerCase())){ - return true; - } - } - return false; - } -}