本文整理汇总了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;
}
示例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);
}
示例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);
}
}
示例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
}
示例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();
}