Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.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.JToggleButton;
  10. import java.awt.event.ActionListener;
  11. import java.awt.event.InputEvent;
  12. import java.awt.event.ActionEvent;
  13.  
  14. public class ac extends JFrame {
  15.  
  16. private JPanel contentPane;
  17.  
  18. /**
  19. * Launch the application.
  20. */
  21. public static void main(String[] args) {
  22. EventQueue.invokeLater(new Runnable() {
  23. public void run() {
  24. try {
  25. ac frame = new ac();
  26. frame.setVisible(true);
  27. } catch (Exception e) {
  28. e.printStackTrace();
  29. }
  30. }
  31. });
  32. }
  33.  
  34. /**
  35. * Create the frame.
  36. * @return
  37. */
  38. public void AutoClicker(){
  39. try {
  40. Robot r = new Robot();
  41. r.mousePress(InputEvent.BUTTON1_DOWN_MASK);
  42. r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
  43. Thread.sleep(100);
  44. Thread.interrupted();
  45. } catch (AWTException e) {
  46. e.printStackTrace();
  47. } catch (InterruptedException e) {
  48. e.printStackTrace();
  49. }
  50. }
  51. public ac() {
  52. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  53. setBounds(100, 100, 450, 300);
  54. contentPane = new JPanel();
  55. contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  56. setContentPane(contentPane);
  57. contentPane.setLayout(null);
  58.  
  59. JToggleButton tb = new JToggleButton("\u0432\u043A\u043B\\\u0432\u044B\u043A\u043B");
  60. tb.addActionListener(new ActionListener() {
  61. public void actionPerformed(ActionEvent arg0) {
  62. while(tb.isEnabled())
  63. while(){
  64. new AutoClicker();
  65. }
  66. }
  67. });
  68. tb.setBounds(42, 48, 121, 23);
  69. contentPane.add(tb);
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement