package b4j.Draw;


import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.debug.*;

public class main extends javafx.application.Application{
public static main mostCurrent = new main();

public static BA ba;
static {
		ba = new  anywheresoftware.b4a.ShellBA("b4j.Draw", "b4j.Draw.main", null);
		ba.loadHtSubs(main.class);
        if (ba.getClass().getName().endsWith("ShellBA")) {
			anywheresoftware.b4a.ShellBA.delegateBA = new anywheresoftware.b4j.objects.FxBA("b4j.Draw", null, null);
			ba.raiseEvent2(null, true, "SHELL", false);
			ba.raiseEvent2(null, true, "CREATE", true, "b4j.Draw.main", ba);
		}
	}
    public static Class<?> getObject() {
		return main.class;
	}

 
    public static void main(String[] args) {
    	launch(args);
    }
    public void start (javafx.stage.Stage stage) {
        try {
            if (!false)
                System.setProperty("prism.lcdtext", "false");
            anywheresoftware.b4j.objects.FxBA.application = this;
		    anywheresoftware.b4a.keywords.Common.setDensity(javafx.stage.Screen.getPrimary().getDpi());
            anywheresoftware.b4a.keywords.Common.LogDebug("Program started.");
            initializeProcessGlobals();
            anywheresoftware.b4j.objects.Form frm = new anywheresoftware.b4j.objects.Form();
            frm.initWithStage(ba, stage, 600, 400);
            ba.raiseEvent(null, "appstart", frm, (String[])getParameters().getRaw().toArray(new String[0]));
        } catch (Throwable t) {
            BA.printException(t, true);
            System.exit(1);
        }
    }


private static boolean processGlobalsRun;
public static void initializeProcessGlobals() {
    
    if (main.processGlobalsRun == false) {
	    main.processGlobalsRun = true;
		try {
		        		
        } catch (Exception e) {
			throw new RuntimeException(e);
		}
    }
}public static anywheresoftware.b4a.keywords.Common __c = null;
public static anywheresoftware.b4j.objects.JFX _fx = null;
public static anywheresoftware.b4j.objects.Form _mainform = null;
public static anywheresoftware.b4a.objects.collections.List _shapes = null;
public static anywheresoftware.b4j.objects.CanvasWrapper _cvsmain = null;
public static String  _appstart(anywheresoftware.b4j.objects.Form _form1,String[] _args) throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(ba, "appstart"))
	return (String) Debug.delegate(ba, "appstart", new Object[] {_form1,_args});
RDebugUtils.currentLine=65536;
 //BA.debugLineNum = 65536;BA.debugLine="Sub AppStart (Form1 As Form, Args() As String)";
RDebugUtils.currentLine=65537;
 //BA.debugLineNum = 65537;BA.debugLine="MainForm = Form1";
_mainform = _form1;
RDebugUtils.currentLine=65538;
 //BA.debugLineNum = 65538;BA.debugLine="MainForm.Show";
_mainform.Show();
RDebugUtils.currentLine=65540;
 //BA.debugLineNum = 65540;BA.debugLine="cvsMain.Initialize(\"\")";
_cvsmain.Initialize(ba,"");
RDebugUtils.currentLine=65541;
 //BA.debugLineNum = 65541;BA.debugLine="Shapes.Initialize";
_shapes.Initialize();
RDebugUtils.currentLine=65542;
 //BA.debugLineNum = 65542;BA.debugLine="End Sub";
return "";
}
public static String  _drawallshapes() throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(ba, "drawallshapes"))
	return (String) Debug.delegate(ba, "drawallshapes", null);
int _i = 0;
RDebugUtils.currentLine=196608;
 //BA.debugLineNum = 196608;BA.debugLine="Private Sub DrawAllShapes";
RDebugUtils.currentLine=196609;
 //BA.debugLineNum = 196609;BA.debugLine="Private i As Int";
_i = 0;
RDebugUtils.currentLine=196611;
 //BA.debugLineNum = 196611;BA.debugLine="For i = 0 To Shapes.Size - 1";
{
final int step2 = 1;
final int limit2 = (int) (_shapes.getSize()-1);
for (_i = (int) (0) ; (step2 > 0 && _i <= limit2) || (step2 < 0 && _i >= limit2); _i = ((int)(0 + _i + step2)) ) {
RDebugUtils.currentLine=196612;
 //BA.debugLineNum = 196612;BA.debugLine="CallSub2(Shapes.Get(i), \"Draw\", cvsMain)";
anywheresoftware.b4a.keywords.Common.CallSubDebug2(ba,_shapes.Get(_i),"Draw",(Object)(_cvsmain));
 }
};
RDebugUtils.currentLine=196614;
 //BA.debugLineNum = 196614;BA.debugLine="End Sub";
return "";
}
public static String  _mainform_resize(double _width,double _height) throws Exception{
RDebugUtils.currentModule="main";
if (Debug.shouldDelegate(ba, "mainform_resize"))
	return (String) Debug.delegate(ba, "mainform_resize", new Object[] {_width,_height});
b4j.Draw.square _square1 = null;
b4j.Draw.square _square2 = null;
b4j.Draw.circle _circle1 = null;
RDebugUtils.currentLine=131072;
 //BA.debugLineNum = 131072;BA.debugLine="Private Sub MainForm_Resize (Width As Double, Heig";
RDebugUtils.currentLine=131073;
 //BA.debugLineNum = 131073;BA.debugLine="MainForm.RootPane.AddNode(cvsMain, 0, 0, Width, H";
_mainform.getRootPane().AddNode((javafx.scene.Node)(_cvsmain.getObject()),0,0,_width,_height);
RDebugUtils.currentLine=131074;
 //BA.debugLineNum = 131074;BA.debugLine="Private Square1, Square2 As Square";
_square1 = new b4j.Draw.square();
_square2 = new b4j.Draw.square();
RDebugUtils.currentLine=131075;
 //BA.debugLineNum = 131075;BA.debugLine="Private Circle1 As Circle";
_circle1 = new b4j.Draw.circle();
RDebugUtils.currentLine=131076;
 //BA.debugLineNum = 131076;BA.debugLine="Shapes.Initialize";
_shapes.Initialize();
RDebugUtils.currentLine=131077;
 //BA.debugLineNum = 131077;BA.debugLine="Square1.Initialize(Shapes, 110, 110, 50)";
_square1._initialize(null,ba,_shapes,(int) (110),(int) (110),(int) (50));
RDebugUtils.currentLine=131078;
 //BA.debugLineNum = 131078;BA.debugLine="Square2.Initialize(Shapes, 10, 10, 100)";
_square2._initialize(null,ba,_shapes,(int) (10),(int) (10),(int) (100));
RDebugUtils.currentLine=131079;
 //BA.debugLineNum = 131079;BA.debugLine="Circle1.Initialize(Shapes, 0.5 * Width, 0.5 * Hei";
_circle1._initialize(null,ba,_shapes,(int) (0.5*_width),(int) (0.5*_height),(int) (100));
RDebugUtils.currentLine=131081;
 //BA.debugLineNum = 131081;BA.debugLine="DrawAllShapes";
_drawallshapes();
RDebugUtils.currentLine=131082;
 //BA.debugLineNum = 131082;BA.debugLine="End Sub";
return "";
}
}