Java is different from JavaScript in that in Java, new Boolean(string) is true only when string.equalsIgnoreCase("true"), but in JavaScript, new Boolean(string) is true for anything other than "" or null.
Solution is to create in the j2s runtime a binding for Boolean.from(string), and then convert all instances of "new Boolean " to "Boolean.from" in Java2ScriptCompiler.outputJavaScript(...)
// the need is to have new Boolean(string), but that won't work with native Boolean
// so instead we have to do a lexical switch from "new Boolean" to "Boolean.from"
Boolean.from=Clazz.defineMethod(Boolean,"from",
($fz=function(name){
return new Boolean(typeof name == "string" ? name.equalsIgnoreCase("true") : !!name);
},$fz.isPrivate=true,$fz),"~S");
Fixed for j2sSwingJS.js 7/2016.
Java is different from JavaScript in that in Java, new Boolean(string) is true only when string.equalsIgnoreCase("true"), but in JavaScript, new Boolean(string) is true for anything other than "" or null.
Solution is to create in the j2s runtime a binding for Boolean.from(string), and then convert all instances of "new Boolean " to "Boolean.from" in Java2ScriptCompiler.outputJavaScript(...)
// the need is to have new Boolean(string), but that won't work with native Boolean
// so instead we have to do a lexical switch from "new Boolean" to "Boolean.from"
Boolean.from=Clazz.defineMethod(Boolean,"from",
($fz=function(name){
return new Boolean(typeof name == "string" ? name.equalsIgnoreCase("true") : !!name);
},$fz.isPrivate=true,$fz),"~S");
Fixed for j2sSwingJS.js 7/2016.