本文整理汇总了Java中javafx.scene.layout.VBox.setMargin方法的典型用法代码示例。如果您正苦于以下问题:Java VBox.setMargin方法的具体用法?Java VBox.setMargin怎么用?Java VBox.setMargin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.VBox
的用法示例。
在下文中一共展示了VBox.setMargin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBrowserField
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private HBox createBrowserField() {
HBox browseFieldBox = new HBox(5);
dirField = new TextField();
dirField.setId("DirectoryField");
dirField.textProperty().addListener((observable, oldValue, newValue) -> updateOKButton());
HBox.setHgrow(dirField, Priority.ALWAYS);
Button browseButton = FXUIUtils.createButton("browse", "Browse directory", true, "Browse");
FileSelectionHandler browserListener;
String fileType = fileSelectionInfo.getFileType();
if (fileType != null) {
browserListener = new FileSelectionHandler(this,
new ExtensionFilter(fileType, Arrays.asList(fileSelectionInfo.getExtensionFilters())), this, null,
fileSelectionInfo.getTitle());
} else {
browserListener = new FileSelectionHandler(this, null, this, null, fileSelectionInfo.getTitle());
browserListener.setMode(FileSelectionHandler.DIRECTORY_CHOOSER);
}
browserListener.setPreviousDir(new File(System.getProperty(Constants.PROP_PROJECT_DIR, ProjectLayout.projectDir)));
browseButton.setOnAction(browserListener);
Label label = createLabel("Name: ");
label.setMinWidth(Region.USE_PREF_SIZE);
label.setId("FileSelectedLabel");
browseFieldBox.getChildren().addAll(label, dirField, browseButton);
VBox.setMargin(browseFieldBox, new Insets(5, 5, 5, 5));
return browseFieldBox;
}
示例2: constructContainer
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public Parent constructContainer () {
this.getWindow().setTitle(Globals.appTitle+"Hilfe"+Globals.appVersion);
this.getWindow().setResizable(false);
impressumBtn.setOnAction(e -> getFXController().showView("impressumview"));
quizletBtn.setOnAction(e -> getFXController().showView("quizletview"));
anleitungBtn.setOnAction(e -> getFXController().showView("manualview"));
indexBtn.setOnAction(e -> getFXController().showView("troubleshootview"));
logBtn.setOnAction(e -> getFXController().showView("logview"));
tempVBox.setId("helpbox");
tempVBox.setPadding(new Insets(10));
tempVBox.setSpacing(5);
tempVBox.setAlignment(Pos.CENTER);
tempVBox.getChildren().addAll(impressumBtn, quizletBtn, anleitungBtn, indexBtn, logBtn, closeBtn);
VBox.setMargin(impressumBtn, new Insets(50,0,0,0));
return tempVBox;
}
示例3: buildVBox
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private void buildVBox() {
ObservableList<Node> children = getChildren();
if (mode.isSelectable()) {
children.addAll(createNameField(), createDescriptionField());
} else {
if (checkList.getName().equals("")) {
children.add(addSeparator("<No Name>"));
} else {
children.add(addSeparator(checkList.getName()));
}
GridPane gridPane = new GridPane();
String text = checkList.getDescription();
if (text.equals("")) {
text = "<No Description>";
}
StringTokenizer tok = new StringTokenizer(text, "\n");
int rowIndex = 0;
while (tok.hasMoreTokens()) {
Label label = new Label(tok.nextToken());
gridPane.add(label, 0, rowIndex++);
}
children.add(gridPane);
}
Iterator<CheckList.CheckListItem> items = checkList.getItems();
while (items.hasNext()) {
VBox vbox = items.next().getVbox(mode.isSelectable(), mode.isEditable());
HBox.setHgrow(vbox, Priority.ALWAYS);
children.add(vbox);
if (mode.isSelectable()) {
VBox.setMargin(vbox, new Insets(5, 10, 0, 5));
}
}
}
示例4: buildSide
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public void buildSide() {
//right side's components FormButton
txtField.setPadding(new Insets(20, 20, 20, 20));
label.setPadding(new Insets(20, 20, 20, 20));
btn.setPadding(new Insets(20, 20, 20, 20));
this.getChildren().addAll(txtField, label, btn);
this.setAlignment(Pos.CENTER);
VBox.setMargin(txtField, new Insets(30, 30, 30, 30));
VBox.setMargin(label, new Insets(30, 30, 30, 30));
VBox.setMargin(btn, new Insets(30, 30, 30, 30));
}
示例5: createDescriptionField
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private VBox createDescriptionField() {
VBox descriptionFieldBox = new VBox();
TextArea descriptionArea = new TextArea();
descriptionArea.setPrefRowCount(4);
descriptionArea.textProperty().addListener((observable, oldValue, newValue) -> {
fireContentChanged();
checkList.setDescription(descriptionArea.getText());
});
descriptionArea.setEditable(mode.isSelectable());
descriptionFieldBox.getChildren().addAll(new Label("Description"), descriptionArea);
HBox.setHgrow(descriptionArea, Priority.ALWAYS);
VBox.setMargin(descriptionFieldBox, new Insets(5, 10, 5, 5));
descriptionArea.setText(checkList.getDescription());
HBox.setHgrow(descriptionArea, Priority.ALWAYS);
HBox.setHgrow(descriptionFieldBox, Priority.ALWAYS);
return descriptionFieldBox;
}
示例6: addHeader
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public void addHeader(String label) {
Header header = checkList.createHeader(label);
VBox headerBox = header.getVbox(mode.isSelectable(), mode.isEditable());
HBox.setHgrow(headerBox, Priority.ALWAYS);
VBox.setMargin(headerBox, new Insets(5, 10, 0, 5));
getChildren().add(headerBox);
}
示例7: addCheckListItem
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public void addCheckListItem(String label) {
FailureNote failureNote = checkList.createFailureNote(label);
VBox failureNoteBox = failureNote.getVbox(mode.isSelectable(), mode.isEditable());
HBox.setHgrow(failureNoteBox, Priority.ALWAYS);
VBox.setMargin(failureNoteBox, new Insets(5, 10, 3, 5));
getChildren().add(failureNoteBox);
}
示例8: addTextArea
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public void addTextArea(String label) {
CommentBox commentBox = checkList.createCommentBox(label);
VBox vBox = commentBox.getVbox(mode.isSelectable(), mode.isEditable());
HBox.setHgrow(vBox, Priority.ALWAYS);
VBox.setMargin(vBox, new Insets(5, 10, 3, 5));
getChildren().add(vBox);
}
示例9: makeLayout
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
protected void makeLayout() {
this.setWidth(800);
tabs.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
tabs.setTabMinWidth(120);
VBox.setVgrow(tabs, Priority.ALWAYS);
container.setAlignment(Pos.CENTER_RIGHT);
VBox.setMargin(closeBtn, new Insets(20));
container.getChildren().addAll(tabs, closeBtn);
}
示例10: taskSelectionWindow
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
/**
* Creates a Task selection window.
*
* @param list List of Tasks to be put into the window.
* @return A list of selected Tasks
*/
protected static ObservableList<Task> taskSelectionWindow(ObservableList<Task> list)
{
// Layout:
VBox layout = new VBox();
layout.setSpacing(10);
layout.setAlignment(Pos.BOTTOM_RIGHT);
// =================
// Tasks columns:
TableColumn<Task, String> nameColumn = new TableColumn<>("Task");
nameColumn.setCellValueFactory(new PropertyValueFactory<>("name"));
TableColumn<Task, String> assignmentColumn = new TableColumn<>("Assignments");
assignmentColumn.setCellValueFactory(new PropertyValueFactory("assignments")
{
@Override public ObservableValue call(TableColumn.CellDataFeatures param)
{
SimpleStringProperty value = new SimpleStringProperty("");
for (Assignment a : ((Task) param.getValue()).getAssignmentReferences())
value.set(value.getValue() + a.getName() + "\n");
return value;
}
});
TableColumn<Task, String> deadlineColumn = new TableColumn<>("Deadline");
deadlineColumn.setCellValueFactory(new PropertyValueFactory<>("deadline"));
deadlineColumn.setStyle("-fx-alignment: CENTER-RIGHT;");
// =================
// Create a table:
TableView<Task> tasks = new TableView<>();
tasks.setItems(list);
tasks.getColumns().addAll(nameColumn, assignmentColumn, deadlineColumn);
tasks.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
// =================
// Table attributes:
tasks.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
GridPane.setHgrow(tasks, Priority.ALWAYS);
GridPane.setVgrow(tasks, Priority.ALWAYS);
// =================
// Set click event:
tasks.setRowFactory(TaskController::taskRowFactory);
// =================
// Button:
Button OK = new Button("OK");
OK.setOnAction(e -> {
Stage current = (Stage) OK.getScene().getWindow();
current.close();
});
VBox.setMargin(OK, new Insets(5));
OK.setDefaultButton(true);
// =================
layout.getChildren().addAll(tasks, OK);
// Set a new scene:
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.setScene(new Scene(layout, 550, 300));
stage.setTitle("Select dependencies");
stage.getIcons().add(new Image("file:icon.png"));
stage.showAndWait();
// =================
return tasks.getSelectionModel().getSelectedItems();
}
示例11: initLooks
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private void initLooks(){
rectangle.setStrokeWidth(STROKE_WIDTH);
rectangle.setFill(Color.LIGHTSKYBLUE);
rectangle.setStroke(Color.BLACK);
StackPane.setAlignment(title, Pos.CENTER);
VBox.setMargin(values, new Insets(5,0,0,5));
}
示例12: createErrorAlert
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
/**
* Create a dialog for showing the exception.
*/
@FXThread
private static @NotNull Alert createErrorAlert(@NotNull final Exception e, @Nullable final String localizedMessage,
@Nullable final String stackTrace) {
final TextArea textArea = new TextArea(stackTrace);
textArea.setEditable(false);
textArea.setWrapText(true);
VBox.setMargin(textArea, new Insets(2, 5, 2, 5));
final Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setHeaderText(StringUtils.isEmpty(localizedMessage) ? e.getClass().getSimpleName() : localizedMessage);
final DialogPane dialogPane = alert.getDialogPane();
dialogPane.setExpandableContent(new VBox(textArea));
dialogPane.expandedProperty().addListener((observable, oldValue, newValue) -> {
if (newValue == Boolean.TRUE) {
alert.setWidth(800);
alert.setHeight(400);
} else {
alert.setWidth(500);
alert.setHeight(220);
}
});
return alert;
}
示例13: addDrawerVBox
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
/**
* Generates VBox with a drawer menu in it.
* @return generated VBox
*/
//TODO Once files gonna be generated, remove hard-coded stuff.
public VBox addDrawerVBox() {
leftDrawer.setDefaultDrawerSize(300);
leftDrawer.setOverLayVisible(false);
leftDrawer.setSidePane(drawerPane);
leftDrawer.setPrefSize(0,0);
JFXButton profileButton = new JFXButton("View Profile");
JFXButton button1 = new JFXButton("View Auctions");
JFXButton button2 = new JFXButton("View Favourites");
JFXButton searchButton = new JFXButton("Search profiles");
VBox vBox = new VBox();
vBox.setStyle("-fx-background-color: #E91E63; -fx-padding: -10;");
vBox.setPadding(new Insets(15, 12, 15, 0));
vBox.setSpacing(10);
button1.setMaxWidth(10000);
searchButton.setMaxWidth(10000);
button1.addEventHandler(MOUSE_CLICKED, e -> {
GUIController
.getPrimaryStage()
.setScene(new Scene(new ArtworkContainer(dc,curProfile,loggedInProfile)
.getPane(), getPane()
.getWidth(), getPane()
.getHeight())
);
});
button2.setMaxWidth(10000);
button2.addEventHandler(MOUSE_CLICKED, e -> {
GUIController
.getPrimaryStage()
.setScene(new Scene(new FavouriteProfileScene(dc,loggedInProfile,loggedInProfile)
.getPane(), getPane()
.getWidth(), getPane()
.getHeight())
);
});
profileButton.addEventHandler(MOUSE_CLICKED, e -> {
GUIController
.getPrimaryStage()
.setScene(new Scene(new ProfileScene(dc,loggedInProfile,loggedInProfile)
.getPane(), getPane()
.getWidth(), getPane()
.getHeight())
);
});
searchButton.addEventHandler(MOUSE_CLICKED, e -> {
GUIController
.getPrimaryStage()
.setScene(new Scene(new SearchScene(dc,curProfile,loggedInProfile)
.getPane(), getPane()
.getWidth(), getPane()
.getHeight()));
});
vBox.setMargin(profileButton, new Insets(25, 25, 1, 25));
vBox.setMargin(button1, new Insets(1, 25, 1, 25));
vBox.setMargin(button2, new Insets(1, 25, 25, 25));
vBox.setMargin(searchButton,new Insets(1,25,25,25));
button2.setMaxWidth(10000);
profileButton.setMaxWidth(10000);
vBox
.getChildren()
.addAll(profileButton,button1, button2, searchButton
);
return vBox;
}
示例14: setupStatesPane
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private Pane setupStatesPane() {
final Label titleLabel = new Label("All execution states (0)");
nbStates.addListener((v, o, n) -> {
String s = "All execution states (" + n.intValue() + ")";
Platform.runLater(() -> {
titleLabel.setText(s);
titleLabel.setContentDisplay(ContentDisplay.RIGHT);
final ImageView nodeGraphic = new ImageView();
nodeGraphic.setImage(playGraphic);
titleLabel.setGraphic(nodeGraphic);
isInReplayMode.addListener((val, old, neu) -> {
if (old != neu) {
if (neu) {
nodeGraphic.setImage(replayGraphic);
} else {
nodeGraphic.setImage(playGraphic);
}
}
});
});
});
titleLabel.setFont(statesFont);
VBox.setMargin(titleLabel, HALF_MARGIN_INSETS);
titleLabel.setAlignment(Pos.CENTER);
final ScrollBar scrollBar = new ScrollBar();
scrollBar.setVisibleAmount(1);
scrollBar.setBlockIncrement(10);
scrollBar.setMin(0);
final IntegerBinding statesRange = visibleStatesRange.subtract(1);
scrollBar.disableProperty().bind(statesRange.lessThanOrEqualTo(0));
scrollBar.maxProperty().bind(statesRange);
scrollBar.valueProperty().addListener((v, o, n) -> {
if (o.intValue() != n.intValue() && n.intValue() != currentState.intValue()) {
currentState.set(n.intValue());
}
});
currentState.addListener((v, o, n) -> {
if (o.intValue() != n.intValue() && n.intValue() != scrollBar.valueProperty().intValue()) {
scrollBar.setValue(n.intValue());
}
});
final HBox hBox = new HBox();
final Polygon arrow = new Polygon(2.5, 10, 10, 5, 2.5, 0);
HBox.setMargin(arrow, HALF_MARGIN_INSETS);
final Label toggleValuesLabel = new Label("Timeline for dynamic information ");
toggleValuesLabel.setFont(statesFont);
hBox.setAlignment(Pos.CENTER_LEFT);
hBox.getChildren().addAll(arrow, toggleValuesLabel);
hBox.setCursor(Cursor.HAND);
hBox.setOnMouseClicked((e) -> {
if (bodyScrollPane.isVisible()) {
bodyScrollPane.setVisible(false);
arrow.setRotate(0);
} else {
bodyScrollPane.setVisible(true);
arrow.setRotate(90);
}
});
VBox.setMargin(hBox, HALF_MARGIN_INSETS);
headerPane.getChildren().addAll(scrollBar, titleLabel, statesPane, hBox);
VBox.setMargin(statesPane, MARGIN_INSETS);
return headerPane;
}
示例15: setupValuePane
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private Pane setupValuePane(Dimension<?> dimension, Label titleLabel, Pane contentPane) {
final HBox titlePane = new HBox();
final VBox valueVBox = new VBox();
final Node backValueGraphicNode = new ImageView(backValueGraphic);
final double buttonScale = 0.66;
backValueGraphicNode.setScaleX(1 / buttonScale);
backValueGraphicNode.setScaleY(1 / buttonScale);
final Button backValue = new Button("", backValueGraphicNode);
backValue.setOnAction((e) -> {
traceExplorer.backValue(dimension);
});
backValue.setScaleX(buttonScale);
backValue.setScaleY(buttonScale);
backValue.setDisable(!traceExplorer.canBackValue(dimension));
final Node stepValueGraphicNode = new ImageView(stepValueGraphic);
stepValueGraphicNode.setScaleX(1 / buttonScale);
stepValueGraphicNode.setScaleY(1 / buttonScale);
final Button stepValue = new Button("", stepValueGraphicNode);
stepValue.setOnAction((e) -> {
traceExplorer.stepValue(dimension);
});
stepValue.setDisable(!traceExplorer.canStepValue(dimension));
stepValue.setScaleX(buttonScale);
stepValue.setScaleY(buttonScale);
titlePane.setAlignment(Pos.CENTER_LEFT);
VBox.setMargin(titlePane, HALF_MARGIN_INSETS);
VBox.setMargin(contentPane, MARGIN_INSETS);
final CheckBox showValueCheckBox = new CheckBox();
showValueCheckBox.setScaleX(buttonScale);
showValueCheckBox.setScaleY(buttonScale);
boolean hide = traceExtractor.isDimensionIgnored(dimension);
if (hide) {
showValueCheckBox.setSelected(false);
} else {
showValueCheckBox.setSelected(true);
}
BooleanProperty sel = showValueCheckBox.selectedProperty();
backValue.visibleProperty().bind(sel);
stepValue.visibleProperty().bind(sel);
sel.addListener((v, o, n) -> {
if (o != n) {
traceExtractor.ignoreDimension(dimension, !n);
if (n) {
valueVBox.getChildren().add(contentPane);
} else {
valueVBox.getChildren().remove(contentPane);
}
sortValueLines();
}
});
titlePane.getChildren().addAll(showValueCheckBox, titleLabel, backValue, stepValue);
valueVBox.getChildren().add(titlePane);
if (!hide) {
valueVBox.getChildren().add(contentPane);
}
valuesLines.getChildren().add(valueVBox);
valueVBox.setUserData(dimension);
titleLabel.minWidthProperty().bind(valueTitleWidth);
titleLabel.widthProperty().addListener((v, o, n) -> {
if (n.doubleValue() > valueTitleWidth.get()) {
valueTitleWidth.set(n.doubleValue());
}
});
if (titleLabel.widthProperty().doubleValue() > valueTitleWidth.get()) {
valueTitleWidth.set(titleLabel.widthProperty().doubleValue());
}
return valueVBox;
}