Hi macrumors users:
I have this code that is supposed to read data into an int, then convert to a string and set a JLabel to that string:
For some reason, the currentb label will not change to the stringni string. Any ideas?
I have this code that is supposed to read data into an int, then convert to a string and set a JLabel to that string:
Code:
Scanner ins = null;
try
{
File myFile = new File(PATH + FILE_NAME);
// let's see if we have the right file.
// let's check the path.
System.out.println(myFile.getAbsolutePath());
ins = new Scanner(myFile);
}
catch (FileNotFoundException ex)
{
ex.printStackTrace();
}
int ni = ins.nextInt();
String stringni = Integer.toString(ni);
currentb.setText(stringni);
For some reason, the currentb label will not change to the stringni string. Any ideas?