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


Java StackPane.setMaxSize方法代码示例

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


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

示例1: createEmojiNode

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
/**
 * 创建emoji图片节点
 *
 * @param emoji
 *            emoji
 * @param size
 *            图片显示大小
 * @param pad
 *            图片间距
 * @param isCursor
 *            是否需要图片光标及鼠标处理事件
 * @return
 */
public static Node createEmojiNode(Emoji emoji, int size, int pad) {
	// 将表情放到stackpane中
	StackPane stackPane = new StackPane();
	stackPane.setMaxSize(size, size);
	stackPane.setPrefSize(size, size);
	stackPane.setMinSize(size, size);
	stackPane.setPadding(new Insets(pad));
	ImageView imageView = new ImageView();
	imageView.setFitWidth(size);
	imageView.setFitHeight(size);
	imageView.setImage(ImageCache.getInstance().getImage(getEmojiImagePath(emoji.getHex())));
	stackPane.getChildren().add(imageView);

	return stackPane;
}
 
开发者ID:Laity000,项目名称:ChatRoom-JavaFX,代码行数:29,代码来源:EmojiDisplayer.java

示例2: CircularDirectionIndicator

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
public CircularDirectionIndicator(String name, double radius){
	this.name = name;
	this.radius = radius;
	
	root = new VBox();
	
	StackPane graphicalData = new StackPane();
	graphicalData.setMaxSize(radius * 2, radius * 2);
	lineBox = new Canvas();
	
	outerCircle = new Circle(graphicalData.getWidth() * 0.5, graphicalData.getHeight() * 0.5, radius);
	outerCircle.setFill(Color.TRANSPARENT);
	outerCircle.setStroke(Color.BLACK);
	/*innerCircle = new Circle(graphicalData.getWidth() * 0.5, graphicalData.getHeight() * 0.5, radius * 0.5);
	innerCircle.setFill(Color.TRANSPARENT);
	innerCircle.setStroke(Color.BLACK);*/
	
	lineBox.setWidth(radius * 2);
	lineBox.setHeight(radius * 2);
	
	graphicalData.getChildren().addAll(outerCircle, lineBox);
	
	valLbl = new Label(name+": 0.0");
	valLbl.setMinWidth(radius * 2);
	valLbl.setTextAlignment(TextAlignment.CENTER);
	
	HBox labalBox = new HBox();
	labalBox.getChildren().add(valLbl);
	labalBox.setAlignment(Pos.CENTER);
	
	root.setAlignment(Pos.CENTER);
	root.setSpacing(2.0);
	root.getChildren().addAll(labalBox, graphicalData);
	
	setValue(0);
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:37,代码来源:CircularDirectionIndicator.java

示例3: start

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
    double[] values = new double[]{50,166,200,106,94,211,172,133,132,185,152,131,158,180,172,314,262,160};

    //---->Default graph using plotter<----
    LineGraph graph = new LineGraph(400,200, Theme.TRAFFIC);
    graph.setInterval(20);

    //Populating the graph
    for (double value : values) {
        graph.addValue(value);
    }

    graph.render(LineGraph.Render.ALL);

    StackPane background = new StackPane();
    background.setPrefHeight(300);
    background.setPrefWidth(600);
    background.setStyle("-fx-background-color: radial-gradient(center 50% 50%, radius 100%, #2a367f, #1f2756)");

    background.getChildren().add(graph);
    StackPane.setAlignment(graph, Pos.CENTER);

    StackPane axis = new StackPane();
    axis.setMaxSize(500,50);
    Line divider = new Line(50,0,550,0);
    divider.setStroke(Color.WHITE);
    divider.setOpacity(0.3);
    axis.getChildren().add(divider);
    StackPane.setAlignment(divider,Pos.CENTER);
    Label time1 = new Label("8am");
    Label time2 = new Label("5pm");
    time1.setTextFill(Color.WHITE);
    time2.setTextFill(Color.WHITE);
    time1.setOpacity(0.5);
    time2.setOpacity(0.5);
    time1.setFont(Font.font("Calibri",16));
    time2.setFont(Font.font("Calibri",16));
    axis.getChildren().addAll(time1,time2);
    StackPane.setAlignment(time1,Pos.BOTTOM_LEFT);
    StackPane.setMargin(time1, new Insets(0,0,0,30));
    StackPane.setAlignment(time2, Pos.BOTTOM_RIGHT);
    StackPane.setMargin(time2, new Insets(0,30,0,0));

    background.getChildren().add(axis);
    StackPane.setAlignment(axis, Pos.BOTTOM_CENTER);
    StackPane.setMargin(axis, new Insets(0,0,40,0));

    primaryStage.setScene(new Scene(background));
    primaryStage.setTitle("Traffic");
    primaryStage.show();
}
 
开发者ID:DrMerfy,项目名称:GraphCreator,代码行数:53,代码来源:Traffic.java


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