下面列出了javafx.scene.layout.AnchorPane#setPrefHeight ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public PropertyCollectionView(@NamedArg("designerRoot") DesignerRoot root) {
this.root = root;
this.getStyleClass().addAll("property-collection-view");
view = new ListView<>();
initListView(view);
setOwnerStageFactory(root.getMainStage()); // default
AnchorPane footer = new AnchorPane();
footer.setPrefHeight(30);
footer.getStyleClass().addAll("footer");
footer.getStylesheets().addAll(DesignerUtil.getCss("flat").toString());
Button addProperty = new Button("Add property");
ControlUtil.anchorFirmly(addProperty);
addProperty.setOnAction(e -> {
addNewProperty(getUniqueNewName());
view.requestFocus();
});
footer.getChildren().addAll(addProperty);
this.getChildren().addAll(view, footer);
myEditPopover = new PopOverWrapper<>(this::rebindPopover);
myEditPopover.rebind(new PropertyDescriptorSpec());
myEditPopover.doFirstLoad(root.getMainStage());
}
private Node getGapNode(double value) {
AnchorPane tempPane = new AnchorPane();
tempPane.setPrefWidth(value);
tempPane.setPrefHeight(value);
tempPane.setBackground(Background.EMPTY);
return tempPane;
}
private Node getGapNode(double value) {
AnchorPane tempPane = new AnchorPane();
tempPane.setPrefWidth(value);
tempPane.setPrefHeight(value);
tempPane.setBackground(Background.EMPTY);
return tempPane;
}
public Node getGapNode(double value) {
AnchorPane pane = new AnchorPane();
pane.setPrefWidth(value);
pane.setPrefHeight(value);
pane.setBackground(Background.EMPTY);
return pane;
}
private Node getGapNode(double value) {
AnchorPane tempPane = new AnchorPane();
tempPane.setPrefWidth(value);
tempPane.setPrefHeight(value);
tempPane.setBackground(Background.EMPTY);
return tempPane;
}
private Node getGapNode(double value) {
AnchorPane tempPane = new AnchorPane();
tempPane.setPrefWidth(value);
tempPane.setPrefHeight(value);
tempPane.setBackground(Background.EMPTY);
return tempPane;
}
private Node getGapNode(double value) {
AnchorPane tempPane = new AnchorPane();
tempPane.setPrefWidth(value);
tempPane.setPrefHeight(value);
tempPane.setBackground(Background.EMPTY);
return tempPane;
}
private void init() {
loginButton.setText("点击");
loginButton.setLayoutX(220);
loginButton.setLayoutY(160);
loginButton.setPrefWidth(60);
AnchorPane userPane = new AnchorPane();
userPane.setPrefWidth(240);
userPane.setPrefHeight(180);
userPane.getChildren().addAll(loginButton);
this.setTitle("登录");
this.setWidth(320);
this.setHeight(260);
this.setCenter(userPane);
this.setBackground("Resources\\Images\\Wallpaper\\1.jpg");
loginButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
if(mainFrame.isShowing()){
mainFrame.hide();
}else{
mainFrame.show();
}
}
});
}
private void initComponent() {
this.setStyle("-fx-background-color:#ffffff");
upButton.setText("上一步");
button.setText("确定");
upButton.setPrefSize(80, 25);
button.setPrefSize(80, 25);
Label passwordLabel = new Label("新密码");
Label confirmPasswordLabel = new Label("确认密码");
passwordField.setPromptText("新密码");
confirmPasswordField.setPromptText("确认密码");
passwordLabel.setPrefSize(50, 25);
passwordLabel.setLayoutX(10);
passwordLabel.setLayoutY(15);
passwordField.setPrefSize(290, 25);
passwordField.setLayoutX(passwordLabel.getLayoutX() + passwordLabel.getPrefWidth() + 10);
passwordField.setLayoutY(passwordLabel.getLayoutY());
confirmPasswordLabel.setPrefSize(50, 25);
confirmPasswordLabel.setLayoutX(10);
confirmPasswordLabel.setLayoutY(passwordField.getLayoutY() + passwordField.getPrefHeight() + 15);
confirmPasswordField.setPrefSize(290, 25);
confirmPasswordField.setLayoutX(confirmPasswordLabel.getLayoutX() + confirmPasswordLabel.getPrefWidth() + 10);
confirmPasswordField.setLayoutY(confirmPasswordLabel.getLayoutY());
AnchorPane infoPane = new AnchorPane();
infoPane.getChildren().add(passwordLabel);
infoPane.getChildren().add(confirmPasswordLabel);
infoPane.getChildren().add(passwordField);
infoPane.getChildren().add(confirmPasswordField);
infoPane.setPrefHeight(confirmPasswordField.getLayoutY() + 50);
topVBox.getChildren().add(infoPane);
scrollPane.setBackground(Background.EMPTY);
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setContent(box);
HBox bottomBox = new HBox();
bottomBox.setAlignment(Pos.CENTER);
bottomBox.setPadding(new Insets(5, 10, 5, 10));
bottomBox.setSpacing(10);
bottomBox.getChildren().add(upButton);
bottomBox.getChildren().add(button);
over.setContentNode(overLabel);
baseBorderPane.setTop(topVBox);
baseBorderPane.setCenter(scrollPane);
baseBorderPane.setBottom(bottomBox);
this.getChildren().add(baseBorderPane);
}
public void createMapToolBox() {
// Set up the map tool anchor pane
mapToolAnchorPane = new AnchorPane();
mapToolAnchorPane.setId("map-tool-anchor-pane");
//mapToolAnchorPane.setStyle("-fx-background-color: lightgrey; ");
// see https://introjava.wordpress.com/2012/03/23/java-fx-2-linear-gradients/
// mapToolAnchorPane.setStyle(
//// "-fx-background-radius: 15px;"
//// + "-fx-background-color: linear-gradient(lightgrey, darkgrey);"
// //+ "-fx-background-color: darkgrey;"
// "-fx-background-color:"
// + "linear-gradient(#686868 0%, #232723 25%, #373837 75%, #757575 100%),"
// + " linear-gradient(#020b02, #3a3a3a),"
// + " linear-gradient(#9d9e9d 0%, #6b6a6b 20%, #343534 80%, #242424 100%),"
// + " linear-gradient(#8a8a8a 0%, #6b6a6b 20%, #343534 80%, #262626 100%),"
// + " linear-gradient(#777777 0%, #606060 50%, #505250 51%, #2a2b2a 100%);"
// + "-fx-background-insets: 0,1,4,5,6;"
// + "-fx-background-radius: 9,8,5,4,3;"
// + "-fx-padding: 1 1 1 1;"
//// + "-fx-font-family: 'Helvetica';"
// + "-fx-font-size: 12px;"
//// + "-fx-font-weight: bold;"
// + "-fx-opacity: .75;"
// + "-fx-text-fill: white;"
// + "-fx-effect: dropshadow( three-pass-box , rgba(255,255,255,0.2),1 ,0.0 ,0 ,1);"
// );
// mapToolAnchorPane.setOpacity(.75);
mapToolAnchorPane.setPrefHeight(450);
mapToolAnchorPane.setPrefWidth(140);
sMapStackPane.getChildren().add(mapToolAnchorPane);
AnchorPane.setTopAnchor(mapToolAnchorPane, 110.0);
AnchorPane.setRightAnchor(mapToolAnchorPane, 20.0);
createMapButtons();
createMapCacheToggles();
createFXSettlementComboBox();
createFXZoomSlider();
createFXMapLabelBox();
anchorAllMapWidgets();
// detect mouse wheel scrolling
sMapStackPane.setOnScroll(new EventHandler<ScrollEvent>() {
public void handle(ScrollEvent event) {
if (event.getDeltaY() == 0)
return;
double direction = event.getDeltaY();
if (direction > 0) {
// Move zoom slider down.
if (zoomSlider.getValue() > zoomSlider.getMin())
zoomSlider.setValue((zoomSlider.getValue() - 1));
} else if (direction < 0) {
// Move zoom slider up.
if (zoomSlider.getValue() < zoomSlider.getMax())
zoomSlider.setValue((zoomSlider.getValue() + 1));
}
// event.consume();
}
});
}