private Style getStyleAtPos(int pos) {
        for (int i=0;  i<chunks.size();  i++) {
            SqlChunk chunk = (SqlChunk)chunks.get(i);
            if (pos >= chunk.startPos  &&  pos < chunk.startPos+chunk.length) {
                Style style = null;

                if (chunk.type == TextType.CHARACTER) {
                    style = getStyle("Red");
                } else if (chunk.type == TextType.COMMENT) {
                    style = getStyle("Green");
                } else if (chunk.type == TextType.FUNCTION) {
                    style = getStyle("BlueBold");
                } else if (chunk.type == TextType.KEYWORD) {
                    style = getStyle("Blue");
                } else if (chunk.type == TextType.NUMERIC) {
                    style = getStyle("Magenta");
                }
                return style;
            }
        }
        return null;
    }