Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

need to display in jtextarea

807605Jul 26 2007 — edited Aug 1 2007
i have the following program but i need to edit it in order to open the text file and display its contents in a jtextarea anyone know how i could do this

import java.io.*;

//this is a cprogram i have created so the users data entered into my main program can be read in a text file

class cdetailreader
{

public static void main (String args[])
{

int input;
try
{

// I have created a filereader to read the contents of the text file i created to hold customer data
// In my main program i named the text file to store customer details cdetails.txt

FileReader readcdetails = new FileReader("cdetails.txt");

input = readcdetails.read();

while (input >=0)
{
System.out.print ((char) input);
input = readcdetails.read();
}
}
catch(Exception e){
System.out.println("File does not exist"+e);
}
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 29 2007
Added on Jul 26 2007
14 comments
308 views