package b4j.SecondProgram;

import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.pc.*;

public class main_subs_0 {


public static RemoteObject  _appstart(RemoteObject _form1,RemoteObject _args) throws Exception{
try {
		Debug.PushSubsStack("AppStart (main) ","main",0,main.ba,main.mostCurrent,18);
if (RapidSub.canDelegate("appstart")) return main.remoteMe.runUserSub(false, "main","appstart", _form1, _args);
Debug.locals.put("Form1", _form1);
Debug.locals.put("Args", _args);
 BA.debugLineNum = 18;BA.debugLine="Sub AppStart (Form1 As Form, Args() As String)";
Debug.ShouldStop(131072);
 BA.debugLineNum = 19;BA.debugLine="MainForm = Form1";
Debug.ShouldStop(262144);
main._mainform = _form1;
 BA.debugLineNum = 20;BA.debugLine="MainForm.RootPane.LoadLayout(\"Main\") 'Load the la";
Debug.ShouldStop(524288);
main._mainform.runMethod(false,"getRootPane").runMethodAndSync(false,"LoadLayout",main.ba,(Object)(RemoteObject.createImmutable("Main")));
 BA.debugLineNum = 21;BA.debugLine="MainForm.Title = \"Calc Trainer\"";
Debug.ShouldStop(1048576);
main._mainform.runMethod(true,"setTitle",BA.ObjectToString("Calc Trainer"));
 BA.debugLineNum = 22;BA.debugLine="MainForm.Show";
Debug.ShouldStop(2097152);
main._mainform.runVoidMethodAndSync ("Show");
 BA.debugLineNum = 24;BA.debugLine="New";
Debug.ShouldStop(8388608);
_new();
 BA.debugLineNum = 25;BA.debugLine="End Sub";
Debug.ShouldStop(16777216);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			Debug.ErrorCaught(e);
			throw e;
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _btnaction_mouseclicked(RemoteObject _eventdata) throws Exception{
try {
		Debug.PushSubsStack("btnAction_MouseClicked (main) ","main",0,main.ba,main.mostCurrent,27);
if (RapidSub.canDelegate("btnaction_mouseclicked")) return main.remoteMe.runUserSub(false, "main","btnaction_mouseclicked", _eventdata);
Debug.locals.put("EventData", _eventdata);
 BA.debugLineNum = 27;BA.debugLine="Sub btnAction_MouseClicked (EventData As MouseEven";
Debug.ShouldStop(67108864);
 BA.debugLineNum = 28;BA.debugLine="If btnAction.Text = \"O K\" Then";
Debug.ShouldStop(134217728);
if (RemoteObject.solveBoolean("=",main._btnaction.runMethod(true,"getText"),BA.ObjectToString("O K"))) { 
 BA.debugLineNum = 29;BA.debugLine="If lblResult.Text=\"\" Then";
Debug.ShouldStop(268435456);
if (RemoteObject.solveBoolean("=",main._lblresult.runMethod(true,"getText"),BA.ObjectToString(""))) { 
 BA.debugLineNum = 30;BA.debugLine="fx.Msgbox(Null, \"No result entered\", \"E R R O R";
Debug.ShouldStop(536870912);
main._fx.runVoidMethodAndSync ("Msgbox",(Object)((main.__c.getField(false,"Null"))),(Object)(BA.ObjectToString("No result entered")),(Object)(RemoteObject.createImmutable("E R R O R")));
 }else {
 BA.debugLineNum = 33;BA.debugLine="CheckResult";
Debug.ShouldStop(1);
_checkresult();
 };
 }else {
 BA.debugLineNum = 36;BA.debugLine="New";
Debug.ShouldStop(8);
_new();
 BA.debugLineNum = 37;BA.debugLine="btnAction.Text = \"O K\"";
Debug.ShouldStop(16);
main._btnaction.runMethod(true,"setText",BA.ObjectToString("O K"));
 BA.debugLineNum = 38;BA.debugLine="lblResult.Text = \"\"";
Debug.ShouldStop(32);
main._lblresult.runMethod(true,"setText",BA.ObjectToString(""));
 };
 BA.debugLineNum = 40;BA.debugLine="End Sub";
Debug.ShouldStop(128);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			Debug.ErrorCaught(e);
			throw e;
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _btnevent_mouseclicked(RemoteObject _eventdata) throws Exception{
try {
		Debug.PushSubsStack("btnEvent_MouseClicked (main) ","main",0,main.ba,main.mostCurrent,66);
if (RapidSub.canDelegate("btnevent_mouseclicked")) return main.remoteMe.runUserSub(false, "main","btnevent_mouseclicked", _eventdata);
RemoteObject _btnsender = RemoteObject.declareNull("anywheresoftware.b4j.objects.ButtonWrapper");
Debug.locals.put("EventData", _eventdata);
 BA.debugLineNum = 66;BA.debugLine="Private Sub btnEvent_MouseClicked (EventData As Mo";
Debug.ShouldStop(2);
 BA.debugLineNum = 67;BA.debugLine="Private btnSender As Button";
Debug.ShouldStop(4);
_btnsender = RemoteObject.createNew ("anywheresoftware.b4j.objects.ButtonWrapper");Debug.locals.put("btnSender", _btnsender);
 BA.debugLineNum = 69;BA.debugLine="btnSender = Sender";
Debug.ShouldStop(16);
_btnsender.setObject(main.__c.runMethod(false,"Sender",main.ba));
 BA.debugLineNum = 71;BA.debugLine="Select btnSender.Tag";
Debug.ShouldStop(64);
switch (BA.switchObjectToInt(_btnsender.runMethod(false,"getTag"),RemoteObject.createImmutable(("BS")))) {
case 0: {
 BA.debugLineNum = 73;BA.debugLine="If lblResult.Text.Length > 0 Then";
Debug.ShouldStop(256);
if (RemoteObject.solveBoolean(">",main._lblresult.runMethod(true,"getText").runMethod(true,"length"),BA.numberCast(double.class, 0))) { 
 BA.debugLineNum = 74;BA.debugLine="lblResult.Text = lblResult.Text.SubString2(0, l";
Debug.ShouldStop(512);
main._lblresult.runMethod(true,"setText",main._lblresult.runMethod(true,"getText").runMethod(true,"substring",(Object)(BA.numberCast(int.class, 0)),(Object)(RemoteObject.solve(new RemoteObject[] {main._lblresult.runMethod(true,"getText").runMethod(true,"length"),RemoteObject.createImmutable(1)}, "-",1, 1))));
 };
 break; }
default: {
 BA.debugLineNum = 77;BA.debugLine="lblResult.Text = lblResult.Text & btnSender.Text";
Debug.ShouldStop(4096);
main._lblresult.runMethod(true,"setText",RemoteObject.concat(main._lblresult.runMethod(true,"getText"),_btnsender.runMethod(true,"getText")));
 break; }
}
;
 BA.debugLineNum = 80;BA.debugLine="If lblResult.Text.Length = 0 Then";
Debug.ShouldStop(32768);
if (RemoteObject.solveBoolean("=",main._lblresult.runMethod(true,"getText").runMethod(true,"length"),BA.numberCast(double.class, 0))) { 
 BA.debugLineNum = 81;BA.debugLine="btn0.Visible = False";
Debug.ShouldStop(65536);
main._btn0.runMethod(true,"setVisible",main.__c.getField(true,"False"));
 }else {
 BA.debugLineNum = 83;BA.debugLine="btn0.Visible = True";
Debug.ShouldStop(262144);
main._btn0.runMethod(true,"setVisible",main.__c.getField(true,"True"));
 };
 BA.debugLineNum = 85;BA.debugLine="End Sub";
Debug.ShouldStop(1048576);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			Debug.ErrorCaught(e);
			throw e;
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _checkresult() throws Exception{
try {
		Debug.PushSubsStack("CheckResult (main) ","main",0,main.ba,main.mostCurrent,55);
if (RapidSub.canDelegate("checkresult")) return main.remoteMe.runUserSub(false, "main","checkresult");
 BA.debugLineNum = 55;BA.debugLine="Private Sub CheckResult";
Debug.ShouldStop(4194304);
 BA.debugLineNum = 56;BA.debugLine="If lblResult.Text = Number1 + Number2 Then";
Debug.ShouldStop(8388608);
if (RemoteObject.solveBoolean("=",main._lblresult.runMethod(true,"getText"),BA.NumberToString(RemoteObject.solve(new RemoteObject[] {main._number1,main._number2}, "+",1, 1)))) { 
 BA.debugLineNum = 57;BA.debugLine="CSSUtils.SetBackgroundColor(lblComments, fx.Colo";
Debug.ShouldStop(16777216);
main._cssutils.runVoidMethod ("_setbackgroundcolor",RemoteObject.declareNull("anywheresoftware.b4a.AbsObjectWrapper").runMethod(false, "ConvertToWrapper", RemoteObject.createNew("anywheresoftware.b4j.objects.NodeWrapper.ConcreteNodeWrapper"), main._lblcomments.getObject()),RemoteObject.declareNull("anywheresoftware.b4a.AbsObjectWrapper").runMethod(false, "ConvertToWrapper", RemoteObject.createNew("anywheresoftware.b4j.objects.JFX.PaintWrapper"), main._fx.getField(false,"Colors").runMethod(false,"RGB",(Object)(BA.numberCast(int.class, 128)),(Object)(BA.numberCast(int.class, 255)),(Object)(BA.numberCast(int.class, 128)))));
 BA.debugLineNum = 58;BA.debugLine="lblComments.Text = \"G O O D  result\" & CRLF & \"C";
Debug.ShouldStop(33554432);
main._lblcomments.runMethod(true,"setText",RemoteObject.concat(RemoteObject.createImmutable("G O O D  result"),main.__c.getField(true,"CRLF"),RemoteObject.createImmutable("Click on NEW")));
 BA.debugLineNum = 59;BA.debugLine="btnAction.Text = \"N E W\"";
Debug.ShouldStop(67108864);
main._btnaction.runMethod(true,"setText",BA.ObjectToString("N E W"));
 }else {
 BA.debugLineNum = 61;BA.debugLine="CSSUtils.SetBackgroundColor(lblComments, fx.Colo";
Debug.ShouldStop(268435456);
main._cssutils.runVoidMethod ("_setbackgroundcolor",RemoteObject.declareNull("anywheresoftware.b4a.AbsObjectWrapper").runMethod(false, "ConvertToWrapper", RemoteObject.createNew("anywheresoftware.b4j.objects.NodeWrapper.ConcreteNodeWrapper"), main._lblcomments.getObject()),RemoteObject.declareNull("anywheresoftware.b4a.AbsObjectWrapper").runMethod(false, "ConvertToWrapper", RemoteObject.createNew("anywheresoftware.b4j.objects.JFX.PaintWrapper"), main._fx.getField(false,"Colors").runMethod(false,"RGB",(Object)(BA.numberCast(int.class, 255)),(Object)(BA.numberCast(int.class, 128)),(Object)(BA.numberCast(int.class, 128)))));
 BA.debugLineNum = 62;BA.debugLine="lblComments.Text = \"W R O N G  result\" & CRLF &";
Debug.ShouldStop(536870912);
main._lblcomments.runMethod(true,"setText",RemoteObject.concat(RemoteObject.createImmutable("W R O N G  result"),main.__c.getField(true,"CRLF"),RemoteObject.createImmutable("Enter a new result"),main.__c.getField(true,"CRLF"),RemoteObject.createImmutable("and click OK")));
 };
 BA.debugLineNum = 64;BA.debugLine="End Sub";
Debug.ShouldStop(-2147483648);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			Debug.ErrorCaught(e);
			throw e;
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _new() throws Exception{
try {
		Debug.PushSubsStack("New (main) ","main",0,main.ba,main.mostCurrent,42);
if (RapidSub.canDelegate("new")) return main.remoteMe.runUserSub(false, "main","new");
 BA.debugLineNum = 42;BA.debugLine="Private Sub New";
Debug.ShouldStop(512);
 BA.debugLineNum = 43;BA.debugLine="Number1 = Rnd(1, 10)			' Generates a random numbe";
Debug.ShouldStop(1024);
main._number1 = main.__c.runMethod(true,"Rnd",(Object)(BA.numberCast(int.class, 1)),(Object)(BA.numberCast(int.class, 10)));
 BA.debugLineNum = 44;BA.debugLine="Log(Number1)";
Debug.ShouldStop(2048);
main.__c.runVoidMethod ("Log",(Object)(BA.NumberToString(main._number1)));
 BA.debugLineNum = 45;BA.debugLine="Number2 = Rnd(1, 10)			' Generates a random numbe";
Debug.ShouldStop(4096);
main._number2 = main.__c.runMethod(true,"Rnd",(Object)(BA.numberCast(int.class, 1)),(Object)(BA.numberCast(int.class, 10)));
 BA.debugLineNum = 46;BA.debugLine="Log(Number2)";
Debug.ShouldStop(8192);
main.__c.runVoidMethod ("Log",(Object)(BA.NumberToString(main._number2)));
 BA.debugLineNum = 47;BA.debugLine="lblNumber1.Text = Number1		' Displays Number1 in";
Debug.ShouldStop(16384);
main._lblnumber1.runMethod(true,"setText",BA.NumberToString(main._number1));
 BA.debugLineNum = 48;BA.debugLine="lblNumber2.Text = Number2		' Displays Number2 in";
Debug.ShouldStop(32768);
main._lblnumber2.runMethod(true,"setText",BA.NumberToString(main._number2));
 BA.debugLineNum = 49;BA.debugLine="lblComments.Text = \"Enter the result\" & CRLF & \"a";
Debug.ShouldStop(65536);
main._lblcomments.runMethod(true,"setText",RemoteObject.concat(RemoteObject.createImmutable("Enter the result"),main.__c.getField(true,"CRLF"),RemoteObject.createImmutable("and click on OK")));
 BA.debugLineNum = 50;BA.debugLine="CSSUtils.SetBackgroundColor(lblComments, fx.Color";
Debug.ShouldStop(131072);
main._cssutils.runVoidMethod ("_setbackgroundcolor",RemoteObject.declareNull("anywheresoftware.b4a.AbsObjectWrapper").runMethod(false, "ConvertToWrapper", RemoteObject.createNew("anywheresoftware.b4j.objects.NodeWrapper.ConcreteNodeWrapper"), main._lblcomments.getObject()),RemoteObject.declareNull("anywheresoftware.b4a.AbsObjectWrapper").runMethod(false, "ConvertToWrapper", RemoteObject.createNew("anywheresoftware.b4j.objects.JFX.PaintWrapper"), main._fx.getField(false,"Colors").runMethod(false,"RGB",(Object)(BA.numberCast(int.class, 255)),(Object)(BA.numberCast(int.class, 235)),(Object)(BA.numberCast(int.class, 128)))));
 BA.debugLineNum = 51;BA.debugLine="lblResult.Text = \"\"			' Sets edtResult.Text to em";
Debug.ShouldStop(262144);
main._lblresult.runMethod(true,"setText",BA.ObjectToString(""));
 BA.debugLineNum = 52;BA.debugLine="btn0.Visible = False";
Debug.ShouldStop(524288);
main._btn0.runMethod(true,"setVisible",main.__c.getField(true,"False"));
 BA.debugLineNum = 53;BA.debugLine="End Sub";
Debug.ShouldStop(1048576);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			Debug.ErrorCaught(e);
			throw e;
		} 
finally {
			Debug.PopSubsStack();
		}}

private static boolean processGlobalsRun;
public static void initializeProcessGlobals() {
    
    if (main.processGlobalsRun == false) {
	    main.processGlobalsRun = true;
		try {
		        main_subs_0._process_globals();
main.myClass = BA.getDeviceClass ("b4j.SecondProgram.main");
		
        } catch (Exception e) {
			throw new RuntimeException(e);
		}
    }
}public static RemoteObject  _process_globals() throws Exception{
 //BA.debugLineNum = 6;BA.debugLine="Sub Process_Globals";
 //BA.debugLineNum = 7;BA.debugLine="Private fx As JFX";
main._fx = RemoteObject.createNew ("anywheresoftware.b4j.objects.JFX");
 //BA.debugLineNum = 8;BA.debugLine="Private MainForm As Form";
main._mainform = RemoteObject.createNew ("anywheresoftware.b4j.objects.Form");
 //BA.debugLineNum = 9;BA.debugLine="Private btnAction, btn0 As Button";
main._btnaction = RemoteObject.createNew ("anywheresoftware.b4j.objects.ButtonWrapper");
main._btn0 = RemoteObject.createNew ("anywheresoftware.b4j.objects.ButtonWrapper");
 //BA.debugLineNum = 10;BA.debugLine="Private lblComments As Label";
main._lblcomments = RemoteObject.createNew ("anywheresoftware.b4j.objects.LabelWrapper");
 //BA.debugLineNum = 11;BA.debugLine="Private lblMathSign As Label";
main._lblmathsign = RemoteObject.createNew ("anywheresoftware.b4j.objects.LabelWrapper");
 //BA.debugLineNum = 12;BA.debugLine="Private lblNumber1 As Label";
main._lblnumber1 = RemoteObject.createNew ("anywheresoftware.b4j.objects.LabelWrapper");
 //BA.debugLineNum = 13;BA.debugLine="Private lblNumber2 As Label";
main._lblnumber2 = RemoteObject.createNew ("anywheresoftware.b4j.objects.LabelWrapper");
 //BA.debugLineNum = 14;BA.debugLine="Private lblResult As Label";
main._lblresult = RemoteObject.createNew ("anywheresoftware.b4j.objects.LabelWrapper");
 //BA.debugLineNum = 15;BA.debugLine="Private Number1, Number2 As Int";
main._number1 = RemoteObject.createImmutable(0);
main._number2 = RemoteObject.createImmutable(0);
 //BA.debugLineNum = 16;BA.debugLine="End Sub";
return RemoteObject.createImmutable("");
}
}