本文整理匯總了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();
}
示例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);
}
}
示例3: getLabelHeight
import javafx.scene.text.Text; //導入方法依賴的package包/類
private double getLabelHeight(Text text) {
text.applyCss();
return text.getLayoutBounds().getHeight();
}
示例4: getLabelWidth
import javafx.scene.text.Text; //導入方法依賴的package包/類
private double getLabelWidth(Text text) {
text.applyCss();
return text.getLayoutBounds().getWidth();
}
示例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);
}