Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RevK

macrumors member
Original poster
Apr 26, 2004
65
0
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:

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?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.