0

Hello. That function worked fine firstly. Then i started to change some code, but nothing essential, just changing some variables to private class fields etc.
I've restarted the OS , but has same output
this is my code now:

doc = (AbstractDocument) jTextPane1.getDocument();
        FileReader theFileIO = null;
        char[] c = new char[1];

        try {
            theFileIO= new FileReader("/home/alexandru/Desktop/index.html");
            
            while(theFileIO.read(c)!=-1){
                System.out.print(""+c[0]); // prints to the console
                doc.insertString(0, new String (c), mas); //prints in the jTextPane1
            }
        } catch (Exception e) {
            System.out.println("Failed to load file index.html");
            System.out.println(e);
        }

Where mas is : private MutableAttributeSet mas = (MutableAttributeSet)new SimpleAttributeSet ();
The console says:

<html>
</html>

Which is the content of the file. But on my JTextPane1 i get:

>lmth/<
>lmth<

I don't get it! :/

Edited by Alex_: n/a

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Alex_
0

OOF! i just remembered that the first argument of the function is the offset. And since it's always 0 it will give the mirror effect. >.< , sorry!
Would someone pls delete the thread before anyone else reads it. :) (I tried, can't)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.