knugi

Untitled

Mar 25th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. package pl.knugi;
  2.  
  3. /* */ import java.awt.Container;
  4. /* */ import java.awt.EventQueue;
  5. /* */ import java.awt.event.ActionEvent;
  6. /* */ import java.awt.event.ActionListener;
  7. /* */ import javax.swing.JButton;
  8. /* */ import javax.swing.JFrame;
  9. /* */ import javax.swing.JTextField;
  10. /* */
  11. /* */
  12. /* */
  13. /* */ public class Counter
  14. /* */ {
  15. /* */ private JFrame frame;
  16. /* */ private JTextField licznik;
  17. /* */ private int count = 0;
  18.  
  19. /* */ public static void main(String[] args)
  20. /* */ {
  21. /* 20 */ EventQueue.invokeLater(new Runnable() {
  22. /* */ public void run() {
  23. /* */ try {
  24. /* 23 */ Counter window = new Counter();
  25. /* 24 */ window.frame.setVisible(true);
  26. /* */ } catch (Exception e) {
  27. /* 26 */ e.printStackTrace();
  28. /* */ }
  29. /* */ }
  30. /* */ });
  31. /* */ }
  32. /* */
  33. /* */
  34. /* */
  35. /* */ public Counter()
  36. /* */ {
  37. /* 36 */ initialize();
  38. /* */ }
  39. /* */
  40. /* */
  41. /* */
  42. /* */ private void initialize()
  43. /* */ {
  44. /* 43 */ this.frame = new JFrame();
  45. /* 44 */ this.frame.setBounds(100, 100, 230, 254);
  46. /* 45 */ this.frame.setDefaultCloseOperation(3);
  47. /* 46 */ this.frame.getContentPane().setLayout(null);
  48. /* */
  49. /* 48 */ JButton btnClick = new JButton("Nacisnij mnie");
  50. /* 49 */ btnClick.addActionListener(new ActionListener() {
  51. /* */ public void actionPerformed(ActionEvent e) {
  52. count++;
  53. /* 51 */ Counter.this.licznik.setText(count+"");
  54. /* */ }
  55. /* 53 */ });
  56. /* 54 */ btnClick.setBounds(0, 0, 214, 176);
  57. /* 55 */ this.frame.getContentPane().add(btnClick);
  58. /* */
  59. /* 57 */ this.licznik = new JTextField();
  60. /* 58 */ this.licznik.setEditable(false);
  61. /* 59 */ this.licznik.setBounds(0, 175, 214, 40);
  62. /* 60 */ this.frame.getContentPane().add(this.licznik);
  63. /* 61 */ this.licznik.setColumns(10);
  64. this.licznik.setText("0");
  65. /* */ }
  66. /* */ }
  67.  
  68.  
  69. /* Location: C:\Users\fogel\Desktop\projekt.jar!\Clicker\Counter.class
  70. * Java compiler version: 8 (52.0)
  71. * JD-Core Version: 0.7.1
  72. */
Advertisement
Add Comment
Please, Sign In to add comment