当前位置: 首页>>代码示例>>Java>>正文


Java StyleSpans类代码示例

本文整理汇总了Java中org.fxmisc.richtext.StyleSpans的典型用法代码示例。如果您正苦于以下问题:Java StyleSpans类的具体用法?Java StyleSpans怎么用?Java StyleSpans使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StyleSpans类属于org.fxmisc.richtext包,在下文中一共展示了StyleSpans类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: computeHighlighting

import org.fxmisc.richtext.StyleSpans; //导入依赖的package包/类
public static StyleSpans<Collection<String>> computeHighlighting(final String text) {
    final Matcher matcher = UPPAAL.matcher(text);
    int lastKwEnd = 0;
    final StyleSpansBuilder<Collection<String>> spansBuilder = new StyleSpansBuilder<>();
    while (matcher.find()) {

        spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);

        if (matcher.group(1) != null) {
            spansBuilder.add(Collections.singleton("uppaal-keyword"), matcher.end(1) - matcher.start(1));
        } else if (matcher.group(2) != null) {
            spansBuilder.add(Collections.singleton("c-keyword"), matcher.end(2) - matcher.start(2));
        } else if (matcher.group(3) != null) {
            spansBuilder.add(Collections.singleton("comment"), matcher.end(3) - matcher.start(3));
        }

        lastKwEnd = matcher.end();
    }

    spansBuilder.add(Collections.emptyList(), text.length() - lastKwEnd);
    return spansBuilder.create();
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:23,代码来源:ComponentPresentation.java

示例2: computeHighlighting

import org.fxmisc.richtext.StyleSpans; //导入依赖的package包/类
private StyleSpans<Collection<String>> computeHighlighting(String text) {
	Matcher matcher = PATTERN.matcher(text);
	int lastKwEnd = 0;
	StyleSpansBuilder<Collection<String>> spansBuilder = new StyleSpansBuilder<>();
	while (matcher.find()) {
		String styleClass = matcher.group("KEYWORD") != null ? "keyword"
				: matcher.group("PAREN") != null ? "paren"
						: matcher.group("BRACE") != null ? "brace"
								: matcher.group("BRACKET") != null ? "bracket"
										: matcher.group("SEMICOLON") != null ? "semicolon"
												: matcher.group("STRING") != null ? "string"
														: matcher.group("COMMENT") != null ? "comment" : null;
		/* never happens */ assert styleClass != null;
		spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);
		spansBuilder.add(Collections.singleton(styleClass), matcher.end() - matcher.start());
		lastKwEnd = matcher.end();
	}
	spansBuilder.add(Collections.emptyList(), text.length() - lastKwEnd);
	return spansBuilder.create();
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-null,代码行数:21,代码来源:JavaCodeArea.java

示例3: computeHighlighting

import org.fxmisc.richtext.StyleSpans; //导入依赖的package包/类
private static StyleSpans<Collection<String>> computeHighlighting(String text) {
	Matcher matcher = PATTERN.matcher(text);
	int lastKwEnd = 0;
	StyleSpansBuilder<Collection<String>> spansBuilder = new StyleSpansBuilder<>();
	while (matcher.find()) {
		String styleClass = matcher.group("KEYWORD") != null ? "keyword"
				: matcher.group("PAREN") != null ? "paren"
						: matcher.group("BRACE") != null ? "brace"
								: matcher.group("BRACKET") != null ? "bracket"
										: matcher.group("SEMICOLON") != null ? "semicolon"
												: matcher.group("STRING") != null ? "string"
														: matcher.group("COMMENT") != null ? "comment" : null;
		/* never happens */ assert styleClass != null;
		spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);
		spansBuilder.add(Collections.singleton(styleClass), matcher.end() - matcher.start());
		lastKwEnd = matcher.end();
	}
	spansBuilder.add(Collections.emptyList(), text.length() - lastKwEnd);
	return spansBuilder.create();
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:21,代码来源:JavaTextArea.java

