• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reading file + Applet

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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......
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.Getting to it.That info was very helpful.Ill update later.Thanks again.....
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic