rj
2013-04-16 16:53:37
So I am learning Java and apart of me learning is I will try to write scripts for Runescape. Which bot should I script for? Powerbot epicbot tri-bot or what?
Here is the most complicated peice of code I have:(I think people on here helped me with it a little while back)
Don't run it.
Here is the most complicated peice of code I have:(I think people on here helped me with it a little while back)
import java.io.File;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.Color;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Robot;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.AWTException;
import java.io.IOException;
import javax.sound.sampled.*;
public class MyPanel extends JPanel implements ActionListener {
private JButton jcomp1,jcomp3;
private JMenuBar jcomp2;
private JLabel jcomp4;
public MyPanel() {
setBackground(Color.white);
JMenu buildMenu = new JMenu ("Build");
JMenuItem startItem = new JMenuItem ("Start");
buildMenu.add (startItem);
jcomp1 = new JButton ("Start");
jcomp2 = new JMenuBar();
jcomp2.add (buildMenu);
jcomp3 = new JButton ("Settings");
jcomp4 = new JLabel ("Hit start to begin");
setPreferredSize (new Dimension (476, 296));
setLayout (null);
add (jcomp1);
jcomp1.addActionListener(this);
add (jcomp2);
add (jcomp3);
jcomp3.addActionListener(this);
add (jcomp4);
jcomp1.setBounds (225, 240, 185, 35);
jcomp2.setBounds (0, 0, 480, 35);
jcomp3.setBounds (40, 240, 185, 35);
jcomp4.setBounds (175, 195, 130, 35);
jcomp1.setBackground(Color.white);
jcomp1.setForeground(Color.black);
jcomp3.setBackground(Color.white);
jcomp3.setForeground(Color.black);
jcomp4.setBackground(Color.white);
jcomp4.setForeground(Color.white);
}
public static void main (String[] args) throws IOException {
JFrame frame = new JFrame ("This");
frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add (new MyPanel());
frame.pack();
frame.setVisible (true);
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == jcomp1) {
System.out.println("HI");
}
if (e.getSource() == jcomp1) {
System.out.println("HI");
try {
while(true) {
File file = new File("c:\\newfile.txt");
Robot r = new Robot();
Process p = Runtime.getRuntime().exec("cmd /c start http://meatspin.com");
r.mouseMove(40,40);
if (file.createNewFile()){
System.out.println("File is created!");
}else{
System.out.println("File already exists.");
}
}
} catch (IOException | AWTException e1) {
e1.printStackTrace();
}
}
}
}Don't run it.