Guest User

Untitled

a guest
Apr 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.40 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.  
  19.        public void init()
  20.        {
  21.         //Form size
  22.         setSize(500, 250);
  23.         //Text and Buttons
  24.         Panel bottomPanel = new Panel();
  25.         bottomPanel.add(theDisplay);
  26.         bottomPanel.add(start);
  27.         add(bottomPanel);
  28.         //Radio buttons
  29.         add(tree);
  30.         add(levels);
  31.         //Lists
  32.         add(townList);
  33.         add(treeList);
  34.         //Buttons
  35.         add(start);
  36.  
  37.         start.addActionListener(this);
  38.  
  39.         //Towns
  40.         townList.add("Lumbridge");
  41.         townList.add("Varrock");
  42.         townList.add("Falador");
  43.         townList.add("Al Khari");
  44.         //Trees
  45.         if(levels.getState() == true)
  46.         {
  47.             treeList.removeAll();
  48.             treeList.add("1-20");
  49.             treeList.add("20-40");
  50.             treeList.add("40-60");
  51.             treeList.add("60-80");
  52.             treeList.add("80-99");
  53.            
  54.         }
  55.         if(tree.getState() == true)
  56.         {
  57.             if(townList.getSelectedItem() == "Lumbridge")
  58.             {
  59.                 treeList.removeAll();
  60.                 treeList.add("Tree");
  61.                 treeList.add("Oak");
  62.                 treeList.add("Willow");
  63.                 treeList.add("Yew");
  64.                 treeList.add("All");
  65.             }
  66.             if(townList.getSelectedItem() == "Varrock")
  67.             {
  68.                 treeList.removeAll();
  69.                 treeList.add("Tree");
  70.                 treeList.add("Oak");
  71.                 treeList.add("Willow");
  72.                 treeList.add("Yew");
  73.                 treeList.add("Ivy");
  74.                 treeList.add("Magic");
  75.                 treeList.add("All");
  76.             }
  77.             if(townList.getSelectedItem() == "Falador")
  78.             {
  79.                 treeList.removeAll();
  80.                 treeList.add("Tree");
  81.                 treeList.add("Oak");
  82.                 treeList.add("Yew");
  83.                 treeList.add("Ivy");
  84.                 treeList.add("All");
  85.             }
  86.             if(townList.getSelectedItem() == "Edgeville")
  87.             {          
  88.                 treeList.removeAll();
  89.                 treeList.add("Willow");
  90.                 treeList.add("Yew");
  91.                 treeList.add("All");
  92.                
  93.             }
  94.             if(townList.getSelectedItem() == "Rimmington")
  95.             {
  96.                 treeList.removeAll();
  97.                 treeList.add("Willow");
  98.             }
  99.         }
  100.  
  101.       }
  102.       /**
  103.       *
  104.       * @param e carries details about the event that occurred
  105.       */
  106.        
  107.       public void actionPerformed(ActionEvent e) //Start Script
  108.       {
  109.         //Assigning variables, and printing text
  110.         String treecut = treeList.getSelectedItem();
  111.         String town = townList.getSelectedItem();
  112.         if(levels.getState() == true)
  113.         {
  114.         theDisplay.append("Cutting level " + treecut + " trees in "
  115.                          + town + ".\n");
  116.         }
  117.         if(tree.getState() == true)
  118.         {
  119.             if(treeList.getSelectedItem() == "All")
  120.             {
  121.                 theDisplay.append("Cutting " + treecut + " trees in "
  122.                          + town + ".\n");
  123.             }
  124.             if(treeList.getSelectedItem() != "All")
  125.             {
  126.             theDisplay.append("Cutting " + treecut + "s in "
  127.                          + town + ".\n");
  128.             }
  129.         }
  130.        startScript = true;
  131.       }
  132.      
  133. }
Add Comment
Please, Sign In to add comment