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


Java Text.applyCss方法代码示例

本文整理汇总了Java中javafx.scene.text.Text.applyCss方法的典型用法代码示例。如果您正苦于以下问题:Java Text.applyCss方法的具体用法?Java Text.applyCss怎么用?Java Text.applyCss使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.text.Text的用法示例。


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

示例1: recomputeEllipsisWidth

import javafx.scene.text.Text; //导入方法依赖的package包/类
private synchronized void recomputeEllipsisWidth() {
    Text text = new Text(ELLIPSIS_STRING);
    text.setFont(stateLabelFont.get());
    text.applyCss();
    fEllipsisWidth = text.getLayoutBounds().getWidth();
}
 
开发者ID:lttng,项目名称:lttng-scope,代码行数:7,代码来源:DebugOptions.java

示例2: parseFormattedMessageNode

import javafx.scene.text.Text; //导入方法依赖的package包/类
private void parseFormattedMessageNode(org.jsoup.nodes.Node node, List<Element> p) {
	List textFlowList = bodyContainer.getChildren();
	List<Element> parents = p;

	if(node instanceof TextNode) {
		// Ignore TextNodes containing only whitespace
		if(!node.outerHtml().replace(" ", "").equals("")) {

			String text = ((TextNode) node).getWholeText();
			Text textObject = new Text(text);
			boolean pre = false;

			// Go through all parent tags and apply styling
			for(Element element : parents) {
				String tagName = element.tagName();

				if       ("ul".equals(tagName)) { // Begin bullet list
				} else if("ol".equals(tagName)) { // TODO: Begin numbered list
				} else if("li".equals(tagName)) {
					// List item
					textFlowList.add(new Text(" • "));
				} else if("blockquote".equals(tagName)) {
					textObject.getStyleClass().add("block-quote");
				} else if("pre".equals(tagName)) {
					// Preceeds a <code> tag to specify a multiline block
					pre = true;
				} else if("code".equals(tagName)) {
					// Monospace and TODO: code highlighting
					if(pre) {
						textObject.getStyleClass().add("block-monospace");
					} else {
						textObject.getStyleClass().add("inline-monospace");
					}
					break; // We don't care about anything appearing within a <code> tag
				} else {
					// Other tags are applied ass CSS classes
					textObject.getStyleClass().add(tagName);
				}
			}
			textFlowList.add(textObject);
			textObject.applyCss();
		}
	} else if(node instanceof Element) {
		parents = new LinkedList<>(parents);
		parents.add((Element)node);
	}

	// Recursively parse child tags
	for(org.jsoup.nodes.Node child: node.childNodes()) {
		parseFormattedMessageNode(child, parents);
	}
}
 
开发者ID:Gurgy,项目名称:Cypher,代码行数:53,代码来源:EventListItemPresenter.java

示例3: getLabelHeight

import javafx.scene.text.Text; //导入方法依赖的package包/类
private double getLabelHeight(Text text) {
	text.applyCss();
	return text.getLayoutBounds().getHeight();
}
 
开发者ID:JKostikiadis,项目名称:MultiAxisScatterChart,代码行数:5,代码来源:MultiAxisScatterChart.java

示例4: getLabelWidth

import javafx.scene.text.Text; //导入方法依赖的package包/类
private double getLabelWidth(Text text) {
	text.applyCss();
	return text.getLayoutBounds().getWidth();
}
 
开发者ID:JKostikiadis,项目名称:MultiAxisScatterChart,代码行数:5,代码来源:MultiAxisScatterChart.java

示例5: displayClassSelection

import javafx.scene.text.Text; //导入方法依赖的package包/类
private void displayClassSelection() {
    // Get the correct amount of spacing
    Text text = new Text();
    text.setFont(Font.font("Verdana",
            FontWeight.BOLD, 15));
    text.applyCss();
    final double textHeight = text.getLayoutBounds().getHeight();

    // Modify vbCharacterSelection and vbCharSelectionText
    vbCharSelectionButtons = new VBox(WIDTH / 100);
    vbCharSelectionButtons.setAlignment(Pos.TOP_LEFT);
    vbCharSelectionTexts = new VBox(textHeight
            + (textHeight / numClasses) / numClasses);
    vbCharSelectionTexts.setAlignment(Pos.TOP_RIGHT);

    // Modify hbCharSelection
    hbCharSelection = new HBox(WIDTH / 100);
    hbCharSelection.setAlignment(Pos.TOP_CENTER);

    // Add each class to vbCharacterSelection
    for (int i = 0; i < numClasses; i++) {
        // Description of the class
        txtClassDescriptions[i] = new Text("- " + classes[i][1]);
        txtClassDescriptions[i].setFont(Font.font("Verdana",
                FontWeight.BOLD, 15));
        txtClassDescriptions[i].setFill(Color.rgb(234, 234, 234));

        // Button to select the class
        btnClasses[i] = new Button(classes[i][0]);
        btnClasses[i].setMinSize((WIDTH / 50) * classes[i][0].length(),
                textHeight);

        // Add to vbCharacterSelectionButtons
        vbCharSelectionButtons.getChildren().add(btnClasses[i]);

        // Add to vbCharacterSelectionTexts
        vbCharSelectionTexts.getChildren().add(txtClassDescriptions[i]);
    }

    // Add to hbCharSelection
    hbCharSelection.getChildren().addAll(vbCharSelectionButtons,
            vbCharSelectionTexts);

    // Add to pane
    setCenter(hbCharSelection);
}
 
开发者ID:spencerhendon,项目名称:projectintern,代码行数:47,代码来源:NewGame.java


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