-1
我试图扫描带有字符(p
,t
,a
,...)的文本文件,以便每个字母都能匹配某个图像。但首先,我必须阅读这封信,然后用图像进行连接。扫描仪文本文件不能正常工作
Scanner sc = new Scanner(textfile);
int lenght = 0;
while (sc.hasNextLine()) {
try {
for (int j = 0; j != 0; j++) {
ImageMatrixGUI.getInstance().addImage(Land);
ArrayImages.add(Land);
}
char tipo = sc.next().charAt(0);
System.out.println(tipo);
if (tipo == 'p') {
ImageMatrixGUI.getInstance().addImage(pine);
}
}
}
你的意思是不工作?你会得到什么输出? – user1506104
循环应该做什么? – Stormcloud
我无法读取文本文件中的字符 –