示例4: computeHighlighting

import org.fxmisc.richtext.StyleSpans; //导入依赖的package包/类
private static StyleSpans<Collection<String>> computeHighlighting(String text) {
	Matcher matcher = PATTERN.matcher(text);
	int lastKwEnd = 0;
	StyleSpansBuilder<Collection<String>> spansBuilder = new StyleSpansBuilder<>();
	while (matcher.find()) {
		String styleClass = matcher.group("METHODPAREN") != null ? "method-paren"
				: matcher.group("BRACE") != null ? "brace"
						: matcher.group("BRACKET") != null ? "bracket"
								: matcher.group("SEMICOLON") != null ? "semicolon"
										: matcher.group("STRING") != null ? "string"
												: matcher.group("COMMENT") != null ? "comment" : null;
		/* never happens */ assert styleClass != null;
		spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);
		spansBuilder.add(Collections.singleton(styleClass), matcher.end() - matcher.start());
		lastKwEnd = matcher.end();
	}
	spansBuilder.add(Collections.emptyList(), text.length() - lastKwEnd);
	return spansBuilder.create();
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:20,代码来源:ThreadDumpTextArea.java

示例5: computeHighlighting

import org.fxmisc.richtext.StyleSpans; //导入依赖的package包/类
private static StyleSpans<Collection<String>> computeHighlighting(String text) {
	Matcher matcher = PATTERN.matcher(text);
	int lastKwEnd = 0;
	StyleSpansBuilder<Collection<String>> spansBuilder = new StyleSpansBuilder<>();
	while (matcher.find()) {
		String styleClass = matcher.group("KEYWORD") != null ? "keyword"
				: matcher.group("PAREN") != null ? "paren"
						: matcher.group("BRACE") != null ? "brace"
								: matcher.group("BRACKET") != null ? "bracket"
										: matcher.group("SEMICOLON") != null ? "semicolon"
												: matcher.group("STRING") != null ? "string"
														: matcher.group("COMMENT") != null ? "comment" : null; /*
																												 * never
																												 * happens
																												 */
		assert styleClass != null;
		spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);
		spansBuilder.add(Collections.singleton(styleClass), matcher.end() - matcher.start());
		lastKwEnd = matcher.end();
	}
	spansBuilder.add(Collections.emptyList(), text.length() - lastKwEnd);
	return spansBuilder.create();
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:24,代码来源:FXMLTextArea.java

示例6: groupBackgroundColor

import org.fxmisc.richtext.StyleSpans; //导入依赖的package包/类
private static StyleSpans<Collection<String>> groupBackgroundColor(String text, int point) {

		StyleSpansBuilder<Collection<String>> spansBuilder = new StyleSpansBuilder<>();

		Pattern pattern = Pattern.compile("\\([^)]+\\)");
		Matcher matcher = pattern.matcher(text);
		int lastKwEnd = 0;

		while (matcher.find()) {
			String styleClass = "unGroup";
			if (matcher.start() < point && matcher.end() > point) {
				styleClass = "inGroup";
			}
			spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);
			spansBuilder.add(Collections.singleton(styleClass), matcher.end() - matcher.start());
			lastKwEnd = matcher.end();
		}

		spansBuilder.add(Collections.emptyList(), text.length() - lastKwEnd);
		return spansBuilder.create();
	}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:22,代码来源:SqlKeywords.java

示例7: computeHighlighting

