本文整理汇总了Java中javafx.scene.layout.BorderPane.setAlignment方法的典型用法代码示例。如果您正苦于以下问题:Java BorderPane.setAlignment方法的具体用法?Java BorderPane.setAlignment怎么用?Java BorderPane.setAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.BorderPane
的用法示例。
在下文中一共展示了BorderPane.setAlignment方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paneFor
import javafx.scene.layout.BorderPane; //导入方法依赖的package包/类
private Pane paneFor(Component component) {
if (panes.containsKey(component)) {
return panes.get(component);
}
BorderPane pane = new BorderPane(component.getView());
ActionList.registerSupplier(pane, () -> actionsForComponent(component));
pane.getStyleClass().add("layout-stack");
EditableLabel label = new EditableLabel(component.titleProperty());
label.getStyleClass().add("layout-label");
((Label) label.lookup(".label")).setTextOverrun(OverrunStyle.LEADING_ELLIPSIS);
BorderPane.setAlignment(label, Pos.TOP_LEFT);
pane.setBottom(label);
panes.put(component, pane);
return pane;
}
示例2: init
import javafx.scene.layout.BorderPane; //导入方法依赖的package包/类
private void init() {
container = new HBox();
container.setSpacing(1);
BorderPane.setAlignment(container, Pos.CENTER);
container.prefHeight(100);
ItemSlot slotSword = new ItemSlot(idCounter++, dragDropHandlers);
slotSword.setFilter(itemBase -> ItemType.isSword(itemBase.getItemType()));
ItemSlot slotArmor = new ItemSlot(idCounter++, dragDropHandlers);
slotArmor.setFilter(itemBase -> itemBase.getItemType() == ItemType.ARMOR);
ItemSlot slotShield = new ItemSlot(idCounter++, dragDropHandlers);
itemSlots.addAll(slotSword, slotArmor, slotShield);
container.getChildren().setAll(
slotSword.getContainer(),
slotArmor.getContainer(),
slotShield.getContainer());
}
示例3: 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);
}
示例4: 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);
}
}
示例5: loadScene
import javafx.scene.layout.BorderPane; //导入方法依赖的package包/类
private Scene loadScene(){
BorderPane root = new BorderPane();
textArea = new TextArea();
textArea.setEditable(false);
textArea.setPrefSize(300, 200);
root.setCenter(textArea);
BorderPane.setAlignment(root, Pos.CENTER);
tabs = new TabPane();
for (RemoteLog remoteLog : logs) {
Tab tab = new Tab(remoteLog.getName());
tab.setClosable(false);
tabs.getTabs().add(tab);
}
if(tabs.getTabs().size() > 0){
tabs.getSelectionModel().select(0);
selectLog(0);
}
tabs.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>(){
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
selectLog(newValue.intValue());
}
});
root.setTop(tabs);
return new Scene(root, 450, 300);
}
示例6: update
import javafx.scene.layout.BorderPane; //导入方法依赖的package包/类
private void update() {
if (!entries.isEmpty()) {
List<Entry<?>> workingList = new ArrayList<>(entries);
/*
* Individual calendars are already sorted, but now we are
* displaying entries from several calendars, so let's resort.
*/
Collections.sort(workingList);
for (Entry<?> entry : workingList) {
Calendar calendar = entry.getCalendar();
BorderPane borderPane = new BorderPane();
borderPane.getStyleClass().add("entry");
Label titleLabel = new Label(entry.getTitle());
BorderPane.setAlignment(titleLabel, Pos.CENTER_LEFT);
titleLabel.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
titleLabel.getStyleClass().add("title"); //$NON-NLS-1$
borderPane.setCenter(titleLabel);
Circle colorDot = new Circle();
colorDot.setRadius(2.5);
colorDot.getStyleClass().add(
calendar.getStyle() + "-icon-small"); //$NON-NLS-1$
titleLabel.setGraphic(colorDot);
Label timeLabel = new Label();
if (entry.isFullDay()) {
timeLabel.setText(Messages.getString("EntriesPane.FULL_DAY")); //$NON-NLS-1$
} else {
timeLabel.setText(DateTimeFormatter.ofLocalizedTime(
FormatStyle.SHORT).format(entry.getStartTime()));
}
borderPane.setRight(timeLabel);
timeLabel.getStyleClass().add("time"); //$NON-NLS-1$
BorderPane.setAlignment(timeLabel, Pos.CENTER_RIGHT);
getChildren().add(borderPane);
}
}
}