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


Java ScrollPane.setPrefHeight方法代码示例

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


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

示例1: homeProducts

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
public static BorderPane homeProducts(){

        VBox products = new VBox(20);
        products.getChildren().addAll(
                fetchProducts.productbyType("Discounts for You"),
                fetchProducts.productbyType("Featured Product"),
                fetchProducts.productbyType("New Arrival"),
                fetchProducts.productbyType("Trending"));

        ScrollPane proScroller = new ScrollPane(products);
        proScroller.setPrefHeight(400);
        proScroller.setFitToWidth(true);

        BorderPane home = new BorderPane(proScroller);
        return home;

    }
 
开发者ID:madHEYsia,项目名称:ClassroomFlipkart,代码行数:18,代码来源:homeProducts.java

示例2: init

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setScene(new Scene(root));
    VBox vRoot = new VBox();

    vRoot.setPadding(new Insets(8, 8, 8, 8));
    vRoot.setSpacing(5);

    htmlEditor = new HTMLEditor();
    htmlEditor.setPrefSize(500, 245);
    htmlEditor.setHtmlText(INITIAL_TEXT);
    vRoot.getChildren().add(htmlEditor);

    final Label htmlLabel = new Label();
    htmlLabel.setMaxWidth(500);
    htmlLabel.setWrapText(true);

    ScrollPane scrollPane = new ScrollPane();
    scrollPane.getStyleClass().add("noborder-scroll-pane");
    scrollPane.setContent(htmlLabel);
    scrollPane.setFitToWidth(true);
    scrollPane.setPrefHeight(180);

    Button showHTMLButton = new Button("Show the HTML below");
    vRoot.setAlignment(Pos.CENTER);
    showHTMLButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent arg0) {
            htmlLabel.setText(htmlEditor.getHtmlText());
        }
    });

    vRoot.getChildren().addAll(showHTMLButton, scrollPane);
    root.getChildren().addAll(vRoot);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:HTMLEditorApp.java

示例3: start

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
    try {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("main.fxml"));
        AnchorPane page = loader.load();
        UiController uiController = loader.getController();
        uiController.setStageAndSetupListeners(primaryStage);

        ScrollPane toolPane = (ScrollPane) page.lookup("#mToolPane");
        toolPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
        double width = toolPane.getPrefWidth();
        double height = toolPane.getPrefHeight();
        MenuBar menuBar = (MenuBar) page.lookup("#mMenuBar");
        menuBar.prefWidthProperty().bind(primaryStage.widthProperty());
        double menuHeight = 25;

        toolPane.setPrefHeight(1000 > height ? 1000:height);
        Scene scene = new Scene(page, width + 1000, 1000 > height ? 1000 + menuHeight : height + menuHeight);

        primaryStage.setScene(scene);
        primaryStage.setTitle(TITLE);
        primaryStage.show();

        primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
            @Override
            public void handle(WindowEvent event) {
                Platform.exit();
                System.exit(0);
            }
        });
    } catch (IOException ioe) {
        Logger.getLogger(TAG).log(Level.SEVERE, null, ioe);
    }

}
 
开发者ID:JelloRanger,项目名称:MapGenerator,代码行数:36,代码来源:MapEditorDialog.java

示例4: HTMLEditorSample

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
public HTMLEditorSample() {
    VBox vRoot = new VBox();

    vRoot.setPadding(new Insets(8, 8, 8, 8));
    vRoot.setSpacing(5);

    htmlEditor = new HTMLEditor();
    htmlEditor.setPrefSize(500, 245);
    htmlEditor.setHtmlText(INITIAL_TEXT);
    vRoot.getChildren().add(htmlEditor);

    final Label htmlLabel = new Label();
    htmlLabel.setMaxWidth(500);
    htmlLabel.setWrapText(true);

    ScrollPane scrollPane = new ScrollPane();
    scrollPane.getStyleClass().add("noborder-scroll-pane");
    scrollPane.setContent(htmlLabel);
    scrollPane.setFitToWidth(true);
    scrollPane.setPrefHeight(180);

    Button showHTMLButton = new Button("Show the HTML below");
    vRoot.setAlignment(Pos.CENTER);
    showHTMLButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent arg0) {
            htmlLabel.setText(htmlEditor.getHtmlText());
        }
    });

    vRoot.getChildren().addAll(showHTMLButton, scrollPane);
    getChildren().addAll(vRoot);

    // REMOVE ME
    // Workaround for RT-16781 - HTML editor in full screen has wrong border
    javafx.scene.layout.GridPane grid = (javafx.scene.layout.GridPane)htmlEditor.lookup(".html-editor");
    for(javafx.scene.Node child: grid.getChildren()) {
        javafx.scene.layout.GridPane.setHgrow(child, javafx.scene.layout.Priority.ALWAYS);
    }
    // END REMOVE ME
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:43,代码来源:HTMLEditorSample.java

示例5: start

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
	stage.setTitle("HTMLEditor Sample");
	stage.setWidth(500);
	stage.setHeight(500);
	Scene scene = new Scene(new Group());

	VBox root = new VBox();
	root.setPadding(new Insets(8, 8, 8, 8));
	root.setSpacing(5);
	root.setAlignment(Pos.BOTTOM_LEFT);

	final HTMLEditor htmlEditor = new HTMLEditor();
	htmlEditor.setPrefHeight(245);
	htmlEditor.setHtmlText(INITIAL_TEXT);

	final WebView browser = new WebView();
	final WebEngine webEngine = browser.getEngine();

	ScrollPane scrollPane = new ScrollPane();
	scrollPane.getStyleClass().add("noborder-scroll-pane");
	scrollPane.setStyle("-fx-background-color: white");
	scrollPane.setContent(browser);
	scrollPane.setFitToWidth(true);
	scrollPane.setPrefHeight(180);

	Button showHTMLButton = new Button("Load Content in Browser");
	root.setAlignment(Pos.CENTER);
	showHTMLButton.setOnAction(new EventHandler<ActionEvent>() {
		@Override
		public void handle(ActionEvent arg0) {
			webEngine.loadContent(htmlEditor.getHtmlText());
		}
	});

	root.getChildren().addAll(htmlEditor, showHTMLButton, scrollPane);
	scene.setRoot(root);

	stage.setScene(scene);
	stage.show();
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:42,代码来源:HtmlEditorExam.java


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