# HG changeset patch # User Matti Hamalainen # Date 1556099754 -10800 # Node ID f3302a2d7815954b5baf2d0d3c004c7634b62b23 # Parent 76322f932276781f4e9c0565400c584b317e3e35 Convert to a Java application, instead of browser applet, as no browser supports Java applets anymore. diff -r 76322f932276 -r f3302a2d7815 Makefile --- a/Makefile Wed Apr 24 12:37:59 2019 +0300 +++ b/Makefile Wed Apr 24 12:55:54 2019 +0300 @@ -66,8 +66,8 @@ $(COMPILE_OBJ) -run: $(RUN) - $(APPLETVIEWER) $(patsubst %.class,%.html,$<) +run: $(MAINCLASS) + @$(JAVA) $(JAVA_FLAGS) $(patsubst %.class,%,$<) ### diff -r 76322f932276 -r f3302a2d7815 Ristipolku.html --- a/Ristipolku.html Wed Apr 24 12:37:59 2019 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ - - - - Ristipolku - - - -
- -
- - - diff -r 76322f932276 -r f3302a2d7815 Ristipolku.java --- a/Ristipolku.java Wed Apr 24 12:37:59 2019 +0300 +++ b/Ristipolku.java Wed Apr 24 12:55:54 2019 +0300 @@ -5,25 +5,70 @@ * Ohjelmointiprojekti 2010-2011 Java-kurssille T740306. */ import javax.swing.*; +import java.awt.event.WindowListener; +import java.awt.event.WindowEvent; import game.*; -public class Ristipolku extends JApplet + +public class Ristipolku extends JFrame implements WindowListener { Engine panel; - - public void init() + + public Ristipolku() { + addWindowListener(this); + panel = new Engine(); - getContentPane().add(panel); + + setSize(1024, 768); + add(panel); + setTitle("Ristipolku v"+ G.version); + setVisible(true); } - public void start() + public static void main(String[] args) + { + G.debug("main()\n"); + new Ristipolku(); + G.debug("main() end\n"); + } + + public void windowClosing(WindowEvent e) { + G.debug("windowClosing()\n"); + panel.stopThreads(); + dispose(); + System.exit(0); + } + + public void windowOpened(WindowEvent e) + { + G.debug("windowOpened()\n"); panel.startThreads(); } - public void stop() + public void windowIconified(WindowEvent e) + { + G.debug("windowIconified()\n"); + } + + public void windowClosed(WindowEvent e) + { + G.debug("windowClosed()\n"); + } + + public void windowDeiconified(WindowEvent e) { - panel.stopThreads(); + G.debug("windowDeiconified()\n"); + } + + public void windowActivated(WindowEvent e) + { + G.debug("windowActivated()\n"); + } + + public void windowDeactivated(WindowEvent e) + { + G.debug("windowDeactivated()\n"); } }