本文整理汇总了Java中javafx.scene.layout.BorderPane.setMargin方法的典型用法代码示例。如果您正苦于以下问题:Java BorderPane.setMargin方法的具体用法?Java BorderPane.setMargin怎么用?Java BorderPane.setMargin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.BorderPane
的用法示例。
在下文中一共展示了BorderPane.setMargin方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: overlay
import javafx.scene.layout.BorderPane; //导入方法依赖的package包/类
protected Parent overlay(int window, int yCode) {
EncoderParameters params = getEncoderParameters();
double ye = params.matrix.fromLumaCode(yCode);
double yo = params.transfer.eotf(ye);
CIExy xy = getColor(yo);
String text = format("HDR10 grayscale CIE(x=%.4f, y=%.4f) %.1f%% Y%d,"
+ " %.1f nit", xy.x, xy.y, ye * 100.0, yCode, yo * 10000.0);
Label label = new Label(text);
label.setFont(font(40));
label.setTextFill(gray(max(0.25, min(0.5, ye))));
BorderPane.setMargin(label, new Insets(20));
BorderPane layout = new BorderPane();
layout.setBackground(EMPTY);
layout.setBottom(label);
return layout;
}
示例2: overlay
import javafx.scene.layout.BorderPane; //导入方法依赖的package包/类
private static Parent overlay(int version, int display,
YCbCr params, int yCode, String suffix) {
double ye = params.fromLumaCode(yCode);
Label label = new Label(getLabel(version, display, params, yCode,
suffix));
label.setFont(font(40));
label.setTextFill(gray(max(0.25, min(0.5, ye))));
BorderPane.setMargin(label, new Insets(20));
BorderPane layout = new BorderPane();
layout.setBackground(EMPTY);
layout.setBottom(label);
return layout;
}
示例3: buildUI
import javafx.scene.layout.BorderPane; //导入方法依赖的package包/类
private Parent buildUI() {
BorderPane root = new BorderPane();
Insets margin = new Insets(10);
Node leftPane = buildLeftPane();
Node bottomPane = buildBottomPane();
Node centerPane = buildCenterPane();
root.setLeft(leftPane);
root.setBottom(bottomPane);
root.setCenter(centerPane);
BorderPane.setMargin(bottomPane, margin);
BorderPane.setMargin(centerPane, margin);
return root;
}
示例4: TaskCell
import javafx.scene.layout.BorderPane; //导入方法依赖的package包/类
public TaskCell() {
titleText = new Label();
titleText.getStyleClass().add("task-title");
messageText = new Label();
messageText.getStyleClass().add("task-message");
progressBar = new ProgressBar();
progressBar.setMaxWidth(Double.MAX_VALUE);
progressBar.setMaxHeight(8);
progressBar.getStyleClass().add("task-progress-bar");
cancelButton = new Button("Cancel");
cancelButton.getStyleClass().add("task-cancel-button");
cancelButton.setTooltip(new Tooltip("Cancel Task"));
cancelButton.setOnAction(evt -> {
if (task != null) {
task.cancel(true);
}
});
VBox vbox = new VBox();
vbox.setSpacing(4);
vbox.getChildren().add(titleText);
vbox.getChildren().add(progressBar);
vbox.getChildren().add(messageText);
BorderPane.setAlignment(cancelButton, Pos.CENTER);
BorderPane.setMargin(cancelButton, new Insets(0, 0, 0, 4));
borderPane = new BorderPane();
borderPane.setCenter(vbox);
borderPane.setRight(cancelButton);
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
}
示例5: updateItem
import javafx.scene.layout.BorderPane; //导入方法依赖的package包/类
@Override
protected void updateItem(T task, boolean empty) {
super.updateItem(task, empty);
this.task = task;
if (empty || task == null) {
getStyleClass().setAll("task-list-cell-empty");
setGraphic(null);
} else if (task != null) {
getStyleClass().setAll("task-list-cell");
progressBar.progressProperty().bind(task.progressProperty());
titleText.textProperty().bind(task.titleProperty());
messageText.textProperty().bind(task.messageProperty());
Callback<T, Node> factory = getSkinnable().getGraphicFactory();
if (factory != null) {
Node graphic = factory.call(task);
if (graphic != null) {
BorderPane.setAlignment(graphic, Pos.CENTER);
BorderPane.setMargin(graphic, new Insets(0, 4, 0, 0));
borderPane.setLeft(graphic);
}
} else {
/*
* Really needed. The application might have used a graphic
* factory before and then disabled it. In this case the border
* pane might still have an old graphic in the left position.
*/
borderPane.setLeft(null);
}
setGraphic(borderPane);
}
}
示例6: initialize
import javafx.scene.layout.BorderPane; //导入方法依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
try {
FXMLLoader loader = new FXMLLoader(App.class.getResource("status.fxml"));
borderPane.setCenter(loader.load());
this.gameStatusController = (GameStatusController)loader.getController();
BorderPane.setMargin(this.gameStatusController.getTableView(), new Insets(0, 0, 0, 20));
this.gameStatusController.getTableView().getColumns().get(0).setText("Players");
this.gameStatusController.getTableView().setPlaceholder(new Label("No player in room"));
} catch (Exception e) {
e.printStackTrace();
}
}
示例7: PageBaseSkin
import javafx.scene.layout.BorderPane; //导入方法依赖的package包/类
public PageBaseSkin(C page) {
super(page);
// Navigation
Button backButton = new Button("<");
Button forwardButton = new Button(">");
Button todayButton = new Button(Messages.getString("PageBaseSkin.TODAY"));
backButton.getStyleClass().add("previous-date-button");
forwardButton.getStyleClass().add("next-date-button");
backButton.setOnAction(evt -> page.goBack());
forwardButton.setOnAction(evt -> page.goForward());
todayButton.setOnAction(evt -> page.goToday());
ButtonBar navigationButton = new ButtonBar(backButton, todayButton, forwardButton);
navigationButton.getStyleClass().add("navigation-button-bar"); //$NON-NLS-1$
navigationButton.visibleProperty().bind(page.showNavigationProperty());
// Date label
this.dateText = new Text("Date"); //$NON-NLS-1$
this.dateText.getStyleClass().add("date-text"); //$NON-NLS-1$
this.dateText.visibleProperty().bind(page.showDateProperty());
page.dateProperty().addListener(evt -> updateDateText());
BorderPane.setMargin(navigationButton, new Insets(10));
BorderPane.setMargin(dateText, new Insets(10));
headerPane = new BorderPane();
headerPane.getStyleClass().add("header");
headerPane.setLeft(navigationButton);
headerPane.setRight(dateText);
Node content = createContent();
content.getStyleClass().add("content"); //$NON-NLS-1$
content.sceneProperty().addListener(it -> {
if (content.getScene() != null) {
content.applyCss();
}
});
borderPane = new BorderPane();
borderPane.getStyleClass().add("container");
borderPane.setCenter(content);
getChildren().add(borderPane);
updateDateText();
updateHeaderVisibility();
page.showDateProperty().addListener(it -> updateHeaderVisibility());
page.showNavigationProperty().addListener(it -> updateHeaderVisibility());
}
示例8: openEditor
import javafx.scene.layout.BorderPane; //导入方法依赖的package包/类
private void openEditor() {
final PopOver popOver = new PopOver();
final TextField textEditor = new TextField(targetText.getText());
BorderPane editorPane = new BorderPane(textEditor);
BorderPane.setMargin(textEditor, new Insets(12));
textEditor.setOnKeyReleased(e -> {
if ( KeyCode.ESCAPE.equals(e.getCode()) ) {
popOver.hide();
}
});
textEditor.setOnAction(e -> {
try {
setTargetValue(Double.parseDouble(textEditor.getText()));
fireTargeValueSet();
} catch ( NumberFormatException nfex ) {
Toolkit.getDefaultToolkit().beep();
} finally {
popOver.hide();
}
});
popOver.setContentNode(editorPane);
popOver.setDetachable(false);
popOver.setDetached(false);
popOver.setArrowLocation(PopOver.ArrowLocation.TOP_CENTER);
popOver.setHeaderAlwaysVisible(true);
popOver.setHideOnEscape(true);
popOver.setTitle("Set Target Value");
popOver.setAnimated(true);
popOver.setAutoHide(true);
popOver.setCloseButtonEnabled(true);
text.getScene().getStylesheets().stream().forEach(s -> popOver.getRoot().getStylesheets().add(s));
Bounds bounds = getBoundsInLocal();
Bounds screenBounds = localToScreen(bounds);
int x = (int) screenBounds.getMinX();
int y = (int) screenBounds.getMinY();
int w = (int) screenBounds.getWidth();
int h = (int) screenBounds.getHeight();
popOver.show(this, x + w / 2, y + h / 2);
}