import org.fxmisc.richtext.StyleSpans; //导入依赖的package包/类
private static StyleSpans<Collection<String>> computeHighlighting(String text) {
    Matcher matcher = PATTERN.matcher(text);
    int lastKwEnd = 0;
    StyleSpansBuilder<Collection<String>> spansBuilder
            = new StyleSpansBuilder<>();
    while(matcher.find()) {
        String styleClass =
                matcher.group("KEYWORD") != null ? "keyword" :
                        matcher.group("PAREN") != null ? "paren" :
                                matcher.group("BRACE") != null ? "brace" :
                                        matcher.group("BRACKET") != null ? "bracket" :
                                                matcher.group("SEMICOLON") != null ? "semicolon" :
                                                        matcher.group("STRING") != null ? "string" :
                                                                matcher.group("COMMENT") != null ? "comment" :
                                                                        null; /* never happens */ assert styleClass != null;
        spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);
        spansBuilder.add(Collections.singleton(styleClass), matcher.end() - matcher.start());
        lastKwEnd = matcher.end();
    }
    spansBuilder.add(Collections.emptyList(), text.length() - lastKwEnd);
    return spansBuilder.create();
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-amigos,代码行数:23,代码来源:TDDCodeArea.java

示例8: computeHighlighting

import org.fxmisc.richtext.StyleSpans; //导入依赖的package包/类
private static StyleSpans<Collection<String>> computeHighlighting(String text) {
	Matcher matcher = PATTERN.matcher(text);
	int lastKwEnd = 0;
	StyleSpansBuilder<Collection<String>> spansBuilder = new StyleSpansBuilder<>();
	while (matcher.find()) {
		String styleClass = matcher.group("KEYWORD") != null ? "keyword"
				: matcher.group("PAREN") != null ? "paren"
						: matcher.group("BRACE") != null ? "brace"
								: matcher.group("BRACKET") != null ? "bracket"
										: matcher.group("SEMICOLON") != null ? "semicolon"
												: matcher.group("STRING") != null ? "string"
														: matcher.group("ANNOTATION") != null ? "annotation"
																: matcher.group("COMMENT") != null ? "comment"
																		: null;
		/* never happens */ assert styleClass != null;
		spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);
		spansBuilder.add(Collections.singleton(styleClass), matcher.end() - matcher.start());
		lastKwEnd = matcher.end();
	}
	spansBuilder.add(Collections.emptyList(), text.length() - lastKwEnd);
	return spansBuilder.create();
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-2,代码行数:23,代码来源:JavaCodeArea.java

示例9: computeHighlighting

import org.fxmisc.richtext.StyleSpans; //导入依赖的package包/类
private static StyleSpans<Collection<String>> computeHighlighting(final String text) {
    Matcher matcher = PATTERN.matcher(text);
    int lastKwEnd = 0;
    StyleSpansBuilder<Collection<String>> spansBuilder = new StyleSpansBuilder<>();
    while (matcher.find()) {
        String styleClass =
                matcher.group("KEYWORD") != null ? "keyword" :
                matcher.group("METHOD") != null ? "method" :
                matcher.group("PAREN") != null ? "paren" :
                matcher.group("BRACE") != null ? "brace" :
                matcher.group("BRACKET") != null ? "bracket" :
                matcher.group("SEMICOLON") != null ? "semicolon" :
                matcher.group("TRIPLEQUOTES") != null ? "string" :
                matcher.group("DOUBLEQUOTES") != null ? "string" :
                matcher.group("SINGLEQUOTES") != null ? "string" :
                matcher.group("COMMENT") != null ? "comment" :
                null; /* never happens */
        assert styleClass != null;
        spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);
        spansBuilder.add(Collections.singleton(styleClass), matcher.end() - matcher.start());
        lastKwEnd = matcher.end();
    }
    spansBuilder.add(Collections.emptyList(), text.length() - lastKwEnd);
    return spansBuilder.create();
}
 
开发者ID:qupath,项目名称:qupath,代码行数:26,代码来源:RichScriptEditor.java

示例10: computeConsoleHighlighting

