本文整理汇总了Java中javafx.scene.layout.Pane.setPrefWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Pane.setPrefWidth方法的具体用法?Java Pane.setPrefWidth怎么用?Java Pane.setPrefWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.Pane
的用法示例。
在下文中一共展示了Pane.setPrefWidth方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NotifyTab
import javafx.scene.layout.Pane; //导入方法依赖的package包/类
public NotifyTab()
{
super();
super.setText("Notification");
super.setClosable(false);
pane = new Pane();
box = new VBox();
header = new Label();
desc = new Label();
okButton = new Button("Ok");
okButton.setPrefWidth(50);
okButton.setOnMouseClicked(new OkButtonHandler());
box.getChildren().addAll(header, desc, okButton);
box.setPadding(new Insets(15, 15, 15, 15));
box.setSpacing(15);
pane.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
pane.setPrefWidth(AppTabPane.CONTENT_WIDTH);
pane.getChildren().add(box);
super.setContent(pane);
}
示例2: start
import javafx.scene.layout.Pane; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
if (primaryStage == null) {
return;
}
/* Layers */
Group backgroundLayer = new Group();
Group statesLayer = new Group();
Group selectionLayer = new Group();
Pane paintingPane = new Pane(backgroundLayer, statesLayer, selectionLayer);
paintingPane.setStyle(BACKGROUND_STYLE);
/* Top-level */
Pane contentPane = new Pane(paintingPane);
contentPane.minWidthProperty().bind(contentPane.prefWidthProperty());
contentPane.maxWidthProperty().bind(contentPane.prefWidthProperty());
ScrollPane scrollPane = new ScrollPane(contentPane);
scrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
scrollPane.setHbarPolicy(ScrollBarPolicy.ALWAYS);
scrollPane.setFitToHeight(true);
scrollPane.setFitToWidth(true);
scrollPane.setPannable(true);
BorderPane borderPane = new BorderPane(scrollPane);
primaryStage.setScene(new Scene(borderPane));
primaryStage.show();
primaryStage.setHeight(500);
primaryStage.setWidth(500);
contentPane.setPrefHeight(200);
contentPane.setPrefWidth(PANE_WIDTH);
/* Bind painting pane's height to the content pane */
paintingPane.minHeightProperty().bind(contentPane.minHeightProperty());
paintingPane.prefHeightProperty().bind(contentPane.prefHeightProperty());
paintingPane.maxHeightProperty().bind(contentPane.maxHeightProperty());
/* We set painting's pane width programmatically */
paintingPane.minWidthProperty().bind(paintingPane.prefWidthProperty());
paintingPane.maxWidthProperty().bind(paintingPane.prefWidthProperty());
paintingPane.setPrefWidth(2000);
double x = PANE_WIDTH - 2000;
System.out.println(x);
paintingPane.relocate(x, 0);
drawBackground(backgroundLayer, paintingPane);
drawRectangles(statesLayer);
drawSelection(selectionLayer, paintingPane);
}
示例3: start
import javafx.scene.layout.Pane; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
if (primaryStage == null) {
return;
}
/* Layers */
Group backgroundLayer = new Group();
Group statesLayer = new Group();
Group selectionLayer = new Group();
/* Top-level */
Pane contentPane = new Pane(backgroundLayer, statesLayer, selectionLayer);
contentPane.minWidthProperty().bind(contentPane.prefWidthProperty());
contentPane.maxWidthProperty().bind(contentPane.prefWidthProperty());
contentPane.setStyle(BACKGROUND_STYLE);
ScrollPane scrollPane = new ScrollPane(contentPane);
scrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
scrollPane.setHbarPolicy(ScrollBarPolicy.ALWAYS);
scrollPane.setFitToHeight(true);
scrollPane.setFitToWidth(true);
scrollPane.setPannable(true);
BorderPane borderPane = new BorderPane(scrollPane);
primaryStage.setScene(new Scene(borderPane));
primaryStage.show();
primaryStage.setHeight(500);
primaryStage.setWidth(500);
contentPane.setPrefHeight(200);
contentPane.setPrefWidth(PANE_WIDTH);
drawBackground(backgroundLayer, contentPane);
drawRectangles(statesLayer);
drawSelection(selectionLayer, contentPane);
}
示例4: PromptTab
import javafx.scene.layout.Pane; //导入方法依赖的package包/类
public PromptTab()
{
super();
super.setText("Confirmation Required");
super.setClosable(false);
pane = new Pane();
contentBox = new VBox();
buttonBox = new HBox();
header = new Label();
desc = new Label();
yesButton = new Button("Yes");
yesButton.setPrefWidth(50);
noButton = new Button("No");
noButton.setPrefWidth(50);
buttonBox.getChildren().addAll(yesButton, noButton);
buttonBox.setSpacing(10);
contentBox.getChildren().addAll(header, desc, buttonBox);
contentBox.setPadding(new Insets(15, 15, 15, 15));
contentBox.setSpacing(15);
pane.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
pane.setPrefWidth(AppTabPane.CONTENT_WIDTH);
pane.getChildren().add(contentBox);
super.setContent(pane);
}
示例5: trocarCena
import javafx.scene.layout.Pane; //导入方法依赖的package包/类
public static void trocarCena(Pane novaCena) throws IOException {
novaCena.setPrefHeight(560);
novaCena.setPrefWidth(600);
pane.setCenter(novaCena);
pane.setCenterShape(false);
menu.setScene(new Scene(pane));
menu.setResizable(false);
}
示例6: trocarCena
import javafx.scene.layout.Pane; //导入方法依赖的package包/类
public static void trocarCena(Pane novaCena) throws IOException {
novaCena.setPrefHeight(560);
novaCena.setPrefWidth(600);
pane.setCenter(novaCena);
pane.setCenterShape(false);
menu.setScene(new Scene(pane));
menu.setResizable(false);
}
示例7: setSize
import javafx.scene.layout.Pane; //导入方法依赖的package包/类
private void setSize (Pane pane, double size) {
pane.setMinWidth(size);
pane.setMaxWidth(size);
pane.setPrefWidth(size);
}