• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading file + Applet

 
Roberto Favaro
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an applet which loads in values as follows

Here is my addCity() method

This is for my final year project.I would like to read values in from a file such as this
NAME : a280
COMMENT : drilling problem (Ludwig)
TYPE : TSP
DIMENSION: 280
EDGE_WEIGHT_TYPE : EUC_2D
NODE_COORD_SECTION
1 288 149
2 288 129
3 270 133
4 256 141
5 256 157
Ignoring the first number in the sequence but using the oher two.Can someone please help.Im desperate and my time is running out.Thanks you could save my life......
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Save your life? By writing a bit of Java code?

What do you have so far? Are you familiar with the java.io package? Look at the File, FileReader and BufferedReader classes in particular. The BufferedReader.readLine method will hand you a line of text from a file.

Also, where is this file - on the client or on the server? If the former, then the applet needs to be signed (see HowCanAnAppletReadFilesOnTheLocalFileSystem); if the latter, then you need also need to look at the getResourceAsStream method and the InputStreamReader class.

So, quite a few things to look into. You better get cracking!
 
Roberto Favaro
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.Getting to it.That info was very helpful.Ill update later.Thanks again.....
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!