Guest User

Untitled

a guest
Apr 21st, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.64 KB | None | 0 0
  1. package Interface;
  2.  
  3. import java.applet.Applet;
  4. import java.awt.*;
  5. import java.awt.event.*;
  6.  
  7.  
  8. public class Gooey extends Applet implements ActionListener
  9. {
  10.        boolean startScript = false;
  11.        private CheckboxGroup autoCut = new CheckboxGroup();
  12.        private Checkbox tree = new Checkbox("Cut by tree", autoCut, true);
  13.        private Checkbox levels = new Checkbox("Cut by level", autoCut, false);
  14.        private Choice townList = new Choice();
  15.        private Choice treeList = new Choice();
  16.        private TextArea theDisplay = new TextArea();
  17.        private Button start = new Button("Start Script");
  18.        private Button stop = new Button("Stop Script");
  19.        
  20.        public void init()
  21.        {
  22.         //Form size
  23.         setSize(500, 250);
  24.         //Text and Buttons
  25.         Panel bottomPanel = new Panel();
  26.         bottomPanel.add(theDisplay);
  27.         bottomPanel.add(start);
  28.         bottomPanel.add(stop);
  29.         add(bottomPanel);
  30.         //Radio buttons
  31.         add(tree);
  32.         add(levels);
  33.         //Lists
  34.         add(townList);
  35.         add(treeList);
  36.         //Buttons
  37.         add(start);
  38.         add(stop);
  39.  
  40.         start.addActionListener(this);
  41.  
  42.         //Towns
  43.         townList.add("Lumbridge");
  44.         townList.add("Varrock");
  45.         townList.add("Falador");
  46.         townList.add("Al Khari");
  47.         //Trees
  48.         if(levels.getState() == true)
  49.         {
  50.             treeList.removeAll();
  51.             treeList.add("1-20");
  52.             treeList.add("20-40");
  53.             treeList.add("40-60");
  54.             treeList.add("60-80");
  55.             treeList.add("80-99");
  56.            
  57.         }
  58.         if(tree.getState() == true)
  59.         {
  60.             if(townList.getSelectedItem() == "Lumbridge")
  61.             {
  62.                 treeList.removeAll();
  63.                 treeList.add("Tree");
  64.                 treeList.add("Oak");
  65.                 treeList.add("Willow");
  66.                 treeList.add("Yew");
  67.                 treeList.add("All");
  68.             }
  69.             if(townList.getSelectedItem() == "Varrock")
  70.             {
  71.                 treeList.removeAll();
  72.                 treeList.add("Tree");
  73.                 treeList.add("Oak");
  74.                 treeList.add("Willow");
  75.                 treeList.add("Yew");
  76.                 treeList.add("Ivy");
  77.                 treeList.add("Magic");
  78.                 treeList.add("All");
  79.             }
  80.             if(townList.getSelectedItem() == "Falador")
  81.             {
  82.                 treeList.removeAll();
  83.                 treeList.add("Tree");
  84.                 treeList.add("Oak");
  85.                 treeList.add("Yew");
  86.                 treeList.add("Ivy");
  87.                 treeList.add("All");
  88.             }
  89.             if(townList.getSelectedItem() == "Edgeville")
  90.             {          
  91.                 treeList.removeAll();
  92.                 treeList.add("Willow");
  93.                 treeList.add("Yew");
  94.                 treeList.add("All");
  95.                
  96.             }
  97.             if(townList.getSelectedItem() == "Rimmington")
  98.             {
  99.                 treeList.removeAll();
  100.                 treeList.add("Willow");
  101.             }
  102.         }
  103.  
  104.       }
  105.       /**
  106.       *
  107.       * @param e carries details about the event that occurred
  108.       */
  109.        
  110.       public void actionPerformed(ActionEvent e) //Start Script
  111.       {
  112.         //Assigning variables, and printing text
  113.         String treecut = treeList.getSelectedItem();
  114.         String town = townList.getSelectedItem();
  115.         if(levels.getState() == true)
  116.         {
  117.         theDisplay.append("Cutting level " + treecut + " trees in "
  118.                          + town + ".\n");
  119.         }
  120.         if(tree.getState() == true)
  121.         {
  122.             if(treeList.getSelectedItem() == "All")
  123.             {
  124.                 theDisplay.append("Cutting " + treecut + " trees in "
  125.                          + town + ".\n");
  126.             }
  127.             if(treeList.getSelectedItem() != "All")
  128.             {
  129.             theDisplay.append("Cutting " + treecut + "s in "
  130.                          + town + ".\n");
  131.             }
  132.         }
  133.        startScript = true;
  134.       }
  135.      
  136.       public void actionPerformed(ActiveEvent ae) //Stop Script
  137.       {
  138.           theDisplay.append("Script Stopped.\n");
  139.           startScript = false;
  140.       }
  141. }
Add Comment
Please, Sign In to add comment