aspose file tools*
The moose likes Beginning Java and the fly likes Displaying records on screen Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Displaying records on screen" Watch "Displaying records on screen" New topic
Author

Displaying records on screen

Sharon Hour
Greenhorn

Joined: Sep 10, 2004
Posts: 6
Hi,

Not sure if i posting this in correct forum.

I am trying to output all records on a file to a screen but cannot understand what structure screen should have, ie if i want to put each record into particular text fields, i have no way of knowing how many rows of text fields i need.

I am only learning java and doing application as way of learning it. Could someone point me in the right direction.

Hope above makes sense.

Thanks,
Sharon
willem jacobus odendaal
Greenhorn

Joined: Sep 13, 2004
Posts: 12
alo sharon
i am not clear on what exactly you want to do, but i sugest reading the file line by line into a Vector and then you can get the size of the Vector and you'll know how many TextFields you'll need.

This might help:

Vector lines=new Vector();
File jobFile = new File(path);
try {
FileReader fr = new FileReader(jobFile);
BufferedReader br = new BufferedReader(fr);
try {
for(int i=0;i<100;i++){//however many lines will be needed
String line = br.readLine();
if(line!=null){
lines.addElement(line );
}
}
}
catch (IOException ex1) {
}
}
catch (FileNotFoundException ex) {
}

cheers!
Sharon Hour
Greenhorn

Joined: Sep 10, 2004
Posts: 6
Never thought of a Vector - thanks for your help!
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
I am only learning java and doing application as way of learning it. Could someone point me in the right direction.

Here is a list of free on-line Java tutorials and books that I have found useful:
  • Sun's Java Tutorial
  • Introduction to Computer Science using Java by Bradley Kjell
  • Introduction to Programming Using Java by David J. Eck
  • Dick Baldwin's Java Programming Tutorials
  • Interactive Programming In Java by Lynn Andrea Stein
  • Bruce Eckel's Thinking In Java
  • JavaRanch's own Campfire Stories
  • Allen B. Downey's How To Think Like A Computer Scientist


  • [How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: Displaying records on screen