Paste printing in reverse order

Hi i am using this code as the Document Style

public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {

try{

for (int i = 0; i < str.length(); i++) {

// for(int i = str.length() ; i > 0 ; i--){

String s = String.valueOf(str.charAt(i));

if(Main.Mainmenu.seqmode==3) {

StyleConstants.setForeground(style,Color.BLACK);

}

else{

StyleConstants.setForeground(style,getCharacterColor(s));

}

super.insertString(offs, s, style);

}

}

catch(Exception e) { }

}

And also i am using a TextPlane Component When i call the paste inbulit method the method works buts prints in the reverse direction..

Can any one Help me in this regard

[793 byte] By [CodeXa] at [2007-11-27 11:47:50]
# 1

wrong for

must be

for(int i = str.length()-1 ; i >= 0 ; i--)

Regards,

Stas

StanislavLa at 2007-7-29 18:15:32 > top of Java-index,Desktop,Core GUI APIs...
# 2

Ok, you figured out how to use the "bold" tags even though they are not required for your question.

Now if only you could figure out how to use the "code" formatting tags so we could actually read the code you posted.

camickra at 2007-7-29 18:15:32 > top of Java-index,Desktop,Core GUI APIs...