Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Interface;
- import java.applet.Applet;
- import java.awt.*;
- import java.awt.event.*;
- public class Gooey extends Applet implements ActionListener
- {
- boolean startScript = false;
- private CheckboxGroup autoCut = new CheckboxGroup();
- private Checkbox tree = new Checkbox("Cut by tree", autoCut, true);
- private Checkbox levels = new Checkbox("Cut by level", autoCut, false);
- private Choice townList = new Choice();
- private Choice treeList = new Choice();
- private TextArea theDisplay = new TextArea();
- private Button start = new Button("Start Script");
- public void init()
- {
- //Form size
- setSize(500, 250);
- //Text and Buttons
- Panel bottomPanel = new Panel();
- bottomPanel.add(theDisplay);
- bottomPanel.add(start);
- add(bottomPanel);
- //Radio buttons
- add(tree);
- add(levels);
- //Lists
- add(townList);
- add(treeList);
- //Buttons
- add(start);
- start.addActionListener(this);
- //Towns
- townList.add("Lumbridge");
- townList.add("Varrock");
- townList.add("Falador");
- townList.add("Al Khari");
- //Trees
- if(levels.getState() == true)
- {
- treeList.removeAll();
- treeList.add("1-20");
- treeList.add("20-40");
- treeList.add("40-60");
- treeList.add("60-80");
- treeList.add("80-99");
- }
- if(tree.getState() == true)
- {
- if(townList.getSelectedItem() == "Lumbridge")
- {
- treeList.removeAll();
- treeList.add("Tree");
- treeList.add("Oak");
- treeList.add("Willow");
- treeList.add("Yew");
- treeList.add("All");
- }
- if(townList.getSelectedItem() == "Varrock")
- {
- treeList.removeAll();
- treeList.add("Tree");
- treeList.add("Oak");
- treeList.add("Willow");
- treeList.add("Yew");
- treeList.add("Ivy");
- treeList.add("Magic");
- treeList.add("All");
- }
- if(townList.getSelectedItem() == "Falador")
- {
- treeList.removeAll();
- treeList.add("Tree");
- treeList.add("Oak");
- treeList.add("Yew");
- treeList.add("Ivy");
- treeList.add("All");
- }
- if(townList.getSelectedItem() == "Edgeville")
- {
- treeList.removeAll();
- treeList.add("Willow");
- treeList.add("Yew");
- treeList.add("All");
- }
- if(townList.getSelectedItem() == "Rimmington")
- {
- treeList.removeAll();
- treeList.add("Willow");
- }
- }
- }
- /**
- *
- * @param e carries details about the event that occurred
- */
- public void actionPerformed(ActionEvent e) //Start Script
- {
- //Assigning variables, and printing text
- String treecut = treeList.getSelectedItem();
- String town = townList.getSelectedItem();
- if(levels.getState() == true)
- {
- theDisplay.append("Cutting level " + treecut + " trees in "
- + town + ".\n");
- }
- if(tree.getState() == true)
- {
- if(treeList.getSelectedItem() == "All")
- {
- theDisplay.append("Cutting " + treecut + " trees in "
- + town + ".\n");
- }
- if(treeList.getSelectedItem() != "All")
- {
- theDisplay.append("Cutting " + treecut + "s in "
- + town + ".\n");
- }
- }
- startScript = true;
- }
- }
Add Comment
Please, Sign In to add comment