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! :/

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)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.