本文整理汇总了Java中javafx.scene.text.Text.setWrappingWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Text.setWrappingWidth方法的具体用法?Java Text.setWrappingWidth怎么用?Java Text.setWrappingWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.text.Text
的用法示例。
在下文中一共展示了Text.setWrappingWidth方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createWrappableTableCell
import javafx.scene.text.Text; //导入方法依赖的package包/类
/**
* Creates a wrapped table cell.
*
* @param column the table column in which the cell resides
* @return a TableCell with the text wrapped inside
*/
private TableCell<Annotation, String> createWrappableTableCell(final TableColumn<Annotation, String> column) {
return new TableCell<Annotation, String>() {
@Override
protected void updateItem(final String item, final boolean empty) {
super.updateItem(item, empty);
if (item == null || empty) {
setGraphic(null);
return;
}
final Text text = new Text(item);
text.setWrappingWidth(column.getWidth() - TEXT_PADDING);
setPrefHeight(text.getLayoutBounds().getHeight());
setGraphic(text);
}
};
}
示例2: wrappableTableCell
import javafx.scene.text.Text; //导入方法依赖的package包/类
/**
* Create a table cell that wraps the text inside.
*
* @param param the table column
* @return a table cell that wraps the text inside
*/
TableCell<Annotation, String> wrappableTableCell(final TableColumn<Annotation, String> param) {
return new TableCell<Annotation, String>() {
@Override
protected void updateItem(final String item, final boolean empty) {
super.updateItem(item, empty);
if (item == null || empty) {
setGraphic(null);
return;
}
final Text text = new Text(item);
text.setWrappingWidth(param.getWidth());
setPrefHeight(text.getLayoutBounds().getHeight());
setGraphic(text);
}
};
}
示例3: Hyperlink
import javafx.scene.text.Text; //导入方法依赖的package包/类
@FXML
/**
*
* Shows information about the software.
*/ private void showAboutAlert() {
Hyperlink hyperlink = new Hyperlink();
hyperlink.setText("https://github.com/jmueller95/CORNETTO");
Text text = new Text("Cornetto is a modern tool to visualize and calculate correlations between" +
"samples.\nIt was created in 2017 by students of the group of Professor Huson in Tübingen.\nThe group" +
"was supervised by Caner Bagci.\n\n" +
"This project is licensed under the MIT License.\n\n" +
"For more information go to: ");
TextFlow textFlow = new TextFlow(text, hyperlink);
text.setWrappingWidth(500);
aboutAlert = new Alert(Alert.AlertType.INFORMATION);
aboutAlert.setTitle("About " + GlobalConstants.NAME_OF_PROGRAM);
aboutAlert.setHeaderText("What is " + GlobalConstants.NAME_OF_PROGRAM);
aboutAlert.getDialogPane().setContent(textFlow);
aboutAlert.show();
}
示例4: buildScene
import javafx.scene.text.Text; //导入方法依赖的package包/类
private Scene buildScene() {
VBox aboutBox = new VBox(properties.getAboutBoxSpacing());
Scene dialogScene = new Scene(aboutBox, properties.getAboutBoxWidth(), properties.getAboutBoxHeight());
Text text = new Text(localeService.getMessage("ui.menu.help.about.text"));
text.setTextAlignment(TextAlignment.CENTER);
text.setWrappingWidth(properties.getAboutBoxWidth());
aboutBox.getChildren().add(text);
return dialogScene;
}
示例5: createBox
import javafx.scene.text.Text; //导入方法依赖的package包/类
private void createBox(int startRange, int endRange){
slide = new CustomSlider(startRange, endRange, startRange);
Label value = new Label(Integer.toString(startRange));
slide.valueProperty().addListener(e -> value.setText(Integer.toString((int) slide.getValue())));
Text title = new Text(varName);
title.setWrappingWidth(100);
this.getChildren().addAll(title, slide, value);
}
示例6: createBox
import javafx.scene.text.Text; //导入方法依赖的package包/类
private void createBox(double startRange, double endRange){
slide = new CustomSlider(startRange, endRange, startRange);
Label value = new Label(Double.toString(startRange));
//http://stackoverflow.com/questions/2808535/round-a-double-to-2-decimal-places
DecimalFormat df = new DecimalFormat("#.00");
slide.valueProperty().addListener(e -> value.setText(df.format(slide.getValue())));
Text title = new Text(varName);
title.setWrappingWidth(100);
this.getChildren().addAll(title, slide, value);
}
示例7: createWelcome
import javafx.scene.text.Text; //导入方法依赖的package包/类
private void createWelcome(String genreName){
Text welcome = new Text(genreName + " " + myResources.getString("CREATION_ENVIRONMENT_SUFFIX"));
welcome.setFont(titleFont);
welcome.setWrappingWidth(WRAPPING_WIDTH);
welcome.setTextAlignment(TextAlignment.CENTER);
this.getChildren().add(welcome);
createUserData();
}
示例8: PackageNodeView
import javafx.scene.text.Text; //导入方法依赖的package包/类
public PackageNodeView(PackageNode node) {
super(node);
refNode = node;
title = new Text(node.getTitle());
title.setFont(Font.font("Verdana", FontWeight.BOLD, 12));
//TODO Ugly solution, hardcoded value.
title.setWrappingWidth(node.getWidth() - 7);
container = new VBox();
bodyStackPane = new StackPane();
container.setSpacing(0);
createRectangles();
container.getChildren().add(top);
bodyStackPane.getChildren().addAll(body, title);
container.getChildren().addAll(bodyStackPane);
StackPane.setAlignment(title, Pos.TOP_CENTER);
StackPane.setAlignment(top, Pos.CENTER_LEFT);
setTitleSize();
this.getChildren().add(container);
this.setTranslateX(node.getTranslateX());
this.setTranslateY(node.getTranslateY());
createHandles();
}
示例9: Balloon
import javafx.scene.text.Text; //导入方法依赖的package包/类
Balloon(String id, String text) {
instance=this;
bubbleShadow.setRadius(10.0);
bubbleShadow.setOffsetX(1.5);
bubbleShadow.setOffsetY(2.5);
bubbleShadow.setColor(Color.color(0, 0, 0, Main.getProperties().getFloat("balloon.shadow-opacity", 1.0f)));
Text label = new Text("");
label.setStyle("-fx-alignment: center; -fx-text-alignment: center; -fx-content-display: center;");
label.setTextAlignment(TextAlignment.CENTER);
label.setWrappingWidth(300);
if (defaultFont != null) {
label.setFont(defaultFont);
} else {
label.setFont(LocalFont.defaultFont);
}
Integer animation_delay = Main.getProperties().getInteger("balloon.text-animation-delay", 50);
if (animation_delay > 0)
symbolsAdder = new SymbolsAdder(text, animation_delay);
else
label.setText(text);
content = label;
StackPane contentPane = new StackPane();
contentPane.getChildren().add(content);
bubblesGroup = new Group(bubbleShapes);
stackPane.getChildren().add(bubblesGroup);
stackPane.getChildren().add(contentPane);
StackPane.setMargin(content, margin);
setBalloonScaleFactor(Main.getProperties().getFloat("balloon.scale_factor", 100));
getChildren().add(stackPane);
setBalloonOpacity(Main.getProperties().getFloat("balloon.opacity", 100));
setOnMousePressed(event -> {
lastClick = System.currentTimeMillis();
if ((positionMode != PositionMode.AUTO) && event.getButton().equals(MouseButton.PRIMARY)) {
startDrag(event);
}
});
setOnMouseReleased(event -> {
if(!isDragging() && event.getButton().equals(MouseButton.PRIMARY) && (System.currentTimeMillis()-lastClick)<200) {
if (character != null) {
character.say(null);
} else {
close();
}
}
});
setOnMouseEntered(event -> {
if (character != null && timeoutTimeline != null) {
timeoutTimeline.stop();
}
});
setOnMouseExited(event -> {
if (character != null && timeoutTimeline != null) {
timeoutTimeline.play();
}
});
mouseEventNotificator
.setOnClickListener()
.setOnMovedListener()
// TODO: Figure out how to write more precise check.
.setOnScrollListener(event -> true);
}