我需要在当前项目中创建16个新路径,并逐个设置每个路径。我想知道是否有办法同时同时创建16个新路径?
// Instantiate 16 Paths
Path outLine1 = new Path();
Path outLine2 = new Path();
Path outLine3 = new Path();
Path outLine4 = new Path();
Path outLine5 = new Path();
Path outLine6 = new Path();
Path outLine7 = new Path();
Path outLine8 = new Path();
Path outLine9 = new Path();
Path outLine10 = new Path();
Path outLine11 = new Path();
Path outLine12 = new Path();
Path outLine13 = new Path();
Path outLine14 = new Path();
Path outLine15 = new Path();
Path outLine16 = new Path();
// Setting up all the path one by one
outLine1.moveTo(0, 0);
outLine1.lineTo(100, 100);
outLine1.lineTo(100, 0);
outLine1.close();
outLine2.moveTo(100, 100);
outLine2.lineTo(200, 200);
outLine2.lineTo(200, 100);
outLine2.close();
我想知道是否有人有办法简化这个?非常感谢。
答案 0 :(得分:-1)
For (i=0;i<=15;i++)
Path outLine[i] = new Path();