import org.fxmisc.richtext.StyleSpans; //导入依赖的package包/类
private static StyleSpans<Collection<String>> computeConsoleHighlighting(final String text) {
    Matcher matcher = PATTERN_CONSOLE.matcher(text);
    int lastKwEnd = 0;
    StyleSpansBuilder<Collection<String>> spansBuilder = new StyleSpansBuilder<>();
    while (matcher.find()) {
        String styleClass =
                matcher.group("ERROR") != null ? "error" :
                matcher.group("WARN") != null ? "warning" :
                null; /* never happens */
        assert styleClass != null;
        spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);
        spansBuilder.add(Collections.singleton(styleClass), matcher.end() - matcher.start());
        lastKwEnd = matcher.end();
    }
    spansBuilder.add(Collections.emptyList(), text.length() - lastKwEnd);
    return spansBuilder.create();
}
 
开发者ID:qupath,项目名称:qupath,代码行数:18,代码来源:RichScriptEditor.java

示例11: computeHighlighting

import org.fxmisc.richtext.StyleSpans; //导入依赖的package包/类
private static StyleSpans<Collection<String>> computeHighlighting(String text) {
    Matcher matcher = PATTERN.matcher(text);
    int lastKwEnd = 0;
    StyleSpansBuilder<Collection<String>> spansBuilder
            = new StyleSpansBuilder<>();
    while (matcher.find()) {
        String styleClass =
                matcher.group("KEYWORD") != null ? "keyword" :
                        matcher.group("PAREN") != null ? "paren" :
                                matcher.group("BRACE") != null ? "brace" :
                                        matcher.group("BRACKET") != null ? "bracket" :
                                                matcher.group("SEMICOLON") != null ? "semicolon" :
                                                        matcher.group("STRING") != null ? "string" :
                                                                matcher.group("COMMENT") != null ? "comment" :
                                                                        null; /* never happens */
        assert styleClass != null;
        spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);
        spansBuilder.add(Collections.singleton(styleClass), matcher.end() - matcher.start());
        lastKwEnd = matcher.end();
    }
    spansBuilder.add(Collections.emptyList(), text.length() - lastKwEnd);
    return spansBuilder.create();
}
 
开发者ID:EMostafaAli,项目名称:HlaListener,代码行数:24,代码来源:ScriptWindowController.java

示例12: compute

import org.fxmisc.richtext.StyleSpans; //导入依赖的package包/类
private static StyleSpans<Collection<String>> compute(String text) {
    Matcher matcher = PATTERN.matcher(text);
    int lastKwEnd = 0;
    StyleSpansBuilder<Collection<String>> spansBuilder = new StyleSpansBuilder<>();
    while (matcher.find()) {
        String styleClass =
                matcher.group("KEYWORD") != null ? "keyword" :
                matcher.group("PAREN") != null ? "paren" :
                matcher.group("BRACE") != null ? "brace" :
                matcher.group("BRACKET") != null ? "bracket" :
                matcher.group("SEMICOLON") != null ? "semicolon" :
                matcher.group("STRING") != null ? "string" :
                matcher.group("COMMENT") != null ? "comment" :
                null; /* never happens */ assert styleClass != null;
        spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);
        spansBuilder.add(Collections.singleton(styleClass), matcher.end() - matcher.start());
        lastKwEnd = matcher.end();
    }

    spansBuilder.add(Collections.emptyList(), text.length() - lastKwEnd);
    return spansBuilder.create();
}
 
开发者ID:Minecrell,项目名称:dandelion,代码行数:23,代码来源:JavaSyntaxHighlighting.java

示例13: computeHighlighting

