1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/minesweeper/src/main/java/org/apidesign/demo/minesweeper/RoboVMJFXLauncher.java Mon Mar 10 12:56:48 2014 +0100
1.3 @@ -0,0 +1,57 @@
1.4 +package org.apidesign.demo.minesweeper;
1.5 +
1.6 +import java.net.URL;
1.7 +import java.util.logging.Level;
1.8 +import java.util.logging.Logger;
1.9 +import org.robovm.cocoatouch.coregraphics.CGRect;
1.10 +import org.robovm.cocoatouch.foundation.NSAutoreleasePool;
1.11 +import org.robovm.cocoatouch.foundation.NSDictionary;
1.12 +import org.robovm.cocoatouch.uikit.UIApplication;
1.13 +import org.robovm.cocoatouch.uikit.UIApplicationDelegate;
1.14 +import org.robovm.cocoatouch.uikit.UIColor;
1.15 +import org.robovm.cocoatouch.uikit.UIScreen;
1.16 +import org.robovm.cocoatouch.uikit.UIWebView;
1.17 +import org.robovm.cocoatouch.uikit.UIWindow;
1.18 +
1.19 +public class RoboVMJFXLauncher extends UIApplicationDelegate.Adapter {
1.20 + int clickCount;
1.21 + private UIWindow window;
1.22 + private UIWebView wv;
1.23 +
1.24 + @Override
1.25 + public boolean didFinishLaunching(UIApplication application, NSDictionary launchOptions) {
1.26 + wv = new UIWebView();
1.27 + wv.setFrame(new CGRect(0.0f, 0.0f, 800.0f, 1080.0f));
1.28 +
1.29 + window = new UIWindow(UIScreen.getMainScreen().getBounds());
1.30 + window.setBackgroundColor(UIColor.lightGrayColor());
1.31 + window.addSubview(wv);
1.32 + window.makeKeyAndVisible();
1.33 +
1.34 + try {
1.35 + IBrwsrPrsntr p = new IBrwsrPrsntr(wv);
1.36 + URL u = RoboVMJFXLauncher.class.getResource("pages/index.html");
1.37 + p.displayPage(u, new Runnable() {
1.38 + @Override
1.39 + public void run() {
1.40 + try {
1.41 + Main.onPageLoad();
1.42 + } catch (Exception ex) {
1.43 + Logger.getLogger(RoboVMJFXLauncher.class.getName()).log(Level.SEVERE, null, ex);
1.44 + }
1.45 + }
1.46 + });
1.47 + } catch (Throwable t) {
1.48 + t.printStackTrace();
1.49 + }
1.50 +
1.51 +
1.52 + return true;
1.53 + }
1.54 +
1.55 + public static void main(String[] args) throws Exception {
1.56 + NSAutoreleasePool pool = new NSAutoreleasePool();
1.57 + UIApplication.main(args, null, RoboVMJFXLauncher.class);
1.58 + pool.drain();
1.59 + }
1.60 +}