comparison Ristipolku.java @ 197:f3302a2d7815

Convert to a Java application, instead of browser applet, as no browser supports Java applets anymore.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 24 Apr 2019 12:55:54 +0300
parents 64b04c0eccce
children
comparison
equal deleted inserted replaced
196:76322f932276 197:f3302a2d7815
3 * (C) Copyright 2011 Matti 'ccr' Hämäläinen <ccr@tnsp.org> 3 * (C) Copyright 2011 Matti 'ccr' Hämäläinen <ccr@tnsp.org>
4 * 4 *
5 * Ohjelmointiprojekti 2010-2011 Java-kurssille T740306. 5 * Ohjelmointiprojekti 2010-2011 Java-kurssille T740306.
6 */ 6 */
7 import javax.swing.*; 7 import javax.swing.*;
8 import java.awt.event.WindowListener;
9 import java.awt.event.WindowEvent;
8 import game.*; 10 import game.*;
9 11
10 public class Ristipolku extends JApplet 12
13 public class Ristipolku extends JFrame implements WindowListener
11 { 14 {
12 Engine panel; 15 Engine panel;
13 16
14 public void init() 17 public Ristipolku()
15 { 18 {
19 addWindowListener(this);
20
16 panel = new Engine(); 21 panel = new Engine();
17 getContentPane().add(panel); 22
23 setSize(1024, 768);
24 add(panel);
25 setTitle("Ristipolku v"+ G.version);
26 setVisible(true);
18 } 27 }
19 28
20 public void start() 29 public static void main(String[] args)
21 { 30 {
31 G.debug("main()\n");
32 new Ristipolku();
33 G.debug("main() end\n");
34 }
35
36 public void windowClosing(WindowEvent e)
37 {
38 G.debug("windowClosing()\n");
39 panel.stopThreads();
40 dispose();
41 System.exit(0);
42 }
43
44 public void windowOpened(WindowEvent e)
45 {
46 G.debug("windowOpened()\n");
22 panel.startThreads(); 47 panel.startThreads();
23 } 48 }
24 49
25 public void stop() 50 public void windowIconified(WindowEvent e)
26 { 51 {
27 panel.stopThreads(); 52 G.debug("windowIconified()\n");
53 }
54
55 public void windowClosed(WindowEvent e)
56 {
57 G.debug("windowClosed()\n");
58 }
59
60 public void windowDeiconified(WindowEvent e)
61 {
62 G.debug("windowDeiconified()\n");
63 }
64
65 public void windowActivated(WindowEvent e)
66 {
67 G.debug("windowActivated()\n");
68 }
69
70 public void windowDeactivated(WindowEvent e)
71 {
72 G.debug("windowDeactivated()\n");
28 } 73 }
29 } 74 }