import org.fxmisc.richtext.StyleSpans; //导入依赖的package包/类
public static StyleSpans<Collection<String>> computeHighlighting(String text) {
	StyleSpansBuilder<Collection<String>> spansBuilder = new StyleSpansBuilder<>();
	Matcher matcher = HIGHLIGHT_PATTERN.matcher(text);
       
	int lastMatchEnd = 0;
       
       while(matcher.find()) {
           String styleClass =
                   matcher.group(GROUP_KEYWORD) != null ? CSS_KEYWORD :
                   matcher.group(GROUP_PAREN)   != null ? CSS_PAREN :
                   matcher.group(GROUP_BRACE)   != null ? CSS_BRACE :
                   matcher.group(GROUP_BRACKET) != null ? CSS_BRACKET :
                   matcher.group(GROUP_DOT)     != null ? CSS_DOT :
                   matcher.group(GROUP_STRING)  != null ? CSS_STRING :
                   matcher.group(GROUP_COMMENT) != null ? CSS_COMMENT :
                   null;
           
           spansBuilder.add(new ArrayList<String>(), matcher.start() - lastMatchEnd);
           spansBuilder.add(new ArrayList<String>(Arrays.asList(styleClass)), matcher.end() - matcher.start());
           lastMatchEnd = matcher.end();
       }
       
       spansBuilder.add(new ArrayList<String>(), text.length() - lastMatchEnd);
       return spansBuilder.create();
}
 
开发者ID:gaste,项目名称:dwasp-gui,代码行数:26,代码来源:AspCore2Highlight.java

示例14: computeHighlighting

import org.fxmisc.richtext.StyleSpans; //导入依赖的package包/类
protected StyleSpans<Collection<String>> computeHighlighting(String text) {
    Matcher matcher = PATTERN.matcher(text);
    int lastKwEnd = 0;
    StyleSpansBuilder<Collection<String>> spansBuilder
            = new StyleSpansBuilder<>();
    while(matcher.find()) {
        String styleClass =
                matcher.group("KEYWORD") != null ? "keyword" :
                        matcher.group("PAREN") != null ? "paren" :
                                matcher.group("BRACE") != null ? "brace" :
                                        matcher.group("BRACKET") != null ? "bracket" :
                                                matcher.group("SEMICOLON") != null ? "semicolon" :
                                                        matcher.group("STRING") != null ? "string" :
                                                                null; /* never happens */ assert styleClass != null;
        spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);
        spansBuilder.add(Collections.singleton(styleClass), matcher.end() - matcher.start());
        lastKwEnd = matcher.end();
    }
    spansBuilder.add(Collections.emptyList(), text.length() - lastKwEnd);
    return spansBuilder.create();
}
 
开发者ID:finanzer,项目名称:epubfx,代码行数:22,代码来源:CssRichTextCodeEditor.java

示例15: computeHighlighting

import org.fxmisc.richtext.StyleSpans; //导入依赖的package包/类
private static StyleSpans<Collection<String>> computeHighlighting(String text) {
	
    Matcher matcher = CodeAreaFinalValues.getPattern().matcher(text);
    int lastKwEnd = 0;
    StyleSpansBuilder<Collection<String>> spansBuilder
            = new StyleSpansBuilder<>();
    while(matcher.find()) {
        String styleClass =
                matcher.group("KEYWORD") != null ? "keyword" :
                matcher.group("PRIMITIVE") != null ? "primitive" :
                matcher.group("PAREN") != null ? "paren" :
                matcher.group("BRACE") != null ? "brace" :
                matcher.group("BRACKET") != null ? "bracket" :
                matcher.group("SEMICOLON") != null ? "semicolon" :
                matcher.group("STRING") != null ? "string" :
                matcher.group("COMMENT") != null ? "comment" :
                matcher.group("NUMBERS")  != null ? "numbers" :	
                null; /* never happens */ assert styleClass != null;
        spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);
        spansBuilder.add(Collections.singleton(styleClass), matcher.end() - matcher.start());
        lastKwEnd = matcher.end();
    }
    spansBuilder.add(Collections.emptyList(), text.length() - lastKwEnd);
    return spansBuilder.create();
    
}
 
开发者ID:avraampiperidis,项目名称:SimpleJavaIDE,代码行数:27,代码来源:CodeAreaFinalValues.java


注:本文中的org.fxmisc.richtext.StyleSpans类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。