public void recolorQuery ( ) { String input = parent . getText ( ) ; resetStyles ( ) ; doc . setCharacterAttributes ( 0 , doc . getLength ( ) , plainStyle , true ) ; // Locating all SELECTS input = input . replaceAll ( "[Ss][Ee][Ll][Ee][Cc][Tt]" , "SELECT" ) ; int offset = 0 ; for ( int index = input . indexOf ( "SELECT" , offset ) ; index != - 1 ; index = input . indexOf ( "SELECT" , offset ) ) { doc . setCharacterAttributes ( index , index + 6 , boldStyle , true ) ; offset = index + 6 ; doc . setCharacterAttributes ( offset , offset + 1 , plainStyle , true ) ; } input = input . replaceAll ( "([Ff][Rr][Oo][Mm])" , "FROM" ) ; offset = 0 ; for ( int index = input . indexOf ( "FROM" , offset ) ; index != - 1 ; index = input . indexOf ( "FROM" , offset ) ) { doc . setCharacterAttributes ( index , index + 4 , boldStyle , false ) ; offset = index + 4 ; doc . setCharacterAttributes ( offset , offset + 1 , plainStyle , true ) ; } input = input . replaceAll ( "([Ww][hH][Ee][Rr][Ee])" , "WHERE" ) ; offset = 0 ; for ( int index = input . indexOf ( "WHERE" , offset ) ; index != - 1 ; index = input . indexOf ( "WHERE" , offset ) ) { doc . setCharacterAttributes ( index , index + 5 , boldStyle , false ) ; offset = index + 5 ; doc . setCharacterAttributes ( offset , offset + 1 , plainStyle , true ) ; } parent . revalidate ( ) ; }
Performs coloring of the text pane . This method needs to be rewritten .