madhawaseeeee

answer

Oct 25th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.26 KB | None | 0 0
  1.  
  2. import java.awt.AWTException;
  3. import java.awt.BorderLayout;
  4. import java.awt.ComponentOrientation;
  5. import java.awt.Container;
  6. import java.awt.Dimension;
  7. import java.awt.Font;
  8. import java.awt.GridLayout;
  9. import java.awt.Robot;
  10. import java.awt.event.ActionEvent;
  11. import java.awt.event.ActionListener;
  12. import java.awt.event.InputEvent;
  13. import java.awt.event.KeyEvent;
  14. import java.awt.event.KeyListener;
  15.  
  16. import java.util.Random;
  17. import javax.swing.Timer;
  18.  
  19. import javax.swing.BorderFactory;
  20. import javax.swing.JButton;
  21. import javax.swing.JFrame;
  22. import javax.swing.JLabel;
  23. import javax.swing.JPanel;
  24. import javax.swing.JTextArea;
  25.  
  26. public class robo extends JFrame implements ActionListener
  27. {
  28. private JPanel displayPanel;
  29. JTextArea display = new JTextArea(1,1);
  30. JTextArea display2 = new JTextArea(1,1);
  31. JButton GO;
  32. JButton STOP;
  33. JLabel FeedBack;
  34. int video=0;
  35. int i=0;
  36. Timer t;//global declaration;
  37. Robot robot;
  38.  
  39. robo() throws Exception
  40. {
  41. setSize(250, 180);
  42. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  43. setLocation(100, 75);
  44. setFocusable( true );
  45. //setResizable(false);
  46. setDefaultCloseOperation(EXIT_ON_CLOSE);
  47. setFocusable(true);
  48. requestFocusInWindow();
  49. setTitle("!!!Swaggy Hack!!!");
  50.  
  51. FeedBack = new JLabel(".");
  52.  
  53. displayPanel = new JPanel();
  54.  
  55. display.setEditable(true);
  56. Font font = new Font("Verdana", Font.BOLD, 12);
  57. display.setFont(font);
  58. display.setText("1");
  59. display.setPreferredSize(new Dimension(800,800));
  60. displayPanel.add(display);
  61.  
  62. display2.setEditable(true);
  63. font = new Font("Verdana", Font.BOLD, 12);
  64. display2.setFont(font);
  65. display2.setText("f");
  66. display2.setPreferredSize(new Dimension(100, 100));
  67. displayPanel.add(display2);
  68.  
  69. GO = new JButton("GO!!!");
  70. GO.addActionListener(this);
  71. STOP = new JButton("STOP!!!");
  72. STOP.addActionListener(this);
  73.  
  74.  
  75. video= Integer.parseInt(display.getText());
  76.  
  77.  
  78. JPanel contentPane = new JPanel(new GridLayout(6,5));
  79. contentPane.add(display);
  80. contentPane.add(display2);
  81. contentPane.add(GO);
  82. contentPane.add(STOP);
  83. contentPane.add(FeedBack);
  84. this.setContentPane(contentPane);
  85. setVisible(true);
  86.  
  87.  
  88.  
  89. ////////////////////////////////
  90.  
  91. t = new Timer(1000, new ActionListener()
  92. {
  93. @Override
  94. public void actionPerformed(ActionEvent e)
  95. {
  96. // robot.delay(3000);
  97. // FeedBack.setText(null);
  98. FeedBack.setText("Run"+ i);
  99. i++;
  100. // robot.delay(3000);
  101.  
  102. // FeedBack.setText(null);
  103. // FeedBack.setText("Hello World");
  104.  
  105. }
  106. });
  107.  
  108. }
  109.  
  110. @Override
  111. public void actionPerformed(ActionEvent event)
  112. {
  113. // TODO Auto-generated method stub
  114. JButton src = (JButton) event.getSource(); //get which button is clicked
  115.  
  116. if(src.equals(GO)) //if GO button is clicked
  117. {
  118. System.out.println("hi");
  119. t.start();
  120.  
  121. }
  122. if(src.equals(STOP)) //if STOP button is clicked
  123. {
  124. //do nothing
  125. t.stop();
  126. FeedBack.setText(null);
  127. FeedBack.setText("Stopped");
  128. }
  129. }
  130.  
  131.  
  132.  
  133.  
  134. private void runHack() throws AWTException
  135. {
  136.  
  137. }
  138. public static void main(String[] args) throws Exception {
  139. robo robo = new robo();
  140. }
  141. }
Advertisement
Add Comment
Please, Sign In to add comment