Java:Reading Error

I got problem in reading the file at the Gui text area hopefully you help me out guys to fix the statement of reading file thank you very much

 public static javax.swing.JTextArea jTextArea1;
{
    BufferedReader br = null;

    try {

        String sCurrentLine;

        br = new BufferedReader(new FileReader("C:\\testing1.txt"));

        while ((sCurrentLine = br.readLine()) != null) {
            jTextArea1.read(br, "C:\\testing1.txt"); \\the problem is here
        }

    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        try {
            if (br != null)br.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
}

Answers


You can use

 JtextArea1.setText(readtext);

but when you use

 jTextArea1.append(readtext);

that will append data at the end of already read text in jTextArea


Try one of the following:

jTextArea1.read(br, null);

or

jTextArea1.append(sCurrentLine);

Have a look at this link: http://www.leepoint.net/notes-java/GUI/components/40textarea/20textarea.html


Need Your Help

Add Google Adsense to an email

adsense

Is this answer in google's support enouh to say that is ok to put ads in email's I send to my customers?

XNA Textured primitives are see-through

c# xna textures

I'm having a problem with primitives on XNA. As you can see in the link, http://imgur.com/12UTd2s, some of the textured walls are see-through and some aren't. Can someone explain why this happens and

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.