fork download
  1. package Happily.Insane.Rain;
  2.  
  3.  
  4. import java.awt.Canvas;
  5. import java.awt.Dimension;
  6.  
  7. import javax.swing.JFrame;
  8.  
  9. public class Game extends Canvas implements Runnable {
  10. private static final long serialVersionUID = 1L;
  11.  
  12. public static int width = 300;
  13. public static height = width / 16 * 9;
  14. public static int scale = 3;
  15.  
  16. private Thread thread;
  17. private JFrame frame;
  18. private boolean running = false;
  19.  
  20. public Game() {
  21. Dimension size = new Dimension (width*scale, height*scale);
  22. setPreferredSize(size);
  23.  
  24. frame = new JFrame();
  25. }
  26.  
  27. public synchronized void start() {
  28. running = true;
  29. thread = new Thread (this, "Display");
  30. thread.start();
  31. }
  32.  
  33. public synchronized void stop() {
  34. running = false;
  35. try {
  36. thread.join();
  37. } catch (InterruptedException e) {
  38. e.printStackTrace();
  39. }
  40. }
  41.  
  42. public void run() {
  43. while (running) {
  44. System.out.println("Running...");
  45. }
  46. }
  47.  
  48. public static void main(String[] args) {
  49.  
  50. Game game = new Game();
  51. game.frame.setResizable(false);
  52. game.frame.setTitle("Rain");
  53. game.frame.add(game);
  54. game.frame.pack();
  55. game.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  56. game.frame.setLocationRelativeTo(null);
  57. game.frame.setVisible(true);
  58.  
  59. game.start();
  60. }
  61.  
  62. }
  63.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:13: error: <identifier> expected
        public static height = width / 16 * 9;
                            ^
1 error
stdout
Standard output is empty