-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
None
-
linux 1.2
I am using JavaFX 1.2 on Linux. It seems that the init and postinit blocks do not keep their variable assignments.
public class DataInputForm extends CustomNode {
var countries: String[] =["South Africa","Namibia","Botswana","Zimbabwe","Lesotho","Swaziland","Mozambique"];
var provinces: String[]=["Gauteng","Western Cape","Northern Cape","Limpopo","Eastern Cape","Free State","Mpumalanga","KwaZulu-Natal","North West"];
//Sort the sequences alphabetically.
postinit{
sort();
println("{countries}"); //shows sorted list
}
init{
sort();
println("{countries}"); //shows sorted list
}
function sort(){
countries = Sequences.sort(countries,Comparator{
override public function compare(obj1: Object, obj2: Object):Integer{
var string1:String = obj1 as String;
var string2:String = obj2 as String;
return string1.compareTo(string2);
}
}) as String[];
provinces = Sequences.sort(provinces,Comparator{
override public function compare(obj1: Object, obj2: Object):Integer{
var string1:String = obj1 as String;
var string2:String = obj2 as String;
return string1.compareTo(string2);
}
}) as String[];
}
override function create():Node {
println("{counties}"); //unsorted
................
}
}
Thanks
public class DataInputForm extends CustomNode {
var countries: String[] =["South Africa","Namibia","Botswana","Zimbabwe","Lesotho","Swaziland","Mozambique"];
var provinces: String[]=["Gauteng","Western Cape","Northern Cape","Limpopo","Eastern Cape","Free State","Mpumalanga","KwaZulu-Natal","North West"];
//Sort the sequences alphabetically.
postinit{
sort();
println("{countries}"); //shows sorted list
}
init{
sort();
println("{countries}"); //shows sorted list
}
function sort(){
countries = Sequences.sort(countries,Comparator{
override public function compare(obj1: Object, obj2: Object):Integer{
var string1:String = obj1 as String;
var string2:String = obj2 as String;
return string1.compareTo(string2);
}
}) as String[];
provinces = Sequences.sort(provinces,Comparator{
override public function compare(obj1: Object, obj2: Object):Integer{
var string1:String = obj1 as String;
var string2:String = obj2 as String;
return string1.compareTo(string2);
}
}) as String[];
}
override function create():Node {
println("{counties}"); //unsorted
................
}
}
Thanks
- relates to
-
JDK-8107644 CustomNode needs to document that create() is called from postinit block
-
- Closed
-