Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.KeyEvent;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.lang.reflect.InvocationTargetException;
- import java.net.URL;
- import org.rsbot.event.events.MessageEvent;
- import org.rsbot.event.listeners.MessageListener;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.*;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- import java.util.Random;
- import javax.swing.*;
- /**
- *
- * @author Dayghost
- * @author Dew
- */
- @ScriptManifest(authors = {"Dew"},
- keywords = {"Cook"},
- name = "Fuser Cooker-BETA",
- description = "Cooks food for you! Currently only at Al-Kharid",
- version = 0.5)
- public class FuserCook extends Script implements PaintListener, MessageListener {
- // <editor-fold defaultstate="collapsed" desc="Variables">
- boolean scriptRunning = true;
- boolean input = false;
- public long startTime = 0;
- public long millis = 0;
- public long hours = 0;
- public long minutes = 0;
- public long seconds = 0;
- public int mode;
- Areas areas = new Areas();
- Setup set = new Setup();
- WalkPaths paths = new WalkPaths();
- InnerMethods methods = new InnerMethods();
- antiBanThread antibanthread = new antiBanThread();
- FuserCookGui g = new FuserCookGui();
- public String status = "null";
- public boolean devMode = false;
- public boolean logFinish = false;
- private int itemsCooked = 0; //totol cooked
- private int itemsBurned = 0; //total burned
- // </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="Setup Variables">
- private class Setup {
- public int toCook;
- public int toCookList[] = {317, 321, 327, 345, 335, 349, 331, 359, 377, 371};
- public int cookOn;
- public int cookOnList[] = {25730};
- public int bankId;
- public int bankIdList[] = {35647};
- public int areaId = 0;
- public int areadIdList[] = {1};
- }
- // </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="Areas">
- private class Areas {
- // <editor-fold defaultstate="collapsed" desc="Al-Kharid Area Variables - atAllocation();">
- RSArea alBankArea = new RSArea(new RSTile(3269, 3164), new RSTile(3272, 3171));
- RSArea alCookArea = new RSArea(new RSTile(3272, 3179), new RSTile(3275, 3183));
- private boolean atAlbank() { //Al-Kharid bank
- RSArea area1 = alBankArea;
- return area1.contains(getMyPlayer().getLocation());
- }
- private boolean atAlcook() { //Al-Kharid cook location
- RSArea area1 = alCookArea;
- return area1.contains(getMyPlayer().getLocation());
- }
- // </editor-fold>
- private boolean atBank() {
- if (set.areaId == 1) {
- return atAlbank();
- }
- return false;
- }
- private boolean atCook() {
- if (set.areaId == 1) {
- return atAlcook();
- }
- return false;
- }
- }
- // </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="Walk Paths">
- public class WalkPaths {
- public RSTile[] pathToCookAl = {new RSTile(3269, 3167),
- new RSTile(3275, 3172),
- new RSTile(3273, 3180)
- };
- public RSTile[] pathToBankAl = {new RSTile(3273, 3180),
- new RSTile(3275, 3172),
- new RSTile(3269, 3167)
- };
- private void walkToBank() {
- if (set.areaId == 1) {
- if (!areas.atBank()) {
- RSTilePath walkingBank = walking.newTilePath(pathToBankAl);
- walkingBank.randomize(random(1, 2), random(1, 2));
- walkingBank.traverse();
- //antiban.antiBanCamera();
- sleep(random(500, 1000));
- //timer.reset();
- }
- }
- }
- private void walkToCook() {
- if (set.areaId == 1) {
- if (!areas.atCook()) {
- RSTilePath walkingBank = walking.newTilePath(pathToCookAl);
- walkingBank.randomize(random(1, 2), random(1, 2));
- walkingBank.traverse();
- //antiban.antiBanCamera();
- sleep(random(500, 1000));
- //timer.reset();
- }
- }
- }
- }
- // </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="Methods Used">
- public class InnerMethods {
- // <editor-fold defaultstate="collapsed" desc="Banking">
- public int bankOpen() {
- if (areas.atBank() && players.getMyPlayer().isIdle()) {
- if (set.areaId == 1) {
- RSObject bankBooth = objects.getNearest(set.bankId);
- if (random(1, 4) > 1) {
- bankBooth.interact("Use-quickly");
- } else {
- //antiban.antiban();
- }
- }
- }
- return random(800, 1300);
- }
- public int withdrawBank() {
- if (bank.getCount(set.toCook) > 0) {
- bank.withdraw(set.toCook, 0);
- } else {
- log(Color.CYAN, "[SUCCESS] We have deplenished all cooking material! :)");
- stopScript();
- }
- return random(300, 1100);
- }
- public int depositBank() {
- bank.depositAll();
- return random(300, 1100);
- }
- public int bankClose() {
- if (bank.isOpen()) {
- bank.close();
- sleep(random(200, 1000));
- }
- return random(300, 800);
- }
- public void banking() {
- if (!bank.isOpen()) {
- bankOpen();
- } else {
- if (!inventory.isFull()) {
- if (!inventory.contains(set.toCook)) {
- withdrawBank();
- } else {
- }
- } else {
- if (!inventory.contains(set.toCook)) {
- depositBank();
- }
- }
- sleep(random(100, 500));
- }
- }
- // </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="Cook Method">
- public void cook() {
- RSItem cook = inventory.getItem(set.toCook);
- RSObject cookOn = objects.getNearest(set.cookOn);
- RSInterface inter = interfaces.get(905);
- RSComponent com = inter.getComponent(14);
- if (mode == 1) {
- if (inter != null && inter.isValid()) {
- logger("Inter not null");
- if (com != null && com.isValid()) {
- logger("com not null");
- com.doClick(true);
- Methods.sleep(1000, 2000);
- }
- } else {
- if (cook != null && cookOn != null) {
- inventory.useItem(cook, cookOn);
- sleep(1000, 2000);
- }
- }
- } else if (mode == 2) {
- if (inter != null && inter.isValid()) {
- if (com != null && com.isValid()) {
- Point p = com.getPoint();
- mouse.move(p, 40, 40);
- sleep(250, 750);
- mouse.click(true);
- }
- } else if (cook != null && cookOn != null) {
- if (random(1, 5) > 2) {
- camera.turnTo(cookOn);
- }
- inventory.useItem(cook, cookOn);
- sleep(750, 1250);
- }
- }
- }
- // </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="anim(int animID)">
- public boolean anim(int animID) {
- return getMyPlayer().getAnimation() == animID;
- }
- // </editor-fold>
- public final String fishName() {
- String s = "";
- switch (g.fishType.getSelectedIndex()) {
- case 0:
- s = "NULL";
- break;
- case 1:
- s = "Shrimp";
- break;
- case 2:
- s = "Anchovies";
- break;
- case 3:
- s = "Sardine";
- break;
- case 4:
- s = "Herring";
- break;
- case 5:
- s = "Trout";
- break;
- case 6:
- s = "Pike";
- break;
- case 7:
- s = "Salmon";
- break;
- case 8:
- s = "Tuna";
- break;
- case 9:
- s = "Lobster";
- break;
- case 10:
- s = "Swordfish";
- break;
- }
- return s;
- }
- }
- // </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="createandwaitGUI st00f">
- private void createAndWaitForGUI() {
- if (SwingUtilities.isEventDispatchThread()) {
- g.setResizable(false);
- g.setVisible(true);
- } else {
- try {
- SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- g.setResizable(false);
- g.setVisible(true);
- }
- });
- } catch (InvocationTargetException e) {
- log.warning("InvocationTargetExpection Error!!");
- log(e);
- log.warning("InvocationTargetExpection Error!!");
- } catch (InterruptedException x) {
- log.warning("InterruptionException Error!!");
- log(x);
- log.warning("InterruptionException Error!!");
- }
- }
- sleep(1000);
- while (g.isVisible()) {
- sleep(1000);
- }
- }
- // </editor-fold>
- private enum Action {
- WALKTOBANK, OPENBANK, COOKFOOD, WAITWHILECOOKING, WALKTOCOOK, SLEEP, UNKNOWN;
- }
- // <editor-fold defaultstate="collapsed" desc="Get Action">
- /**
- * Try to make as much logic as possible happen here instead of in the loop.
- *
- * @return Action
- */
- public Action getAction() {
- try {
- if (game.getClientState() != 11) {
- return Action.SLEEP;
- } else {
- if (inventory.contains(set.toCook)) {
- //logger("Inventory does contain food");
- if (areas.atBank()) {
- // logger("Walk To Cook");
- return Action.WALKTOCOOK;
- } else if (areas.atCook()) {
- if (methods.anim(896) && !inventory.containsAll(set.toCook)
- || methods.anim(896) || !inventory.containsAll(set.toCook)) {
- // logger("Cook Food");
- return Action.WAITWHILECOOKING;
- } else if (inventory.containsAll(set.toCook) && !methods.anim(896)) {
- // logger("Cook Food");
- return Action.COOKFOOD;
- } else {
- return Action.WAITWHILECOOKING;
- }
- } else {
- //logger("Else: Walk to Cook");
- return Action.WALKTOCOOK;
- }
- } else {
- //logger("Inventory does not contain food");
- if (areas.atCook()) {
- // logger("Walk to Bank");
- return Action.WALKTOBANK;
- } else if (areas.atBank()) {
- //logger("Banking");
- return Action.OPENBANK;
- } else {
- //logger("Else: Walk to Bank");
- return Action.WALKTOBANK;
- }
- }
- }
- } catch (final Exception e) {
- return Action.UNKNOWN;
- }
- }
- // </editor-fold>
- @Override
- public boolean onStart() {
- createAndWaitForGUI();
- startTime = System.currentTimeMillis();
- mode = g.mode.getSelectedIndex();
- devMode = g.devMode.isSelected();
- logFinish = g.logBurnCook.isSelected();
- set.areaId = set.areadIdList[0];
- set.toCook = set.toCookList[g.fishType.getSelectedIndex()-1];
- set.bankId = set.bankIdList[0];
- set.cookOn = set.cookOnList[0];
- log("We will be cooking: "+methods.fishName());
- logger("FishCookID: "+set.toCook);
- logger("Mode: "+mode);
- antibanthread.start();
- if (set.areaId == 0) {
- return false;
- }
- return true;
- }
- public int loop() {
- if (scriptRunning) {
- try {
- mouse.setSpeed(Methods.random(4, 7));
- switch (getAction()) {
- case WALKTOBANK:
- paths.walkToBank();
- status = "Walking to Bank";
- break;
- case WALKTOCOOK:
- paths.walkToCook();
- status = "Walking to Cook";
- break;
- case COOKFOOD:
- methods.cook();
- if (mode == 1) {
- Methods.sleep(1000, 2000);
- }
- status = "Cooking Food";
- break;
- case WAITWHILECOOKING:
- Methods.sleep(1000,3000);
- break;
- case OPENBANK:
- methods.banking();
- status = "Banking";
- break;
- case SLEEP:
- Methods.sleep(1000, 2000);
- status = "Waiting";
- break;
- }
- } catch (final Exception e) {
- return 25;
- }
- }
- return Methods.random(400,1100);
- }
- @Override
- public void onFinish() {
- if (logFinish) {
- log("We Burned: "+itemsBurned);
- log("We Cooked: "+itemsCooked);
- if (itemsCooked > 0 && itemsBurned > 0) {
- log("Cook/Burn Ratio: " + itemsCooked / itemsBurned);
- } else if (itemsCooked > 0 && itemsBurned == 0) {
- log("Cook/Burn Ratio: 1");
- }
- }
- for (int Tries = 0; antibanthread.isAlive(); Tries++) {
- if (Tries > 2400) {
- antibanthread.interrupt();
- Methods.sleep(25);
- if (antibanthread.isInterrupted()) {
- break;
- } else if (Tries > 4800) {
- break;
- }
- } else {
- antibanthread.stopThread = true;
- Methods.sleep(25);
- if (antibanthread.isInterrupted()) {
- break;
- }
- }
- }
- scriptRunning = false;
- }
- /**
- * NOTE: Only logs if in devMode
- * @param text the string to send
- * @return true if successfully sent
- */
- public void logger(String text) {
- if (devMode) {
- log(Color.GREEN, "[DEBUG]: "+text);
- }
- }
- // <editor-fold defaultstate="collapsed" desc="Paint">
- private final Color restCol3 = new Color(255, 255, 255);
- private final Font restFont = new Font("Calibri", 0, 12);
- public void onRepaint(Graphics g1) {
- millis = System.currentTimeMillis() - startTime;
- hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- seconds = millis / 1000;
- Graphics2D g = (Graphics2D) g1;
- g.setFont(restFont);
- g.setColor(restCol3);
- g.drawString("Status: " + status, 357, 330);
- g.drawString("Cooked: " + itemsCooked, 357, 330 - 15);
- g.drawString("Burned: " + itemsBurned, 357, 330 - 30);
- g.drawString("Time Ran: " + hours + ":" + minutes + ":" + seconds, 357, 330 - 45);
- g.drawString("Mode: "+mode, 357, 330-60);
- }
- // </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="MessageListener">
- public void messageReceived(MessageEvent e) {
- String x = e.getMessage().toLowerCase();
- if (x.contains("success")) {
- itemsCooked++;
- } else if (x.contains("accidentally burn the")) {
- itemsBurned++;
- }
- }
- // </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="Looped Antiban">
- /**
- * Looped antiBan version 1.00
- *
- * @Author Ubuntu4life
- */
- private void antiBan() {
- // CHANGE randomInteger to tune the frequency of the antiBan.
- final int randomInteger = Methods.random(1, 11);
- switch (randomInteger) {
- case 1:
- // CHANGE this random integer generator to tune the relative
- // distribution of antiBan actions.
- if (Methods.random(1, 17) != 1) {
- break;
- } else {
- mouse.move(random(10, 750), random(10, 495));
- if (Methods.random(1, 7) == 1) {
- mouse.move(random(10, 750), random(10, 495));
- }
- }
- break;
- case 2:
- if (Methods.random(1, 12) != 1) {
- break;
- } else {
- mouse.moveSlightly();
- }
- break;
- case 3:
- if (Methods.random(1, 18) != 1) {
- break;
- } else {
- if (Methods.random(1, 11) == 1) {
- camera.setPitch(true);
- }
- int angle = camera.getAngle() + Methods.random(-45, 45);
- if (angle < 0) {
- angle = Methods.random(0, 10);
- }
- if (angle > 359) {
- angle = Methods.random(0, 10);
- }
- char Direction = 37;
- if (Methods.random(0, 100) < 50) {
- Direction = 39;
- }
- keyboard.pressKey(Direction);
- Methods.sleep(Methods.random(100, 700));
- keyboard.releaseKey(Direction);
- }
- break;
- default:
- return;
- }
- }
- // </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="Threaded Antiban">
- /**
- * Multi-threaded antiBan version 1.00
- *
- * @Author Ubuntu4life
- */
- private class antiBanThread extends Thread {
- private volatile boolean stopThread = false;
- Random javaUtilRandom = new Random();
- @Override
- public void run() {
- try {
- while (!stopThread && !isPaused()
- && game.isLoggedIn()) {
- // CHANGE this integer to tune the frequency of the antiBan
- if (javaUtilRandom.nextInt(Math.abs(0 - 21)) == 1) {
- final char[] leftRight = new char[]{KeyEvent.VK_LEFT,
- KeyEvent.VK_RIGHT};
- final char[] upDown = new char[]{KeyEvent.VK_DOWN,
- KeyEvent.VK_UP};
- final char[] leftRightUpDown = new char[]{
- KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP};
- final int random1 = javaUtilRandom.nextInt(Math.abs(2 - 0));
- final int random2 = javaUtilRandom.nextInt(Math.abs(2 - 0));
- final int random3 = javaUtilRandom.nextInt(Math.abs(4 - 0));
- boolean didLeftRight = false;
- if (javaUtilRandom.nextInt(Math.abs(3 - 0)) == 1) {
- if (random(0, 5) != 1) {
- keyboard.pressKey(leftRight[random1]);
- Thread.sleep(javaUtilRandom.nextInt(Math.abs(101 - 402)));
- didLeftRight = true;
- }
- keyboard.pressKey(upDown[random2]);
- Thread.sleep(javaUtilRandom.nextInt(Math.abs(301 - 601)));
- keyboard.releaseKey(upDown[random2]);
- Thread.sleep(javaUtilRandom.nextInt(Math.abs(99 - 399)));
- if (didLeftRight) {
- keyboard.releaseKey(leftRight[random1]);
- }
- } else {
- keyboard.pressKey(leftRightUpDown[random3]);
- if (random3 > 1) {
- Thread.sleep(javaUtilRandom.nextInt(Math.abs(601 - 298)));
- } else {
- Thread.sleep(javaUtilRandom.nextInt(Math.abs(903 - 501)));
- }
- keyboard.releaseKey(leftRightUpDown[random3]);
- }
- } else {
- Thread.sleep(javaUtilRandom.nextInt(Math.abs(2004 - 198)));
- }
- }
- } catch (final Exception e) {
- }
- }
- }
- // </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="FuserCookGui">
- public class FuserCookGui extends javax.swing.JFrame {
- // <editor-fold defaultstate="collapsed" desc="TWITTER STUFF">
- public final String TWITTER_NAME = ""; //name of the twitter account
- public String loadTwitterName = null; //the name that is displayed at beginning of the text field.
- public String loadTwitterUpdate = null; //the actual twitter update that will be viewed.
- public boolean tweetsLoaded = false; //true if the twitter update was loaded successfully
- // <editor-fold defaultstate="collapsed" desc="Twitter Updateer">
- public final void loadTweets(int count) {
- loadTwitterName = "" + TWITTER_NAME; //initializes the twitter name
- final StringBuilder url = new StringBuilder(); //will build the following URL
- url.append("http://scripters.powerbot.org/files/316383/scriptdir/fusercook/msgdew.xml");
- //url.append(TWITTER_NAME);
- //url.append("&count=");
- //url.append(count); //this is what the program will load to view the twitter update
- InputStreamReader stream = null;
- BufferedReader reader = null;
- try {
- stream = new InputStreamReader(new URL(url.toString()).openStream()); //sets our stream to open a stream to url above
- reader = new BufferedReader(stream); //reads the webpage
- String s;
- int c = 0;
- while ((s = reader.readLine()) != null) { //while reader can read
- final String a = "<text>", b = "</text>";
- int x = s.indexOf(a);
- if (x == -1) {
- continue;
- }
- x += a.length();
- final int y = s.indexOf(b, x);
- if (y == -1) {
- continue;
- }
- String msg = s.substring(x, y).trim(); //s, the actual message, will cut off <text> and </text> and trim out all unneeded spaces
- // if (!msg.contains(HASHTAG)) { //if hashtag is not there, it's done
- // continue;
- // }
- // if (msg.endsWith(HASHTAG)) { //if it has hashtag, set message
- // msg = msg.substring(0, msg.length() - HASHTAG.length()).trim(); //sets the message, to msg's substring with length, without the hashtag trimmed
- // }
- if (msg.isEmpty()) { //if the msg is empty, we're done.
- msg = "There is no message at this moment!";
- continue;
- }
- if (msg == null) {
- msg = "There is no message at this moment!";
- }
- loadTwitterUpdate = loadTwitterName + "" + msg; //sets the update to the message visible
- if (++c == count) { //count is how many to check
- break;
- }
- tweetsLoaded = true; //tells the program that the tweets were successfully loaded.
- }
- } catch (final IOException ignored) {
- } finally {
- try {
- if (reader != null) {
- reader.close();
- }
- if (stream != null) {
- stream.close();
- }
- } catch (final IOException ignored) {
- }
- }
- }
- // </editor-fold>
- // </editor-fold>
- /** Creates new form FuserCookGui */
- public FuserCookGui() {
- this.loadTweets(5);
- initComponents();
- }
- /** This method is called from within the constructor to
- * initialize the form.
- * WARNING: Do NOT modify this code. The content of this method is
- * always regenerated by the Form Editor.
- */
- @SuppressWarnings("unchecked")
- // <editor-fold defaultstate="collapsed" desc="Generated Code">
- private void initComponents() {
- jLabel1 = new javax.swing.JLabel();
- start = new javax.swing.JButton();
- mode = new javax.swing.JComboBox();
- jScrollPane1 = new javax.swing.JScrollPane();
- modeDesc = new javax.swing.JTextArea();
- devMode = new javax.swing.JCheckBox();
- msgfromdew = new javax.swing.JTextField();
- jLabel2 = new javax.swing.JLabel();
- fishType = new javax.swing.JComboBox();
- jLabel3 = new javax.swing.JLabel();
- logBurnCook = new javax.swing.JCheckBox();
- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- setTitle("Fuser Cook GUI");
- setAlwaysOnTop(true);
- jLabel1.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N
- jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel1.setText("Temporary GUI & Paint");
- jLabel1.setName("jLabel1"); // NOI18N
- start.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N
- start.setText("Start Script");
- start.setName("start"); // NOI18N
- start.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- startActionPerformed(evt);
- }
- });
- mode.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Select a Mode", "Mode 1", "Mode 2" }));
- mode.setName("mode"); // NOI18N
- mode.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- modeActionPerformed(evt);
- }
- });
- jScrollPane1.setName("jScrollPane1"); // NOI18N
- modeDesc.setColumns(20);
- modeDesc.setEditable(false);
- modeDesc.setLineWrap(true);
- modeDesc.setRows(5);
- modeDesc.setText("Please Select a Mode!");
- modeDesc.setWrapStyleWord(true);
- modeDesc.setName("modeDesc"); // NOI18N
- jScrollPane1.setViewportView(modeDesc);
- devMode.setText("Debug Mode");
- devMode.setName("devMode"); // NOI18N
- msgfromdew.setEditable(false);
- msgfromdew.setText(loadTwitterUpdate);
- msgfromdew.setName("msgfromdew"); // NOI18N
- jLabel2.setText("Message From Dew");
- jLabel2.setName("jLabel2"); // NOI18N
- fishType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pick a Fish", "Shrimp", "Anchovies", "Sardine", "Herring", "Trout", "Pike", "Salmon", "Tuna", "Lobster", "Swordfish" }));
- fishType.setName("fishType"); // NOI18N
- jLabel3.setText("Fish Type:");
- jLabel3.setName("jLabel3"); // NOI18N
- logBurnCook.setText("Log Burned/Cooked");
- logBurnCook.setName("logBurnCook"); // NOI18N
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(mode, 0, 380, Short.MAX_VALUE)
- .addContainerGap())
- .addComponent(start, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(devMode)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(logBurnCook, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jLabel3)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(fishType, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE))
- .addContainerGap())
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jLabel2)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(msgfromdew, javax.swing.GroupLayout.DEFAULT_SIZE, 283, Short.MAX_VALUE)
- .addContainerGap())
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabel1)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(mode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(devMode)
- .addComponent(fishType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel3)
- .addComponent(logBurnCook))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(msgfromdew, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel2))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(start, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
- );
- pack();
- }// </editor-fold>
- private void startActionPerformed(java.awt.event.ActionEvent evt) {
- if (mode.getSelectedIndex() == 0) {
- JOptionPane j = new JOptionPane();
- j.showMessageDialog(rootPane, "You must select a mode before continuing!", "WARNING:", j.WARNING_MESSAGE);
- return;
- }
- if (fishType.getSelectedIndex() == 0) {
- JOptionPane j = new JOptionPane();
- j.showMessageDialog(rootPane, "You must select a Fish Type before continuing!", "WARNING:", j.WARNING_MESSAGE);
- return;
- }
- setVisible(false);
- }
- private void modeActionPerformed(java.awt.event.ActionEvent evt) {
- if (mode.getSelectedIndex() == 0) {
- modeDesc.setText("You must first select a Mode to use!");
- } else if (mode.getSelectedIndex() == 1) {
- modeDesc.setText("Mode 1:\n"
- + "This mode uses interfaces, so is more accurate than Mode 2");
- } else if (mode.getSelectedIndex() == 2) {
- modeDesc.setText("Mode 2:\n"
- + "This mode uses mouse movements, meaning it is more optimized for speed.");
- }
- }
- // Variables declaration - do not modify
- protected javax.swing.JCheckBox devMode;
- protected javax.swing.JComboBox fishType;
- protected javax.swing.JLabel jLabel1;
- protected javax.swing.JLabel jLabel2;
- protected javax.swing.JLabel jLabel3;
- protected javax.swing.JScrollPane jScrollPane1;
- protected javax.swing.JCheckBox logBurnCook;
- protected javax.swing.JComboBox mode;
- protected javax.swing.JTextArea modeDesc;
- protected javax.swing.JTextField msgfromdew;
- protected javax.swing.JButton start;
- // End of variables declaration
- }
- // </editor-fold>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement