fork download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. import javax.swing.SwingUtilities;
  5. import javax.swing.JPanel;
  6. import javax.swing.JMenuItem;
  7. import javax.swing.JFrame;
  8. import javax.swing.JButton;
  9. import java.awt.Rectangle;
  10. import javax.swing.JLabel;
  11.  
  12.  
  13. class Main {
  14.  
  15. private JFrame jFrame = null;
  16. private JPanel jContentPane = null;
  17. private JButton butButton = null;
  18. private JLabel labLabel = null;
  19.  
  20.  
  21.  
  22. private JFrame getJFrame() {
  23. if (jFrame == null) {
  24. jFrame = new JFrame();
  25. jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  26.  
  27. jFrame.setSize(300, 200);
  28. jFrame.setContentPane(getJContentPane());
  29. jFrame.setTitle("Application");
  30. }
  31. return jFrame;
  32. }
  33.  
  34.  
  35. private JPanel getJContentPane() {
  36. if (jContentPane == null) {
  37. labLabel = new JLabel();
  38. labLabel.setBounds(new Rectangle(50, 35, 194, 58));
  39. labLabel.setText("");
  40. jContentPane = new JPanel();
  41. jContentPane.setLayout(null);
  42. jContentPane.add(getButButton(), null);
  43. jContentPane.add(labLabel, null);
  44. }
  45. return jContentPane;
  46. }
  47.  
  48.  
  49.  
  50. // here i start my metod
  51.  
  52. private JButton getButButton() {
  53. if (butButton == null) {
  54. butButton = new JButton();
  55. butButton.setBounds(new Rectangle(58, 110, 177, 46));
  56. butButton.setText("start");
  57. butButton.addActionListener(new java.awt.event.ActionListener() {
  58. public void actionPerformed(java.awt.event.ActionEvent e) {
  59. Gui gui = new Gui();
  60. gui.loop();
  61. }
  62. });
  63. }
  64. return butButton;
  65. }
  66.  
  67. // here is the metod that i cant solve to work!
  68.  
  69. public void loop(){
  70. for (int i=0;i<10;i++)
  71. labLabel.setText("Number: "+i);
  72. }
  73.  
  74.  
  75. public static void main (String[] args) throws java.lang.Exception {
  76. SwingUtilities.invokeLater(new Runnable() {
  77. public void run() {
  78. Main application = new Main();
  79. application.getJFrame().setVisible(true);
  80. }
  81. });
  82. }
  83.  
  84. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:59: error: cannot find symbol
                    Gui gui = new Gui();  
                    ^
  symbol: class Gui
Main.java:59: error: cannot find symbol
                    Gui gui = new Gui();  
                                  ^
  symbol: class Gui
2 errors
stdout
Standard output is empty