Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.WhiteberriesPro;
- import java.awt.Color;
- import java.awt.Point;
- import java.awt.event.ActionEvent;
- import java.io.FileInputStream;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import java.util.ArrayList;
- import javax.swing.GroupLayout;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JTextField;
- import javax.swing.LayoutStyle;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.util.Filter;
- import org.rsbot.script.wrappers.RSGroundItem;
- import org.rsbot.script.wrappers.RSItem;
- import org.rsbot.script.wrappers.RSNPC;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- @ScriptManifest(authors = {"Daniel987600"}, keywords = {"Quicker Picker Upper"}, name = "DPickUp", description = "Picks up items", version = 1.0)
- //Is on Top method has been fixed. Fix pickUp method
- //Look into serialization to store data (need to make load method)
- public class DPickUp extends Script {
- public interface Condition {
- public boolean isTrue();
- }
- ArrayList <RSTile> walkToBank = new ArrayList <RSTile>();
- ArrayList <RSTile> walkToItems = new ArrayList <RSTile>();
- ArrayList <Integer> pickUpIDList = new ArrayList <Integer>();
- ArrayList <String> pickUpNameList = new ArrayList <String>();
- int [] pickUpIDs;
- String [] pickUpNames;
- RSTile centerTile;
- int i = 0;
- int j = 0;
- int l = 0;
- int k = 0;
- boolean recording = false;
- boolean GUIStillGoing = true;
- boolean stopScript = false;
- boolean usingID;
- PickingGUI GUI = new PickingGUI();
- public boolean onStart() {
- log (Color.YELLOW, "Using an item's name to pick up an item is now supported!");
- log (Color.YELLOW, "However, if you wish to use names, you must write the name WITHOUT ERRORS");
- log (Color.YELLOW, "Capitalization DOES NOT count as an error!");
- GUI.setVisible (true);
- while (GUIStillGoing) {
- while (recording) {
- final RSTile dest = recordPath();
- waitIf (5000, new Condition () {
- public boolean isTrue () {
- RSTile Dest = walking.getDestination();
- if (Dest != null) {
- return (dest.equals(Dest));
- }
- return (calc.distanceBetween(players.getMyPlayer().getLocation(), dest) > 5);
- }
- });
- }
- k = 0;
- sleep(500);
- }
- GUI.setVisible(false);
- walkToItems = reversePath (walkToBank);
- if (walkToItems.size() == walkToBank.size() && walkToItems.get(walkToItems.size() - 1).equals(walkToBank.get(0)))
- log ("walkToItems successfully initialized!");
- else
- stopScript = true;
- log ("You are picking up the following items:");
- if (pickUpIDs.length > 0) {
- for (int jesus = 0; jesus < pickUpIDs.length; jesus++) {
- log ("Item #" +(jesus + 1) +" : (ID) " +pickUpIDs[jesus]);
- }
- }
- if (pickUpNames.length > 0) {
- for (int jesus = 0; jesus < pickUpNames.length; jesus++) {
- log ("Item #" +(jesus + 1 + pickUpIDs.length) +" : (Name) " +pickUpNames[jesus]);
- }
- }
- centerTile = walkToBank.get(0);
- return true;
- }
- private enum State {
- WalkToBank, WalkToItems, PickUpItems, Bank, ClimbStairs, DescendStairs
- }
- State getState () {
- if (inventory.isFull()) {
- RSNPC banker = npcs.getNearest("banker");
- if (objects.getNearest(36773, 36774) != null) return State.ClimbStairs;
- if (banker != null) return State.Bank;
- return State.WalkToBank;
- }
- if (game.getPlane() != 0) return State.DescendStairs;
- if (calc.distanceTo (centerTile) > 19) return State.WalkToItems;
- return State.PickUpItems;
- }
- @Override
- public int loop() {
- if (stopScript)
- return -1;
- if (walking.getEnergy() > (random(70, 85)) && !walking.isRunEnabled())
- walking.setRun(true);
- State State = getState();
- switch (State) {
- case WalkToBank:
- dropAllExcept();
- if (inventory.isFull()) {
- step (walkToBank);
- }
- break;
- case WalkToItems:
- step (walkToItems);
- break;
- case PickUpItems:
- if (waitIf (100000, new Condition () {
- public boolean isTrue () {
- return getNearest() == null;
- }
- })) pickUpItems();
- else step (walkToItems);
- break;
- case Bank:
- RSNPC banker = npcs.getNearest("banker");
- if (banker != null) {
- if (!banker.isOnScreen()) {
- step(walkToBank);
- camera.turnTo(banker);
- if (!banker.isOnScreen())
- camera.setPitch(false);
- }
- if (banker.isOnScreen()) {
- banker.interact("Bank");
- if (waitIf(1000, new Condition() {
- public boolean isTrue() {
- return !bank.isOpen();
- }
- })) {
- bank.depositAll();
- bank.close();
- break;
- }
- if (bank.open()) {
- bank.depositAll();
- bank.close();
- }
- }
- }
- break;
- case DescendStairs:
- climbDownStairs();
- break;
- case ClimbStairs:
- climbUpStairs();
- break;
- }
- return 0;
- }
- private void climbUpStairs() {
- final int plane = game.getPlane();
- RSObject StairMan = objects.getNearest (36773, 36774);
- if (StairMan != null) {
- if (!StairMan.isOnScreen()) {
- step(walkToBank);
- camera.turnTo(StairMan);
- if (!StairMan.isOnScreen())
- camera.setPitch (false);
- }
- if (StairMan.isOnScreen()) {
- StairMan.interact("Climb-up");
- waitIf(1000, new Condition() {
- public boolean isTrue() {
- return game.getPlane() == plane;
- }
- });
- }
- return;
- } else {
- return;
- }
- }
- private void climbDownStairs() {
- final int plane = game.getPlane();
- RSObject StairMan = objects.getNearest (36774, 36775);
- if (StairMan != null) {
- if (!StairMan.isOnScreen()) {
- step(walkToBank);
- camera.turnTo(StairMan);
- if (!StairMan.isOnScreen())
- camera.setPitch (false);
- }
- if (StairMan.isOnScreen()) {
- StairMan.interact("Climb-down");
- waitIf(1000, new Condition() {
- public boolean isTrue() {
- return game.getPlane() == plane;
- }
- });
- }
- return;
- } else {
- return;
- }
- }
- private RSTile recordPath() {
- if (k == 0) {
- walkToBank.add (players.getMyPlayer().getLocation());
- k++;
- }
- RSTile dest = walking.getDestination();
- if (dest != null) {
- if (!walkToBank.get(walkToBank.size() - 1).equals(dest))
- walkToBank.add(dest);
- return dest;
- }
- if (waitIf (5000, new Condition () {
- public boolean isTrue () {
- return walking.getDestination() == null;
- }
- })) {
- RSTile location = walking.getDestination();
- walkToBank.add (location);
- return location;
- } else {
- RSTile playerLocation = players.getMyPlayer().getLocation();
- if (!walkToBank.contains(playerLocation))
- walkToBank.add(playerLocation);
- return playerLocation;
- }
- }
- private void pickUpItems() {
- final RSGroundItem items = getNearest();
- if (items != null) {
- final int number = inventory.getCount(true, items.getItem().getID());
- RSTile itemSpot = items.getLocation();
- if walking.getDestination() != null
- playerDest = walking.getDestination();
- if (calc.distanceBetween (itemSpot, centerTile) <= 19) {
- if (!items.isOnScreen() || calc.distanceBetween(itemSpot, playerDest) > 3)
- walking.walkTo(itemSpot);
- camera.setPitch(true);
- camera.turnTo(itemSpot);
- if (items.isOnScreen()) {
- boolean onTop = isOnTop(items, itemSpot);
- while (!mouse.getLocation().equals(calc.tileToScreen(itemSpot)) && items.isOnScreen())
- mouse.move(calc.tileToScreen(itemSpot));
- if (items.isOnScreen()) {
- mouse.click(onTop);
- if (!onTop) {
- if (menu.doAction("Take", items.getItem().getName()))
- waitIf (random (1000, 2000), new Condition () {
- public boolean isTrue () {
- return number == inventory.getCount(true, items.getItem().getID()) && players.getMyPlayer().isMoving();
- }
- });
- } else
- waitIf (random (1000, 2000), new Condition () {
- public boolean isTrue () {
- return number == inventory.getCount(true, items.getItem().getID()) && players.getMyPlayer().isMoving();
- }
- });
- }
- }
- } else {
- step (walkToItems);
- }
- }
- }
- private boolean isOnTop (RSGroundItem item, RSTile tile) {
- if (item != null) {
- RSGroundItem[] itemList = groundItems.getAllAt(tile);
- if (itemList.length > 0) {
- RSGroundItem items = itemList [itemList.length - 1];
- return noNPCAtTile (tile) && items.getItem().getID() == item.getItem().getID();
- }
- } return false;
- }
- private boolean noNPCAtTile(final RSTile tile) {
- RSNPC[] npcList = npcs.getAll(new Filter <RSNPC> () {
- public boolean accept(RSNPC npc) {
- return npc.getLocation().equals(tile);
- }
- });
- return npcList.length == 0;
- }
- RSGroundItem getNearest () {
- return groundItems.getNearest(new Filter <RSGroundItem> () {
- public boolean accept(final RSGroundItem item) {
- if (item != null) {
- final String name = item.getItem().getName();
- final int ID = item.getItem().getID();
- if (pickUpNames.length > 0) {
- for (final String n: pickUpNames) {
- if (n.equalsIgnoreCase(name)) {
- usingID = false;
- return true;
- }
- }
- }
- if (pickUpIDs.length > 0) {
- for (final int id : pickUpIDs) {
- if (id == ID) {
- usingID = true;
- return true;
- }
- }
- }
- }
- return false;
- }
- });
- }
- public boolean dropAllExcept() {
- final int startCount = inventory.getCount();
- final RSTile startLocation = players.getMyPlayer().getLocation();
- boolean found_droppable = true;
- while (found_droppable && getCountExcept(false) != 0) {
- if (calc.distanceTo(startLocation) > 100) {
- break;
- }
- found_droppable = false;
- for (int j = 0; j < 28; j++) {
- final int c = j / 7;
- final int r = j % 7;
- final RSItem curItem = inventory.getItems()[c + r * 4];
- if (curItem != null) {
- int id = curItem.getID();
- if (id != -1) {
- boolean isInItems = false;
- for (final int i : pickUpIDs) {
- if (i == id) {
- isInItems = true;
- break;
- }
- }
- if (!isInItems) {
- for (final String string : pickUpNames) {
- if (string.equalsIgnoreCase(curItem.getName())) {
- isInItems = true;
- break;
- }
- }
- }
- if (!isInItems) {
- for (int d = 0; d < 3; d++) {
- if (inventory.dropItem(c, r)) {
- found_droppable = true;
- break;
- }
- sleep(random(100, 400));
- }
- }
- }
- }
- }
- sleep(random(400, 800));
- }
- return inventory.getCount() < startCount;
- }
- public int getCountExcept(final boolean includeStacks) {
- int count = 0;
- for (final RSItem i : inventory.getItems()) {
- if (i.getID() != -1) {
- boolean skip = false;
- for (final int id : pickUpIDs) {
- if (i.getID() == id) {
- skip = true;
- break;
- }
- }
- if (!skip) {
- for (final String string : pickUpNames) {
- if (i.getName().equalsIgnoreCase(string)) {
- skip = true;
- break;
- }
- }
- }
- if (!skip) {
- count += includeStacks ? i.getStackSize() : 1;
- }
- }
- }
- return count;
- }
- private int step(ArrayList<RSTile> path) {
- if (calc.distanceBetween(players.getMyPlayer().getLocation(), path.get(path.size() - 1)) < 2)
- return path.size();
- RSTile dest = walking.getDestination();
- int index = -1;
- int shortestDist = 0, dist, shortest = -16;
- if (dest != null) {
- for (int i = 0; i < path.size(); i++) {
- dist = (int) calc.distanceBetween(path.get(i), dest);
- if (shortest < 0 || shortestDist > dist) {
- shortest = i;
- shortestDist = dist;
- }
- }
- }
- for (int i = (path.size() - 1); i > -1; i--) {
- if (calc.distanceBetween(players.getMyPlayer().getLocation(), path.get(i)) < 17) {
- index = i;
- break;
- }
- }
- if (index >= 0) {
- for (int i = 0; i < 10 && dest != null && (index <= shortest) && players.getMyPlayer().isMoving(); i++) {
- if (game.getClientState() != 10 && game.getClientState() != 11) {
- i = 0;
- }
- sleep(100);
- }
- if (dest == null || (index > shortest) || !players.getMyPlayer().isMoving()) {
- walkTile(path.get(index), 0, 0);
- sleep(statNumberGenerator(180, 420, 265, 50));
- return index;
- }
- }
- if (walking.getDestination() != null && index >= 0) {
- if (calc.distanceBetween(walking.getDestination(), path.get(index)) < 3)
- return -2;
- return -1;
- } else if (walking.getDestination() == null) {
- if (stepTileInStraightLine(path.get(path.size() - 1))) return -2;
- return -1;
- } else {
- return -2;
- }
- }
- private boolean stepTileInStraightLine(RSTile t) {
- RSTile PlayerPosition = players.getMyPlayer().getLocation();
- double x = t.getX() - PlayerPosition.getX();
- double y = t.getY() - PlayerPosition.getY();
- double theta = -Math.PI;
- theta = Math.atan(y/x);
- if (x < 0) theta = theta + Math.PI;
- if (theta < 0) theta = theta + 2*Math.PI;
- if (theta != -Math.PI) {
- Point p = calc.worldToMinimap((PlayerPosition.getX() + 17*Math.cos(theta)), (PlayerPosition.getY() + 17*Math.sin(theta)));
- if (!p.equals(new Point (-1, -1))) {
- mouse.move(p);
- mouse.click(true);
- return true;
- }
- }
- return false;
- }
- private boolean waitIf (int threshold, Condition waitIf) {
- int millis = threshold / 2;
- while (millis > 100) {
- millis = millis / 2;
- }
- for (int i = 0; i < (int) (1 + (threshold / millis)) && waitIf.isTrue(); i++) {
- if (!game.isLoggedIn() || i == threshold/millis)
- return false;
- sleep(millis);
- }
- return true;
- }
- private boolean walkTile(RSTile t, int x, int y) {
- RSTile dest = new RSTile(t.getX() + random(0, x), t.getY()
- + random(0, y));
- Point p = calc.tileToMinimap(dest);
- if (p.x != -1 && p.y != -1) {
- mouse.move(p);
- Point p2 = calc.tileToMinimap(dest);
- if (p2.x != -1 && p2.y != -1) {
- mouse.click(p2, true);
- return true;
- }
- }
- return false;
- }
- private int statNumberGenerator(int lo, int hi, int mean, int sd) {
- java.util.Random r = new java.util.Random();
- int rand;
- do {
- rand = (int) (r.nextGaussian() * sd + mean);
- } while (rand < lo || rand >= hi);
- return rand;
- }
- ArrayList <RSTile> reversePath (ArrayList <RSTile> path) {
- ArrayList <RSTile> backwardsPath = new ArrayList <RSTile>();
- for (int i = path.size() - 1; i > -1; i--) {
- backwardsPath.add(path.get(i));
- }
- return backwardsPath;
- }
- public class PickingGUI extends JFrame {
- private static final long serialVersionUID = 1L;
- public PickingGUI() {
- initComponents();
- }
- private void StartButtonActionPerformed(java.awt.event.ActionEvent evt) {
- if (walkToBank.size() < 1) log ("You have not yet recorded a path!");
- else if (pickUpIDList.size() < 1 && pickUpNameList.size() < 1) log ("You have not yet inputted items to pick up!");
- else {
- pickUpIDs = new int [j];
- for (int h = 0; h < pickUpIDList.size(); h++) {
- pickUpIDs[h] = pickUpIDList.get(h);
- }
- pickUpNames = new String [l];
- for (int h = 0; h < pickUpNameList.size(); h++) {
- pickUpNames[h] = pickUpNameList.get(h);
- }
- GUIStillGoing = false;
- }
- if (GUIStillGoing) log ("Please finish before you hit the StartButton!");
- }
- private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {
- stopScript = true;
- GUIStillGoing = false;
- }
- private void RecordButtonActionPerformed(java.awt.event.ActionEvent evt) {
- i++;
- if (i % 2 == 0) {
- recording = false;
- if (walkToBank.size() < 2) {
- jLabel5.setText("There was an error recording. Please record again!");
- RecordButton.setText("Click to start recording");
- } else {
- jLabel5.setText("You have successfully recorded a path!");
- RecordButton.setText("Path already recorded.");
- }
- } else {
- recording = true;
- jLabel5.setText("You are recording! Please use the Minimap to Walk!");
- RecordButton.setText("Recording!");
- }
- }
- private void SaveButtonActionPerformed(java.awt.event.ActionEvent evt) {
- try {
- if (j > 0) {
- ObjectOutputStream outIDs = new ObjectOutputStream(new FileOutputStream("DPickUp.IDs"));
- pickUpIDs = new int [j];
- for (int h = 0; h < pickUpIDList.size(); h++) {
- pickUpIDs[h] = pickUpIDList.get(h);
- log ("Item Saved #" +(h + 1) +" : (ID) " +pickUpIDs[h]);
- }
- outIDs.writeObject(pickUpIDs);
- outIDs.flush();
- outIDs.close();
- }
- if (l > 0) {
- ObjectOutputStream outNames = new ObjectOutputStream(new FileOutputStream("DPickUp.Names"));
- pickUpNames = new String [l];
- for (int h = 0; h < pickUpNameList.size(); h++) {
- pickUpNames[h] = pickUpNameList.get(h);
- log ("Item #" +(h + 1 + pickUpIDs.length) +" : (Name) " +pickUpNames[h]);
- }
- outNames.writeObject(pickUpNames);
- outNames.flush();
- outNames.close();
- }
- if (walkToBank.size() > 0) {
- ObjectOutputStream outPath = new ObjectOutputStream(new FileOutputStream("DPickUp.Path"));
- outPath.writeObject(walkToBank);
- outPath.flush();
- outPath.close();
- ObjectOutputStream outTile = new ObjectOutputStream(new FileOutputStream("DPickUp.Tile"));
- outTile.writeObject(centerTile);
- outTile.flush();
- outTile.close();
- log ("You have saved your path to the bank");
- }
- } catch (IOException e) {
- log (Color.RED, "This is embarassing: unable to save your information.");
- log (Color.RED, "Please try again and make sure to post on the forums. Sorry!");
- e.printStackTrace();
- }
- }
- @SuppressWarnings("unchecked")
- private void LoadButtonActionPerformed(java.awt.event.ActionEvent evt) {
- //TODO: What is a ClassNotFoundException?
- try {
- try {
- ObjectInputStream inIDs = new ObjectInputStream(new FileInputStream("DPickUp.IDs"));
- pickUpIDList = (ArrayList <Integer>) inIDs.readObject();
- inIDs.close();
- j = pickUpIDList.size();
- for (int jesus = 0; jesus < j; jesus++) {
- log ("Item Loaded #" +(jesus + 1) +" : (ID) " +pickUpIDList.get(jesus));
- }
- } catch (ClassNotFoundException e) {
- log (Color.YELLOW, "No IDs were found");
- log (Color.YELLOW, "If you are sure that you saved IDs, please post on the forums. Sorry!");
- e.printStackTrace();
- }
- try {
- ObjectInputStream inNames = new ObjectInputStream(new FileInputStream("DPickUp.Names"));
- pickUpNameList = (ArrayList<String>) inNames.readObject();
- inNames.close();
- l = pickUpNameList.size();
- for (int jesus = 0; jesus < l; jesus++) {
- log ("Item Loaded #" +(jesus + 1 + j) +" : (Name) " +pickUpNameList.get(jesus));
- }
- } catch (ClassNotFoundException e) {
- log (Color.YELLOW, "No Names were found");
- log (Color.YELLOW, "If you are sure that you saved Names, please post on the forums. Sorry!");
- e.printStackTrace();
- }
- try {
- ObjectInputStream inPath = new ObjectInputStream(new FileInputStream("DPickUp.Path"));
- walkToBank = (ArrayList <RSTile>) inPath.readObject();
- inPath.close();
- ObjectInputStream inTile = new ObjectInputStream(new FileInputStream("DPickUp.Tile"));
- centerTile = (RSTile) inTile.readObject();
- inTile.close();
- } catch (ClassNotFoundException e) {
- log (Color.YELLOW, "No Path to Bank was found");
- log (Color.YELLOW, "If you are sure that you saved a path to the bank, please post on the forums. Sorry!");
- e.printStackTrace();
- }
- } catch (IOException e) {
- log (Color.RED, "Unable to load your information. This error DOES NOT mean that you didn't save information. Please try again!");
- log(Color.RED, "If you have tried multiple times, please make sure to post on the forums. Sorry!");
- e.printStackTrace();
- }
- }
- private void jButton2ActionPerformed(ActionEvent evt) {
- try {
- Integer currentID = Integer.parseInt (ItemIDField.getText());
- if (!pickUpIDList.contains(currentID)) {
- pickUpIDList.add(currentID);
- j++;
- InformationLabel.setText("The last ID you inputted: " +currentID);
- } else
- InformationLabel.setText("You already inputted this ID");
- } catch (NumberFormatException e) {
- log ("You did not enter a number. Shame on you!");
- }
- }
- private void jButton3ActionPerformed(ActionEvent evt) {
- if (pickUpIDList.size() > 0) {
- int size = pickUpIDList.size() - 1;
- Integer e = pickUpIDList.get(size);
- pickUpIDList.remove(size);
- j--;
- InformationLabel.setText("You removed the ID: " +e.intValue());
- } else InformationLabel.setText ("Please input IDs before you try to remove them.");
- }
- private void jButton4ActionPerformed(ActionEvent evt) {
- try {
- Integer currentID = Integer.parseInt (ItemNameField.getText());
- if (!pickUpIDList.contains(currentID)) {
- pickUpIDList.add(currentID);
- j++;
- InformationLabel.setText("The last Name you inputted: " +currentID);
- } else
- InformationLabel.setText("You already inputted this Name");
- } catch (NumberFormatException e) {
- String currentString = ItemNameField.getText();
- if (!pickUpNameList.contains(currentString)) {
- pickUpNameList.add (currentString);
- l++;
- InformationLabel.setText("The last Name you inputted: " + currentString);
- } else
- InformationLabel.setText("You already inputted this name");
- }
- }
- private void jButton5ActionPerformed(ActionEvent evt) {
- if (pickUpNameList.size() > 0) {
- int size = pickUpNameList.size() - 1;
- String e = pickUpNameList.get(size);
- pickUpNameList.remove(size);
- l--;
- InformationLabel.setText("You removed the Name: " +e);
- } else InformationLabel.setText ("Please input Names before you try to remove them.");
- }
- private void initComponents() {
- InformationLabel = new JLabel();
- jLabel1 = new JLabel();
- jLabel2 = new JLabel();
- jLabel5 = new JLabel();
- StartButton = new JButton();
- RecordButton = new JButton();
- CancelButton = new JButton();
- SaveButton = new JButton();
- LoadButton = new JButton();
- jButton2 = new JButton();
- jButton3 = new JButton();
- jButton4 = new JButton();
- jButton5 = new JButton();
- ItemIDField = new JTextField();
- ItemNameField = new JTextField();
- StartButton.setText("Let's Start!");
- StartButton.setName("StartButton");
- StartButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- StartButtonActionPerformed(evt);
- }
- });
- CancelButton.setText("Cancel");
- CancelButton.setName("CancelButton");
- CancelButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- CancelButtonActionPerformed(evt);
- }
- });
- RecordButton.setText("Click to start recording");
- RecordButton.setName("RecordButton");
- RecordButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- RecordButtonActionPerformed(evt);
- }
- });
- SaveButton.setText("Click to start recording");
- SaveButton.setName("SaveButton");
- SaveButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- SaveButtonActionPerformed(evt);
- }
- });
- LoadButton.setText("Click to start recording");
- LoadButton.setName("LoadButton");
- LoadButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- LoadButtonActionPerformed(evt);
- }
- });
- jButton2.setText("Click: Insert ID");
- jButton2.setName("jButton2");
- jButton2.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton2ActionPerformed(evt);
- }
- });
- jButton3.setText("Click: Remove last ID");
- jButton3.setName("jButton3");
- jButton3.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton3ActionPerformed(evt);
- }
- });
- jButton4.setText("Click: Insert Name");
- jButton4.setName("jButton4");
- jButton4.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton4ActionPerformed(evt);
- }
- });
- jButton5.setText("Click: Remove last Name");
- jButton5.setName("jButton5");
- jButton5.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton5ActionPerformed(evt);
- }
- });
- ItemIDField.setText("Insert ID of item HERE");
- ItemIDField.setName("ItemIDField");
- ItemNameField.setText("Insert Name of item HERE");
- ItemNameField.setName ("ItemNameField");
- InformationLabel.setText("You have not inputted any IDs yet. You can put in multiple!");
- InformationLabel.setName("InformationLabel");
- jLabel1.setFont(new java.awt.Font("Lucida Grande", 0, 30));
- jLabel1.setText("DPickUp");
- jLabel1.setName("jLabel1");
- jLabel2.setFont(new java.awt.Font("Lucida Grande", 0, 22));
- jLabel2.setText("Picks Up Stuff for You!");
- jLabel5.setText("Click button below: record your path from the SPOT to the BANK");
- jLabel5.setName("jLabel5");
- GroupLayout layout = new GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(InformationLabel, GroupLayout.DEFAULT_SIZE, 425, Short.MAX_VALUE)
- .addContainerGap())
- .addGroup(layout.createSequentialGroup()
- .addGap(24, 24, 24)
- .addComponent(jLabel2, GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE)
- .addGap(22, 22, 22))
- .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
- .addComponent(jLabel5, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 379, Short.MAX_VALUE)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(ItemNameField, GroupLayout.DEFAULT_SIZE, 201, Short.MAX_VALUE)
- .addComponent(ItemIDField, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 201, Short.MAX_VALUE))
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(jButton3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jButton2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jButton4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jButton5, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
- .addComponent(CancelButton, GroupLayout.PREFERRED_SIZE, 163, GroupLayout.PREFERRED_SIZE))
- .addGap(66, 66, 66))
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabel1)
- .addGap(47, 47, 47)
- .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
- .addComponent(SaveButton, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)
- .addComponent(LoadButton, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE))
- .addContainerGap())))
- .addGroup(layout.createSequentialGroup()
- .addGap(88, 88, 88)
- .addComponent(RecordButton, GroupLayout.PREFERRED_SIZE, 206, GroupLayout.PREFERRED_SIZE)
- .addContainerGap(171, Short.MAX_VALUE))
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(StartButton, GroupLayout.PREFERRED_SIZE, 163, GroupLayout.PREFERRED_SIZE)
- .addContainerGap(285, Short.MAX_VALUE))
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 44, GroupLayout.PREFERRED_SIZE)
- .addComponent(LoadButton, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
- .addComponent(SaveButton, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(InformationLabel)
- .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(7, 7, 7)
- .addComponent(jButton2, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jButton3, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
- .addGap(5, 5, 5)
- .addComponent(jButton4, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jButton5, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE))
- .addGroup(layout.createSequentialGroup()
- .addGap(18, 18, 18)
- .addComponent(ItemIDField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(ItemNameField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
- .addGap(24, 24, 24)
- .addComponent(jLabel5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(RecordButton)
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(StartButton)
- .addComponent(CancelButton))
- .addContainerGap())
- );
- pack();
- }
- private JButton StartButton;
- private JButton CancelButton;
- private JButton RecordButton;
- private JButton SaveButton;
- private JButton LoadButton;
- private JButton jButton2;
- private JButton jButton3;
- private JButton jButton4;
- private JButton jButton5;
- private JTextField ItemIDField;
- private JTextField ItemNameField;
- private JLabel InformationLabel;
- private JLabel jLabel1;
- private JLabel jLabel2;
- private JLabel jLabel5;
- }
- }
Add Comment
Please, Sign In to add comment