Guest User

Untitled

a guest
May 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. import java.awt.AWTException;
  2. import java.awt.BorderLayout;
  3. import java.awt.EventQueue;
  4. import java.awt.Robot;
  5.  
  6. import javax.swing.JFrame;
  7. import javax.swing.JPanel;
  8. import javax.swing.border.EmptyBorder;
  9. import javax.swing.JLabel;
  10. import javax.swing.JTextField;
  11. import javax.swing.JButton;
  12. import java.awt.Color;
  13. import java.awt.event.ActionListener;
  14. import java.awt.event.ActionEvent;
  15. import java.awt.event.InputEvent;
  16. import java.io.IOException;
  17. import javax.swing.SwingConstants;
  18.  
  19.  
  20. public class AlcherAuto extends JFrame {
  21.  
  22. Robot robot = new Robot();
  23. private JPanel contentPane;
  24. private JTextField textField;
  25.  
  26. /**
  27. * Launch the application.
  28. */
  29. public static void main(String[] args) {
  30. EventQueue.invokeLater(new Runnable() {
  31. public void run() {
  32. try {
  33. AlcherAuto frame = new AlcherAuto();
  34. frame.setVisible(true);
  35. } catch (Exception e) {
  36. e.printStackTrace();
  37. }
  38. }
  39. });
  40. }
  41.  
  42. /**
  43. * Create the frame.
  44. */
  45. public AlcherAuto() throws AWTException, IOException, InterruptedException{
  46. setTitle("Auto Alcher");
  47. setForeground(Color.WHITE);
  48. setResizable(false);
  49. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  50. setBounds(100, 100, 195, 91);
  51. contentPane = new JPanel();
  52. contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  53. setContentPane(contentPane);
  54. contentPane.setLayout(null);
  55.  
  56. JLabel lblEnterAmount = new JLabel("Enter Amount:");
  57. lblEnterAmount.setBounds(10, 11, 86, 14);
  58. contentPane.add(lblEnterAmount);
  59.  
  60. textField = new JTextField();
  61. textField.setBounds(93, 8, 86, 20);
  62. contentPane.add(textField);
  63. textField.setColumns(10);
  64.  
  65. JButton btnStartAlching = new JButton("Start Alching");
  66. btnStartAlching.setForeground(Color.BLACK);
  67. btnStartAlching.addActionListener(new ActionListener() {
  68. public void actionPerformed(ActionEvent e) {
  69. try {
  70. click();
  71. } catch (AWTException e1) {
  72. // TODO Auto-generated catch block
  73. e1.printStackTrace();
  74. } catch (IOException e1) {
  75. // TODO Auto-generated catch block
  76. e1.printStackTrace();
  77. } catch (InterruptedException e1) {
  78. // TODO Auto-generated catch block
  79. e1.printStackTrace();
  80. }
  81. }
  82. });
  83. btnStartAlching.setBounds(37, 36, 114, 23);
  84. contentPane.add(btnStartAlching);
  85. }
  86. public void click() throws AWTException, IOException, InterruptedException{
  87. Robot robot = new Robot();
  88. robot.mouseMove(1042, 425);
  89. robot.mousePress(InputEvent.BUTTON1_MASK);
  90. robot.mouseRelease(InputEvent.BUTTON1_MASK);
  91. loop();
  92. }
  93. public int loop() throws AWTException, IOException, InterruptedException{
  94. robot.mouseMove(943, 477);
  95. robot.mousePress(InputEvent.BUTTON1_MASK);
  96. robot.mouseRelease(InputEvent.BUTTON1_MASK);
  97. return 1000;
  98.  
  99. }
  100. }
Add Comment
Please, Sign In to add comment