Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.AWTException;
- import java.awt.BorderLayout;
- import java.awt.EventQueue;
- import java.awt.Robot;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.border.EmptyBorder;
- import javax.swing.JLabel;
- import javax.swing.JTextField;
- import javax.swing.JButton;
- import java.awt.Color;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- import java.awt.event.InputEvent;
- import java.io.IOException;
- import javax.swing.SwingConstants;
- public class AlcherAuto extends JFrame {
- Robot robot = new Robot();
- private JPanel contentPane;
- private JTextField textField;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- AlcherAuto frame = new AlcherAuto();
- frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the frame.
- */
- public AlcherAuto() throws AWTException, IOException, InterruptedException{
- setTitle("Auto Alcher");
- setForeground(Color.WHITE);
- setResizable(false);
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setBounds(100, 100, 195, 91);
- contentPane = new JPanel();
- contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- setContentPane(contentPane);
- contentPane.setLayout(null);
- JLabel lblEnterAmount = new JLabel("Enter Amount:");
- lblEnterAmount.setBounds(10, 11, 86, 14);
- contentPane.add(lblEnterAmount);
- textField = new JTextField();
- textField.setBounds(93, 8, 86, 20);
- contentPane.add(textField);
- textField.setColumns(10);
- JButton btnStartAlching = new JButton("Start Alching");
- btnStartAlching.setForeground(Color.BLACK);
- btnStartAlching.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- try {
- click();
- } catch (AWTException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- } catch (IOException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- }
- });
- btnStartAlching.setBounds(37, 36, 114, 23);
- contentPane.add(btnStartAlching);
- }
- public void click() throws AWTException, IOException, InterruptedException{
- Robot robot = new Robot();
- robot.mouseMove(1042, 425);
- robot.mousePress(InputEvent.BUTTON1_MASK);
- robot.mouseRelease(InputEvent.BUTTON1_MASK);
- loop();
- }
- public int loop() throws AWTException, IOException, InterruptedException{
- robot.mouseMove(943, 477);
- robot.mousePress(InputEvent.BUTTON1_MASK);
- robot.mouseRelease(InputEvent.BUTTON1_MASK);
- return 1000;
- }
- }
Add Comment
Please, Sign In to add comment