Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.util.Filter;
- ***********GUI************
- **************************/
- @SuppressWarnings("serial")
- private class LJGUI extends JFrame implements ActionListener, ItemListener {
- private JLabel treeLabel = new JLabel("Tree Type:");
- private JComboBox treeBox = new JComboBox(getTrees());
- private JLabel locationLabel = new JLabel("Location:");
- private JComboBox locationBox = new JComboBox(getloc());
- private JLabel mouseSpeedLabel = new JLabel("Mouse Speed:");
- private SpinnerModel model1 = new SpinnerNumberModel(7,1,15,1);
- private JSpinner mouseSpeedSpinner = new JSpinner(model1);
- private JCheckBox powerChopB = new JCheckBox("Power Chop");
- private JCheckBox skillerB = new JCheckBox("Skiller");
- private JCheckBox mouseKeysB = new JCheckBox("Mouse Keys");
- private JCheckBox miniBreaksB = new JCheckBox("Mini Breaks");
- private JCheckBox nestsB = new JCheckBox("Collect Nests");
- private JButton startB = new JButton("Start");
- private JButton cancelB = new JButton("Cancel");
- public LJGUI(){
- super("ProgBots Lumberjack Settings");
- treeBox.addActionListener(this);
- locationBox.addActionListener(this);
- mouseSpeedSpinner.addChangeListener(listener);
- powerChopB.addItemListener(this);
- skillerB.addItemListener(this);
- mouseKeysB.addItemListener(this);
- startB.addActionListener(this);
- cancelB.addActionListener(this);
- treeBoxUpdate();
- initComponents();
- setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- }
- public void actionPerformed(ActionEvent e) {
- Object source = e.getSource();
- if (source == treeBox){
- treeBoxUpdate();
- }
- if (source == locationBox){
- locationBoxUpdate();
- }
- if (source == startB) {
- Object o = locationBox.getSelectedItem();
- for (int i = 0; i < aLocations.length; i++) {
- if (o.equals(aLocations[i].name)) {
- treeType type = aLocations[i].treeType;
- bankArea = aLocations[i].bankArea;
- treeArea = aLocations[i].treeArea;
- path = aLocations[i].path;
- treeType = type.name;
- treeID = type.treeIDs;
- stumpID = type.stumpID;
- logsID = type.logID;
- xpPerLog = type.exp;
- break;
- }
- }
- if (powerChopB.isSelected())
- powerChop = true;
- if (skillerB.isSelected())
- skiller = true;
- if (mouseKeysB.isSelected())
- mouseKeys = true;
- if (miniBreaksB.isSelected())
- miniBreaks = true;
- if (nestsB.isSelected())
- collectNests = true;
- start = true;
- }
- if (source == cancelB) {
- cancelled = true;
- }
- }
- public void itemStateChanged(ItemEvent e) {
- Object source = e.getSource();
- if (source == mouseKeysB) {
- if (e.getStateChange() == ItemEvent.SELECTED) {
- powerChopB.setSelected(true);
- powerChopB.setEnabled(false);
- } else if (e.getStateChange() == ItemEvent.DESELECTED) {
- Object o = locationBox.getSelectedItem();
- if (o.toString().endsWith("(P)")) {
- powerChopB.setEnabled(false);
- } else {
- powerChopB.setEnabled(true);
- }
- }
- }
- }
- ChangeListener listener = new ChangeListener() {
- public void stateChanged(ChangeEvent c) {
- mouse.setSpeed((Integer) mouseSpeedSpinner.getValue());
- }
- };
- private void treeBoxUpdate(){
- int i = treeBox.getSelectedIndex();
- treeType = tTypes[i].name;
- ComboBoxModel temp = new DefaultComboBoxModel(getloc());
- locationBox.setModel(temp);
- }
- private void locationBoxUpdate() {
- Object o = locationBox.getSelectedItem();
- if (o.toString().endsWith("(P)")) {
- powerChopB.setSelected(true);
- powerChopB.setEnabled(false);
- } else {
- powerChopB.setEnabled(true);
- }
- if (o == "Port Sarim - Willows") {
- useDepositBox = true;
- } else {
- useDepositBox = false;
- }
- if (o.toString().contains("Tree Gnome")){
- tgy = true;
- } else {
- tgy = false;
- }
- }
- private void initComponents(){
- Container contentPane = getContentPane();
- contentPane.setLayout(new GridBagLayout());
- ((GridBagLayout)contentPane.getLayout()).columnWidths = new int[] {100, 95, 0};
- contentPane.add(treeLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(5, 5, 5, 5), 0, 0));
- contentPane.add(treeBox, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 5, 5, 5), 0, 0));
- contentPane.add(locationLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 5, 5, 5), 0, 0));
- contentPane.add(locationBox, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 5, 5, 5), 0, 0));
- contentPane.add(mouseSpeedLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 5, 5, 5), 0, 0));
- contentPane.add(mouseSpeedSpinner, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 5, 5, 5), 0, 0));
- contentPane.add(powerChopB, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- contentPane.add(skillerB, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 5, 5, 5), 0, 0));
- contentPane.add(mouseKeysB, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- contentPane.add(miniBreaksB, new GridBagConstraints(0, 7, 1, 1, 0, 0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 5, 5, 5), 0 ,0));
- contentPane.add(nestsB, new GridBagConstraints(1, 7, 1, 1, 0, 0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 5), 0 ,0));
- contentPane.add(startB, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 5, 5, 5), 0, 0));
- contentPane.add(cancelB, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 5), 0, 0));
- pack();
- setLocationRelativeTo(getOwner());
- }
- private String[] getTrees(){
- String[] trees;
- trees = new String[tTypes.length];
- for (int i = 0; i < tTypes.length; i++){
- trees[i] = tTypes[i].name;
- }
- return trees;
- }
- private String[] getloc(){
- ArrayList<String> temp = new ArrayList<String>();
- int j = treeBox.getSelectedIndex();
- for (int i = 0; i < aLocations.length; i++){
- if (aLocations[i].treeType.name.equals(tTypes[j].name)){
- temp.add(aLocations[i].name);
- }
- }
- String[] loc = new String[temp.size()];
- for (int i = 0; i < temp.size(); i++){
- loc[i] = temp.get(i);
- }
- return loc;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement