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


Java Text.setWrappingWidth方法代码示例

本文整理汇总了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);
        }
    };
}
 
开发者ID:ProgrammingLife2017,项目名称:hygene,代码行数:25,代码来源:AnnotationController.java

示例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);
        }
    };
}
 
开发者ID:ProgrammingLife2017,项目名称:hygene,代码行数:23,代码来源:NodePropertiesController.java

示例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();
}
 
开发者ID:jmueller95,项目名称:CORNETTO,代码行数:23,代码来源:MainStageController.java

示例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;
}
 
开发者ID:Kindrat,项目名称:cassandra-client,代码行数:10,代码来源:AboutBox.java

示例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);
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:10,代码来源:IntegerInputSlider.java

示例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);
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:13,代码来源:DoubleParameterInput.java

示例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();
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:10,代码来源:WelcomeScreen.java

示例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();
}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:28,代码来源:PackageNodeView.java

示例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);
}
 
开发者ID:DeskChan,项目名称:DeskChan,代码行数:73,代码来源:Balloon.java


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