public int getColorNumber ( RtfColor color ) { int colorIndex = - 1 ; for ( int i = 0 ; i < colorList . size ( ) ; i ++ ) { if ( colorList . get ( i ) . equals ( color ) ) { colorIndex = i ; } } if ( colorIndex == - 1 ) { colorIndex = colorList . size ( ) ; colorList . add ( color ) ; } return colorIndex ; }
Returns the index of the given RtfColor in the color list . If the RtfColor is not in the list of colors then it is added .