author | Jaroslav Tulach <jtulach@netbeans.org> |
Mon, 10 Mar 2014 12:56:48 +0100 | |
branch | ibrwsr |
changeset 101 | 5ef40158eb9c |
permissions | -rw-r--r-- |
jtulach@101 | 1 |
package org.apidesign.demo.minesweeper; |
jtulach@101 | 2 |
|
jtulach@101 | 3 |
import java.net.URL; |
jtulach@101 | 4 |
import java.util.logging.Level; |
jtulach@101 | 5 |
import java.util.logging.Logger; |
jtulach@101 | 6 |
import org.robovm.cocoatouch.coregraphics.CGRect; |
jtulach@101 | 7 |
import org.robovm.cocoatouch.foundation.NSAutoreleasePool; |
jtulach@101 | 8 |
import org.robovm.cocoatouch.foundation.NSDictionary; |
jtulach@101 | 9 |
import org.robovm.cocoatouch.uikit.UIApplication; |
jtulach@101 | 10 |
import org.robovm.cocoatouch.uikit.UIApplicationDelegate; |
jtulach@101 | 11 |
import org.robovm.cocoatouch.uikit.UIColor; |
jtulach@101 | 12 |
import org.robovm.cocoatouch.uikit.UIScreen; |
jtulach@101 | 13 |
import org.robovm.cocoatouch.uikit.UIWebView; |
jtulach@101 | 14 |
import org.robovm.cocoatouch.uikit.UIWindow; |
jtulach@101 | 15 |
|
jtulach@101 | 16 |
public class RoboVMJFXLauncher extends UIApplicationDelegate.Adapter { |
jtulach@101 | 17 |
int clickCount; |
jtulach@101 | 18 |
private UIWindow window; |
jtulach@101 | 19 |
private UIWebView wv; |
jtulach@101 | 20 |
|
jtulach@101 | 21 |
@Override |
jtulach@101 | 22 |
public boolean didFinishLaunching(UIApplication application, NSDictionary launchOptions) { |
jtulach@101 | 23 |
wv = new UIWebView(); |
jtulach@101 | 24 |
wv.setFrame(new CGRect(0.0f, 0.0f, 800.0f, 1080.0f)); |
jtulach@101 | 25 |
|
jtulach@101 | 26 |
window = new UIWindow(UIScreen.getMainScreen().getBounds()); |
jtulach@101 | 27 |
window.setBackgroundColor(UIColor.lightGrayColor()); |
jtulach@101 | 28 |
window.addSubview(wv); |
jtulach@101 | 29 |
window.makeKeyAndVisible(); |
jtulach@101 | 30 |
|
jtulach@101 | 31 |
try { |
jtulach@101 | 32 |
IBrwsrPrsntr p = new IBrwsrPrsntr(wv); |
jtulach@101 | 33 |
URL u = RoboVMJFXLauncher.class.getResource("pages/index.html"); |
jtulach@101 | 34 |
p.displayPage(u, new Runnable() { |
jtulach@101 | 35 |
@Override |
jtulach@101 | 36 |
public void run() { |
jtulach@101 | 37 |
try { |
jtulach@101 | 38 |
Main.onPageLoad(); |
jtulach@101 | 39 |
} catch (Exception ex) { |
jtulach@101 | 40 |
Logger.getLogger(RoboVMJFXLauncher.class.getName()).log(Level.SEVERE, null, ex); |
jtulach@101 | 41 |
} |
jtulach@101 | 42 |
} |
jtulach@101 | 43 |
}); |
jtulach@101 | 44 |
} catch (Throwable t) { |
jtulach@101 | 45 |
t.printStackTrace(); |
jtulach@101 | 46 |
} |
jtulach@101 | 47 |
|
jtulach@101 | 48 |
|
jtulach@101 | 49 |
return true; |
jtulach@101 | 50 |
} |
jtulach@101 | 51 |
|
jtulach@101 | 52 |
public static void main(String[] args) throws Exception { |
jtulach@101 | 53 |
NSAutoreleasePool pool = new NSAutoreleasePool(); |
jtulach@101 | 54 |
UIApplication.main(args, null, RoboVMJFXLauncher.class); |
jtulach@101 | 55 |
pool.drain(); |
jtulach@101 | 56 |
} |
jtulach@101 | 57 |
} |