Hi everyone.
I need help again lol, im trying to code a load function, ive got it to read the files and put the values into strings, but i need to convert these to float type and nothing i try seems to work!
The files contain single float numbers, e.g.: 6.0Code://Loads players saved statistics void loadFile() { try { FileReader file = new FileReader("winstat.dat"); BufferedReader buff = new BufferedReader(file); String line = buff.readLine(); trans1 = line; buff.close(); } catch (IOException e) { System.out.println("Error -- " + e.toString()); } try { FileReader file = new FileReader("loosestat.dat"); BufferedReader buff = new BufferedReader(file); String line = buff.readLine(); trans2 = line; buff.close(); } catch (IOException e) { System.out.println("Error -- " + e.toString()); } try { FileReader file = new FileReader("drawstat.dat"); BufferedReader buff = new BufferedReader(file); String line = buff.readLine(); trans3 = line; buff.close(); } catch (IOException e) { System.out.println("Error -- " + e.toString()); } message.setText(trans1); }
Thanks for any help!


Reply With Quote

Bookmarks