fork download
  1.  
  2. import java.awt.Button;
  3. import java.awt.GridLayout;
  4. import java.awt.event.ActionEvent;
  5. import java.awt.event.ActionListener;
  6.  
  7. import javax.swing.AbstractButton;
  8. import javax.swing.JButton;
  9. import javax.swing.JFrame;
  10. import javax.swing.JPanel;
  11.  
  12. public class test {
  13.  
  14. public static void main(String[] args)
  15. {
  16. AbstractButton[] Buttons=new AbstractButton[49];
  17. JFrame frame=new JFrame();
  18. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  19. frame.setSize(500, 500);
  20. frame.setResizable(false);
  21. frame.setLayout(new GridLayout(7,7));
  22. for(int i=0;i<49;i++){
  23. Buttons[i]=new myButton();
  24. frame.add(Buttons[i]);
  25. }
  26. frame.setVisible(true);
  27. }
  28.  
  29. }
  30. class myButton extends JButton{
  31. Boolean boom=false;
  32. myButton(){
  33.  
  34.  
  35. addActionListener(new ActionListener() {
  36. public void actionPerformed(ActionEvent e) {
  37.  
  38. BtnRun_Click();
  39. }
  40.  
  41. private void BtnRun_Click() {
  42. // TODO Auto-generated method stub
  43. setEnabled(false);
  44. }
  45. });
  46. requestFocusInWindow();
  47. }
  48.  
  49.  
  50. }
  51.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:12: error: class test is public, should be declared in a file named test.java
public class test {
       ^
1 error
stdout
Standard output is empty