Hi,
I cannot find my error in my find & replace feature and was wondering if someone could help me find my error. I'm trying to compare a TextPane's (Named:
textArea) text against an array.
Code:
//Syntax Colouring Begins Here
static String[] javaReserved = {"abstract", "assert", "class", "const", "continue", "default", "enum", "extends", "final", "finally", "goto", "implements", "import", "instanceof", "interface", "native", "new", "package", "private", "protected",
"public", "short", "static", "strictfp", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "try", "void", "volatile"};
void colourJavaReservedWords(){
if (syntaxColouringEnabled==true) {
StyleConstants.setForeground(style,Color.orange);
for(int i=0; i<javaReserved.length; i++){
//if (javaReserved[i].indexOf(i).equals(textArea.getText().indexOf(i))) {
if (javaReserved[i].equals(textArea.getText().indexOf(i))) {
doc.setCharacterAttributes(javaReserved[i],javaReserved.length, textArea.getStyle("orange"),true);
}
}
}
}