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


Java HBox.setPrefSize方法代码示例

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


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

示例1: createIconContent

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
public static Node createIconContent() {
    StackPane sp = new StackPane();
    HBox hbox = new HBox(3);
    hbox.setAlignment(Pos.CENTER);

    Rectangle rectangle = new Rectangle(70, 25, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    hbox.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle r1 = new Rectangle(14, 14, Color.web("#1c89f4"));
    Rectangle r2 = new Rectangle(14, 14, Color.web("#349b00"));
    Rectangle r3 = new Rectangle(18, 14, Color.web("#349b00"));

    hbox.getChildren().addAll(r1, r2, r3);
    sp.getChildren().addAll(rectangle, hbox);

    return new Group(sp);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:HBoxSample.java

示例2: createGrid

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private void createGrid() {
    
    gridOperator.traverseGrid((i,j)->{
        gridGroup.getChildren().add(createCell(i, j));
        return 0;
    });

    gridGroup.getStyleClass().add("game-grid");
    gridGroup.setManaged(false);
    gridGroup.setLayoutX(BORDER_WIDTH);
    gridGroup.setLayoutY(BORDER_WIDTH);

    HBox hBottom = new HBox();
    hBottom.getStyleClass().add("game-backGrid");
    hBottom.setMinSize(gridWidth, gridWidth);
    hBottom.setPrefSize(gridWidth, gridWidth);
    hBottom.setMaxSize(gridWidth, gridWidth);
    
    // Clip hBottom to keep the dropshadow effects within the hBottom
    Rectangle rect = new Rectangle(gridWidth, gridWidth);
    hBottom.setClip(rect);
    hBottom.getChildren().add(gridGroup);
    
    vGame.getChildren().add(hBottom);
}
 
开发者ID:juebanlin,项目名称:util4j,代码行数:26,代码来源:Board.java

示例3: MainView

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
/**
 * Initializes the whole view.
 */
public MainView() {
	rootPane = new HBox();
	rootPane.setPrefSize(785, 480);
	rootPane.getStyleClass().add("root-pane");

	final VBox menuContainer = new VBox();
	menuContainer.getStyleClass().add("tabPane");

	final ToggleGroup menuItemToggleGroup = new ToggleGroup();
	final String menuItemStyleClass = "MenuItem";

	menuItemServers = new ToggleButton("\uf0c9");
	menuItemServers.getStyleClass().add(menuItemStyleClass);
	menuItemUser = new ToggleButton("\uf007");
	menuItemUser.getStyleClass().add(menuItemStyleClass);
	menuItemVersion = new ToggleButton("\uf0ed");
	menuItemVersion.getStyleClass().add(menuItemStyleClass);
	menuItemFiles = new ToggleButton("\uf07b");
	menuItemFiles.getStyleClass().add(menuItemStyleClass);
	menuItemSettings = new ToggleButton("\uf013");
	menuItemSettings.getStyleClass().add(menuItemStyleClass);

	menuItemToggleGroup.getToggles().addAll(menuItemServers, menuItemUser, menuItemVersion, menuItemFiles, menuItemSettings);
	menuContainer.getChildren().addAll(menuItemServers, menuItemUser, menuItemVersion, menuItemFiles, menuItemSettings);

	final ScrollPane menuScrollPane = new ScrollPane(menuContainer);
	menuScrollPane.setFitToHeight(true);
	menuScrollPane.setFitToWidth(true);
	menuScrollPane.getStyleClass().add("tabScrollPane");

	final VBox mainContentPane = new VBox();
	HBox.setHgrow(mainContentPane, Priority.ALWAYS);
	contentScrollPane = new ScrollPane();
	contentScrollPane.setFitToHeight(true);
	contentScrollPane.setFitToWidth(true);
	contentScrollPane.getStyleClass().add("viewContent");
	VBox.setVgrow(contentScrollPane, Priority.ALWAYS);

	final HBox bottomBar = new HBox();
	bottomBar.getStyleClass().add("bottom-bar");

	githubLink = new Hyperlink("\uf09b");
	githubLink.getStyleClass().add("info-icon");
	githubLink.setTooltip(new Tooltip(Client.lang.getString("openGithubTooltip")));
	helpLink = new Hyperlink("\uf059");
	helpLink.getStyleClass().add("info-icon");
	helpLink.setTooltip(new Tooltip(Client.lang.getString("openGithubWikiTooltip")));
	donateLink = new Hyperlink("Donate \uf0d6");
	donateLink.getStyleClass().add("donate-button");
	donateLink.setTooltip(new Tooltip(Client.lang.getString("openDonationPageTooltip")));
	donateLink.setMaxHeight(Double.MAX_VALUE);

	bottomBarCustom = new HBox();
	bottomBarCustom.getStyleClass().add("bottom-bar-custom");
	HBox.setHgrow(bottomBarCustom, Priority.ALWAYS);

	final HBox progressBarContainer = new HBox();
	progressBarContainer.getStyleClass().add("global-progress-bar-container");
	globalProgressLabel = new Label();
	globalProgressBar = new ProgressBar(0.0);
	progressBarContainer.getChildren().addAll(globalProgressLabel, globalProgressBar);

	bottomBar.getChildren().addAll(githubLink, helpLink, donateLink, bottomBarCustom, progressBarContainer);

	mainContentPane.getChildren().add(contentScrollPane);
	mainContentPane.getChildren().add(bottomBar);

	rootPane.getChildren().add(menuScrollPane);
	rootPane.getChildren().add(mainContentPane);
}
 
开发者ID:Bios-Marcel,项目名称:ServerBrowser,代码行数:74,代码来源:MainView.java

示例4: initGraphics

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private void initGraphics() {
    Font regularFont = Fonts.latoRegular(10);
    Font lightFont   = Fonts.latoLight(10);

    seriesText = new Text("SERIES");
    seriesText.setFill(_textColor);
    seriesText.setFont(regularFont);

    seriesNameText = new Text("-");
    seriesNameText.setFill(_textColor);
    seriesNameText.setFont(lightFont);

    seriesSumText = new Text("SUM");
    seriesSumText.setFill(_textColor);
    seriesSumText.setFont(regularFont);

    seriesValueText = new Text("-");
    seriesValueText.setFill(_textColor);
    seriesValueText.setFont(lightFont);

    itemText = new Text("ITEM");
    itemText.setFill(_textColor);
    itemText.setFont(regularFont);

    itemNameText = new Text("-");
    itemNameText.setFill(_textColor);
    itemNameText.setFont(lightFont);

    valueText = new Text("VALUE");
    valueText.setFill(_textColor);
    valueText.setFont(regularFont);

    itemValueText = new Text("-");
    itemValueText.setFill(_textColor);
    itemValueText.setFont(lightFont);

    line = new Line(0, 0, 0, 56);
    line.setStroke(_textColor);

    VBox vBoxTitles = new VBox(2, seriesText, seriesSumText, itemText, valueText);
    vBoxTitles.setAlignment(Pos.CENTER_LEFT);
    VBox.setMargin(itemText, new Insets(3, 0, 0, 0));

    VBox vBoxValues = new VBox(2, seriesNameText, seriesValueText, itemNameText, itemValueText);
    vBoxValues.setAlignment(Pos.CENTER_RIGHT);
    VBox.setMargin(itemNameText, new Insets(3, 0, 0, 0));
    HBox.setHgrow(vBoxValues, Priority.ALWAYS);

    hBox = new HBox(5, vBoxTitles, line, vBoxValues);
    hBox.setPrefSize(120, 69);
    hBox.setPadding(new Insets(5));
    hBox.setBackground(new Background(new BackgroundFill(_backgroundColor, new CornerRadii(3), Insets.EMPTY)));
    hBox.setMouseTransparent(true);

    getContent().addAll(hBox);
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:57,代码来源:InfoPopup.java

示例5: createCells

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
/**
 * Crea le celle per visualizzare i due vettori e le inizializza.
 * @param array array che contiene le informazioni sui nodi visitati e padri.
 */
private static void createCells(Object[] array) {
	Singleton s = Singleton.getInstance();
	ScrollPane sp = null;
	VBox vBox = s.mainViewController.vBoxVisited;
	
	// ho passato il vettore visited
	if (array instanceof Boolean[]) {
		sp = s.mainViewController.scrollPaneVisited;
		vBox = s.mainViewController.vBoxVisited;
	} else {
		// ho passato il vettore dei padri
		sp = s.mainViewController.scrollPaneParents;
		vBox = s.mainViewController.vBoxParents;
	}
	
	vBox.getChildren().clear();
	
	final double width = sp.getWidth();
	final double cellHeight = sp.getHeight() / 10;
	
	for (Integer i = 0; i < array.length; i++) {
    	
    	HBox cell = new HBox();
    	cell.getStyleClass().add("scrollPaneCell");
    	
    	// se quello che sto esaminando è il nodo sorgente allora lo evidenzio
    	if (s.animPrefs.getRoot().getElement().getIndex() == i) {
    		cell.getStyleClass().add("rootNodeCell");
    	}
		
		// incremento l'altezza del VBox
		vBox.setPrefHeight(vBox.getHeight() + cellHeight);
		
		// creo la cella e la aggiungo al VBox
    	cell.setPrefSize(width, cellHeight);
    	cell.getChildren().add(new Text(i.toString()));
    	cell.getChildren().add(new Text(array[i] != null ? array[i].toString() : "null"));
    	cell.setAlignment(Pos.CENTER_LEFT);
    	
    	vBox.getChildren().add(cell);
	}
}
 
开发者ID:steppp,项目名称:Breadth-First-Search,代码行数:47,代码来源:MainController.java


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