本文整理匯總了Java中javafx.scene.layout.AnchorPane.setTopAnchor方法的典型用法代碼示例。如果您正苦於以下問題:Java AnchorPane.setTopAnchor方法的具體用法?Java AnchorPane.setTopAnchor怎麽用?Java AnchorPane.setTopAnchor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.layout.AnchorPane
的用法示例。
在下文中一共展示了AnchorPane.setTopAnchor方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: AnchorPaneSample
import javafx.scene.layout.AnchorPane; //導入方法依賴的package包/類
public AnchorPaneSample() {
AnchorPane anchorPane = new AnchorPane();
Label label1 = new Label("We are all in an AnchorPane.");
ImageView imageView = new ImageView(ICON_48);
Button button1 = new Button("Submit");
anchorPane.getChildren().addAll(label1, imageView, button1);
AnchorPane.setTopAnchor(label1, Double.valueOf(2));
AnchorPane.setLeftAnchor(label1, Double.valueOf(20));
AnchorPane.setTopAnchor(button1, Double.valueOf(40));
AnchorPane.setLeftAnchor(button1, Double.valueOf(20));
AnchorPane.setTopAnchor(imageView, Double.valueOf(75));
AnchorPane.setLeftAnchor(imageView, Double.valueOf(20));
getChildren().add(anchorPane);
}
示例2: start
import javafx.scene.layout.AnchorPane; //導入方法依賴的package包/類
@Override public void start(Stage stage) {
AnchorPane pane = new AnchorPane(xAxis, yAxis, grid);
AnchorPane.setTopAnchor(yAxis, 0d);
AnchorPane.setBottomAnchor(yAxis, 25d);
AnchorPane.setLeftAnchor(yAxis, 0d);
AnchorPane.setLeftAnchor(xAxis, 25d);
AnchorPane.setRightAnchor(xAxis, 0d);
AnchorPane.setBottomAnchor(xAxis, 0d);
AnchorPane.setTopAnchor(grid, 0d);
AnchorPane.setRightAnchor(grid, 0d);
AnchorPane.setBottomAnchor(grid, 25d);
AnchorPane.setLeftAnchor(grid, 25d);
Scene scene = new Scene(pane);
stage.setTitle("GridTest");
stage.setScene(scene);
stage.show();
//Helper.saveAsPng(pane, "/Users/hansolo/Desktop/grid.png");
}
示例3: createFooter
import javafx.scene.layout.AnchorPane; //導入方法依賴的package包/類
private AnchorPane createFooter() {
AnchorPane footer = new AnchorPane();
footer.getStyleClass().add("footer");
HBox bottonBox = new HBox(20);
bottonBox.getChildren().addAll(previous, next);
footer.getChildren().add(bottonBox);
AnchorPane.setRightAnchor(bottonBox, 20.0);
AnchorPane.setTopAnchor(bottonBox, 10.0);
AnchorPane.setBottomAnchor(bottonBox, 10.0);
return footer;
}
示例4: VerticalResizeContainerView
import javafx.scene.layout.AnchorPane; //導入方法依賴的package包/類
/**
* Creates an instance of this container class.
*/
public VerticalResizeContainerView() {
this.getChildren().add(container);
container.getChildren().addAll(contentContainer);
contentContainer.getChildren().addAll(content, dragLine);
AnchorPane.setLeftAnchor(container, 0.0);
AnchorPane.setRightAnchor(container, 0.0);
AnchorPane.setTopAnchor(container, 0.0);
dragLine.widthProperty().bind(container.widthProperty());
// AnchorPane.setBottomAnchor(dragLine, 0.0);
ViewUtils.setupView(this, "resizeContainer.css");
this.getStyleClass().add("resizeContainer");
dragLine.getStyleClass().add("dragLine");
}
示例5: createRightYAxis
import javafx.scene.layout.AnchorPane; //導入方法依賴的package包/類
private Axis createRightYAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
Axis axis = new Axis(Orientation.VERTICAL, Position.RIGHT);
axis.setMinValue(MIN);
axis.setMaxValue(MAX);
axis.setPrefWidth(AXIS_WIDTH);
axis.setAutoScale(AUTO_SCALE);
AnchorPane.setRightAnchor(axis, 0d);
AnchorPane.setTopAnchor(axis, 0d);
AnchorPane.setBottomAnchor(axis, 25d);
return axis;
}
示例6: createLeftYAxis
import javafx.scene.layout.AnchorPane; //導入方法依賴的package包/類
private Axis createLeftYAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
Axis axis = new Axis(Orientation.VERTICAL, Position.LEFT);
axis.setMinValue(MIN);
axis.setMaxValue(MAX);
axis.setPrefWidth(AXIS_WIDTH);
axis.setAutoScale(AUTO_SCALE);
AnchorPane.setTopAnchor(axis, 0d);
AnchorPane.setBottomAnchor(axis, 25d);
AnchorPane.setLeftAnchor(axis, 0d);
return axis;
}
示例7: setChildNode
import javafx.scene.layout.AnchorPane; //導入方法依賴的package包/類
@Override
public void setChildNode(Node node) {
containerContent.clear();
AnchorPane.setTopAnchor(node, 0.0);
AnchorPane.setLeftAnchor(node, 0.0);
AnchorPane.setRightAnchor(node, 0.0);
AnchorPane.setBottomAnchor(node, 0.0);
containerContent.setAll(node);
}
示例8: BasePane
import javafx.scene.layout.AnchorPane; //導入方法依賴的package包/類
public BasePane() {
final String fxmlFile = this.getClass().getSimpleName() + ".fxml";
FXMLLoader loader = createFXMLLoader(fxmlFile);
controller = loader.getController();
AnchorPane.setBottomAnchor(this , 0.0);
AnchorPane.setTopAnchor(this , 0.0);
AnchorPane.setLeftAnchor(this , 0.0);
AnchorPane.setRightAnchor(this , 0.0);
}
示例9: displayView
import javafx.scene.layout.AnchorPane; //導入方法依賴的package包/類
default void displayView(final AnchorPane anchorPane, final Node view)
{
// Remove anything already there.
anchorPane.getChildren().removeAll(anchorPane.getChildren());
// Make the view fill the anchor pane.
AnchorPane.setTopAnchor(view, 0.0);
AnchorPane.setLeftAnchor(view, 0.0);
AnchorPane.setRightAnchor(view, 0.0);
AnchorPane.setBottomAnchor(view, 0.0);
// Add the view into the anchor pane.
anchorPane.getChildren().add(view);
}
示例10: addTab
import javafx.scene.layout.AnchorPane; //導入方法依賴的package包/類
private void addTab(TreeMap treeMap) {
AnchorPane treeMapContainer = new AnchorPane();
treeMapContainer.setPrefSize(0, 0);
Tab tab = new Tab(treeMap.getData().getName(), treeMapContainer);
Node treeMapNode = treeMap.getNode();
treeMapContainer.getChildren().add(treeMapNode);
AnchorPane.setBottomAnchor(treeMapNode, 0.0);
AnchorPane.setLeftAnchor(treeMapNode, 0.0);
AnchorPane.setRightAnchor(treeMapNode, 0.0);
AnchorPane.setTopAnchor(treeMapNode, 0.0);
tabPane.getTabs().add(tab);
}
示例11: adjustGridAnchors
import javafx.scene.layout.AnchorPane; //導入方法依賴的package包/類
private void adjustGridAnchors() {
if (null == grid) return;
AnchorPane.setLeftAnchor(grid, hasLeftYAxis ? leftAxisWidth : 0d);
AnchorPane.setRightAnchor(grid, hasRightYAxis ? rightAxisWidth : 0d);
AnchorPane.setTopAnchor(grid, hasTopXAxis ? topAxisHeight : 0d);
AnchorPane.setBottomAnchor(grid, hasBottomXAxis ? bottomAxisHeight : 0d);
}
示例12: loadView
import javafx.scene.layout.AnchorPane; //導入方法依賴的package包/類
@Override
public void loadView() {
try {
parent = loader.load();
this.getChildren().add(parent);
this.setStyle("-fx-background-color: #FFFFFF");
AnchorPane.setTopAnchor(this, 0d);
AnchorPane.setBottomAnchor(this, 0d);
this.setPrefSize(((AnchorPane)parent).getPrefWidth(), ((AnchorPane)parent).getPrefHeight());
} catch (IOException ex) {
Logger.getLogger(RegisterView.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例13: createTopXAxis
import javafx.scene.layout.AnchorPane; //導入方法依賴的package包/類
private Axis createTopXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
Axis axis = new Axis(Orientation.HORIZONTAL, Position.TOP);
axis.setMinValue(MIN);
axis.setMaxValue(MAX);
axis.setPrefHeight(AXIS_WIDTH);
axis.setAutoScale(AUTO_SCALE);
AnchorPane.setTopAnchor(axis, 25d);
AnchorPane.setLeftAnchor(axis, 25d);
AnchorPane.setRightAnchor(axis, 25d);
return axis;
}
示例14: initComponents
import javafx.scene.layout.AnchorPane; //導入方法依賴的package包/類
protected void initComponents(String title, Region content) {
// Border style
this.setStyle("-fx-border-width: 1; -fx-border-color: silver");
// TitleBar with Add / Remove Buttons
AnchorPane titleBar = new AnchorPane();
// TitleBar border style
titleBar.setStyle("-fx-border-width: 0 0 1 0; -fx-border-color: silver;");
// Button group
HBox buttons = new HBox();
buttons.setPadding(new Insets(10));
buttons.setSpacing(10);
Button buttonAdd = Utils.createPlusButton();
buttonAdd.setOnAction(this::setOnAddAction);
Button buttonRemove = Utils.createMinusButton();
buttonRemove.setOnAction(this::setOnRemoveAction);
/*Font fontButton = Font.font("sans-serif", FontWeight.EXTRA_BOLD, 12);
buttonAdd.setFont(fontButton);
buttonRemove.setFont(fontButton);*/
buttons.getChildren().addAll(buttonAdd, buttonRemove);
// Title
Label titleText = new Label(title);
titleBar.getChildren().addAll(titleText, buttons);
AnchorPane.setLeftAnchor(titleText, 10.0);
AnchorPane.setTopAnchor(titleText, 10.0);
AnchorPane.setRightAnchor(buttons, 0.0);
// Content
this.setTop(titleBar);
this.setCenter(content);
}
示例15: TimeIndicator
import javafx.scene.layout.AnchorPane; //導入方法依賴的package包/類
public TimeIndicator(DayPane dayPane, Node indicator) {
AnchorPane.setLeftAnchor(dayPane, 0.0);
AnchorPane.setTopAnchor(dayPane, 0.0);
AnchorPane.setRightAnchor(dayPane, 0.0);
AnchorPane.setBottomAnchor(dayPane, 0.0);
this.getChildren().add(dayPane);
this.startTime = dayPane.dayStartTimeProperty();
this.endTime = dayPane.dayEndTimeProperty();
this.date = dayPane.getDayDate();
this.indicator = indicator;
AnchorPane.setLeftAnchor(indicator, 0.0);
AnchorPane.setRightAnchor(indicator, 0.0);
// update position if the DayPane's time window changes
startTime.addListener(observable -> setIndicatorPosition(indicator));
endTime.addListener(observable -> setIndicatorPosition(indicator));
// updates the position every minute
Timeline indicatorupdate = new Timeline(new KeyFrame(javafx.util.Duration.minutes(1), actionEvent -> setIndicatorPosition(indicator)));
indicatorupdate.setCycleCount(Animation.INDEFINITE);
indicatorupdate.play();
// initial position
setIndicatorPosition(indicator);
}