本文整理汇总了Java中javafx.scene.layout.GridPane.setVgap方法的典型用法代码示例。如果您正苦于以下问题:Java GridPane.setVgap方法的具体用法?Java GridPane.setVgap怎么用?Java GridPane.setVgap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.GridPane
的用法示例。
在下文中一共展示了GridPane.setVgap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void init() {
GridPane grid = new GridPane();
grid.setPadding(new Insets(GuiConstants.padding));
grid.setHgap(GuiConstants.padding);
grid.setVgap(GuiConstants.padding);
int row = 0;
row = addRow("Owner", ownerLabel, grid, row);
row = addRow("Name", nameLabel, grid, row);
row = addRow("Args", argLabel, grid, row);
row = addRow("Ret Type", retTypeLabel, grid, row);
row = addRow("Access", accessLabel, grid, row);
row = addRow("Signature", sigLabel, grid, row);
row = addRow("Parents", parentLabel, grid, row);
row = addRow("Children", childLabel, grid, row);
row = addRow("Refs In", refMethodInLabel, grid, row);
row = addRow("Refs Out", refMethodOutLabel, grid, row);
row = addRow("Fields read", refFieldReadLabel, grid, row);
row = addRow("Fields written", refFieldWriteLabel, grid, row);
row = addRow("Comment", mapCommentLabel, grid, row);
setContent(grid);
}
示例2: init
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void init() {
GridPane grid = new GridPane();
grid.setPadding(new Insets(GuiConstants.padding));
grid.setHgap(GuiConstants.padding);
grid.setVgap(GuiConstants.padding);
int row = 0;
row = addRow("Name", nameLabel, grid, row);
row = addRow("Access", accessLabel, grid, row);
row = addRow("Signature", sigLabel, grid, row);
row = addRow("Outer Class", outerLabel, grid, row);
row = addRow("Super Class", superLabel, grid, row);
row = addRow("Sub Classes", subLabel, grid, row);
row = addRow("Interfaces", ifaceLabel, grid, row);
row = addRow("Implementers", implLabel, grid, row);
row = addRow("Ref. Methods", refMethodLabel, grid, row);
row = addRow("Ref. Fields", refFieldLabel, grid, row);
row = addRow("Comment", mapCommentLabel, grid, row);
setContent(grid);
}
示例3: start
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
GridPane pane = new GridPane();
pane.setAlignment(Pos.CENTER);
pane.setMaxSize(800, 600);
pane.setPrefSize(800, 600);
pane.setManaged(true);
pane.setVgap(3);
pane.setHgap(3);
pane.addRow(1, new Label("Chess Master"));
ComboBox<RenderWrapper> renderCombo = new ComboBox<>();
renderCombo.getItems().addAll(new RenderWrapper(new BGFXRenderer()), new RenderWrapper(new OpenGLRenderer()));
ChessMaster.getPluginManager().getExtensions(Renderer.class).stream().map(RenderWrapper::new).forEach(renderCombo.getItems()::add);
pane.addRow(2, new Label("Select a renderer:"), renderCombo);
Button button = new Button("Start!");
button.setOnAction(event -> {
ChessMaster.getLogger().info("Using renderer: {} ({})", renderCombo.getSelectionModel().getSelectedItem().renderer.getName(), renderCombo.getSelectionModel().getSelectedItem().renderer.getClass().getName());
renderCombo.getSelectionModel().getSelectedItem().renderer.render();
primaryStage.close();
});
pane.addRow(3, button);
primaryStage.setScene(new Scene(pane));
primaryStage.show();
}
示例4: initializeGrid
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void initializeGrid() {
grid = new GridPane();
//grid.setAlignment(Pos.CENTER);
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(25, 25, 25, 25));
grid.setMaxSize(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE);
ColumnConstraints c1 = new ColumnConstraints();
c1.setFillWidth(true);
c1.setHgrow(Priority.ALWAYS);
grid.getColumnConstraints().addAll(new ColumnConstraints(), c1, new ColumnConstraints());
RowConstraints r2 = new RowConstraints();
r2.setFillHeight(true);
r2.setVgrow(Priority.ALWAYS);
}
示例5: disconnected
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public void disconnected() {
Dialog<ButtonType> popup = new Dialog<>();
popup.setTitle("Deconnexion");
ButtonType menu = new ButtonType("Menu Principal", ButtonBar.ButtonData.RIGHT);
popup.getDialogPane().getButtonTypes().add(menu);
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 150, 10, 10));
popup.getDialogPane().setContent(grid);
grid.add(new Label("Votre adversaire s'est déconnecté"), 0, 0);
Optional<ButtonType> result = popup.showAndWait();
if (result.get().getButtonData() == ButtonBar.ButtonData.RIGHT) {
refreshor.stop();
main.showMainMenu();
}
}
示例6: initializeInputControls
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private Node initializeInputControls(){
GridPane activatablecontrols = new GridPane();
activatablecontrols.setAlignment(Pos.CENTER);
activatablecontrols.setPadding(new Insets(10.0));
activatablecontrols.setVgap(10.0);
activatablecontrols.setHgap(10.0);
controlsActivatable_Pane = activatablecontrols;
GridPane inputcontrols = new GridPane();
inputcontrols.setAlignment(Pos.CENTER);
inputcontrols.setPadding(new Insets(10.0));
inputcontrols.setVgap(10.0);
inputcontrols.setHgap(15.0);
controlsInput_Pane = inputcontrols;
VBox estopBox = new VBox();
estopBox.setSpacing(5.0);
estopBox.setPadding(new Insets(10.0));
estopBox.setAlignment(Pos.CENTER);
estopBox.getChildren().addAll(Dashboard.getEmergencyStopControl().getRoot());
SplitPane controlsPane = new SplitPane();
controlsPane.setOrientation(Orientation.HORIZONTAL);
controlsPane.getItems().addAll(inputcontrols, activatablecontrols);
controlsPane.setMinSize(800.0, 150.0);
BorderPane root = new BorderPane();
root.setLeft(controlsPane);
root.setRight(estopBox);
return root;
}
示例7: ProgressIndicatorSample
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public ProgressIndicatorSample() {
super(400,400);
GridPane g = new GridPane();
ProgressIndicator p1 = new ProgressIndicator();
p1.setPrefSize(50, 50);
ProgressIndicator p2 = new ProgressIndicator();
p2.setPrefSize(50, 50);
p2.setProgress(0.25F);
ProgressIndicator p3 = new ProgressIndicator();
p3.setPrefSize(50, 50);
p3.setProgress(0.5F);
ProgressIndicator p4 = new ProgressIndicator();
p4.setPrefSize(50, 50);
p4.setProgress(1.0F);
g.add(p1, 1, 0);
g.add(p2, 0, 1);
g.add(p3, 1, 1);
g.add(p4, 2, 1);
g.setHgap(40);
g.setVgap(40);
getChildren().add(g);
}
示例8: start
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
//设置布局
GridPane grid = new GridPane();
grid.setAlignment(Pos.CENTER);
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(5, 5, 5, 5));
//增加一个现实密码的Label
Label label = new Label(StringResource.PASSWORD_MESSAGE);
label.setFont(new Font(19));
grid.add(label, 0, 1);
TextField textField = new TextField(Password.genRandomNum(8));
textField.setFont(new Font(19));
grid.add(textField,1,1);
//增加一个刷新按钮
Button button = new Button();
button.setText(StringResource.BTN_PASSWORD_REFRESH);
button.setOnAction(ActionEvent ->{
String newPassword = Password.genRandomNum(8);
System.out.println(StringResource.PASSWORD_MESSAGE + newPassword);
textField.setText(newPassword);
}
);
grid.add(button, 2, 1);
Scene scene = new Scene(grid, 535, 60);
primaryStage.setScene(scene);
primaryStage.setTitle(TITLE);
primaryStage.show();
}
示例9: start
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override public void start(Stage stage) {
stage.setTitle("TitledPane");
Scene scene = new Scene(new Group(), 450, 250);
TitledPane gridTitlePane = new TitledPane();
GridPane grid = new GridPane();
grid.setVgap(4);
grid.setPadding(new Insets(5, 5, 5, 5));
grid.add(new Label("First Name: "), 0, 0);
grid.add(new TextField(), 1, 0);
grid.add(new Label("Last Name: "), 0, 1);
grid.add(new TextField(), 1, 1);
grid.add(new Label("Email: "), 0, 2);
grid.add(new TextField(), 1, 2);
grid.add(new Label("Attachment: "), 0, 3);
grid.add(label,1, 3);
gridTitlePane.setText("Grid");
gridTitlePane.setContent(grid);
final Accordion accordion = new Accordion ();
for (int i = 0; i < imageNames.length; i++) {
images[i] =
new Image(getClass().getResourceAsStream(imageNames[i]+".jpg"));
pics[i] = new ImageView(images[i]);
tps[i] = new TitledPane(imageNames[i],pics[i]);
}
accordion.getPanes().addAll(tps);
accordion.expandedPaneProperty().addListener(
(ObservableValue<? extends TitledPane> ov, TitledPane old_val,
TitledPane new_val) -> {
if (new_val != null) {
label.setText(accordion.getExpandedPane().getText()
+ ".jpg");
}
});
HBox hbox = new HBox(10);
hbox.setPadding(new Insets(20, 0, 0, 20));
hbox.getChildren().setAll(gridTitlePane, accordion);
Group root = (Group)scene.getRoot();
root.getChildren().add(hbox);
stage.setScene(scene);
stage.show();
}
示例10: buildScreenPane
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private GridPane buildScreenPane( final Iterable<Object> buildsInScreen, final int nbColums, final int byColums ) {
final GridPane screenPane = new GridPane( );
screenPane.setHgap( GAP_SPACE );
screenPane.setVgap( GAP_SPACE );
screenPane.setPadding( new Insets( GAP_SPACE ) );
screenPane.setStyle( "-fx-background-color:black;" );
screenPane.setAlignment( Pos.CENTER );
final Iterable<List<Object>> partition = Iterables.paddedPartition( buildsInScreen, byColums );
for ( int x = 0; x < nbColums; x++ ) {
final List<Object> buildList = x < size( partition ) ? Iterables.get( partition, x ) : Collections.emptyList( );
for ( int y = 0; y < byColums; y++ ) {
if ( buildList.isEmpty( ) ) {
createEmptyTile( screenPane, x, y, nbColums, byColums );
continue;
}
final Object build = Iterables.get( buildList, y );
if ( build == null )
createEmptyTile( screenPane, x, y, nbColums, byColums );
else
createTileFromModel( screenPane, build, x, y, nbColums, byColums );
}
}
return screenPane;
}
示例11: MooConnectDialog
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public MooConnectDialog() {
super.setTitle("Connector");
super.setHeaderText("Set host and port to connect ..");
// Set buttons
ButtonType connectButtonType = new ButtonType("Connect", ButtonBar.ButtonData.OK_DONE);
super.getDialogPane().getButtonTypes().addAll(connectButtonType, ButtonType.CANCEL);
// Create text fields
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 150, 10, 10));
// Create labels and fields
TextField host = new TextField();
host.setPromptText("Host");
TextField port = new TextField();
port.setPromptText("Port");
grid.add(new Label("Host:"), 0, 0);
grid.add(host, 1, 0);
grid.add(new Label("Port:"), 0, 1);
grid.add(port, 1, 1);
// Disable/Enable button
Node loginButton = super.getDialogPane().lookupButton(connectButtonType);
loginButton.setDisable(true);
host.textProperty().addListener((observable, oldValue, newValue) -> {
loginButton.setDisable(newValue.trim().isEmpty());
});
super.getDialogPane().setContent(grid);
// Convert the result to a username-password-pair when the login button is clicked.
super.setResultConverter(dialogButton -> {
if (dialogButton == connectButtonType) {
return new Pair<>(host.getText(), port.getText());
}
return null;
});
}
示例12: AddServerDialog
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public AddServerDialog() {
super();
// Create the custom dialog.
this.setTitle("Add a server");
this.setHeaderText("Server informations");
// Set the button types.
ButtonType addButtonType = new ButtonType("Add server", ButtonData.OK_DONE);
this.getDialogPane().getButtonTypes().addAll(addButtonType, ButtonType.CANCEL);
// Create the username and password labels and fields.
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 150, 10, 10));
TextField serverName = new TextField();
TextField address = new TextField();
TextField port = new TextField();
PasswordField password = new PasswordField();
grid.add(new Label("Server name"), 0, 0);
grid.add(serverName, 1, 0);
grid.add(new Label("Address"), 0, 1);
grid.add(address, 1, 1);
grid.add(new Label("Port"), 0, 2);
grid.add(port, 1, 2);
grid.add(new Label("Password"), 0, 3);
grid.add(password, 1, 3);
port.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if (!newValue.matches("\\d*")) {
port.setText(newValue.replaceAll("[^\\d]", ""));
}
}
});
Node addButton = this.getDialogPane().lookupButton(addButtonType);
// Verify required inputs
// TODO not working
serverName.textProperty().addListener(new RequieredListener(addButton));
address.textProperty().addListener(new RequieredListener(addButton));
port.textProperty().addListener(new RequieredListener(addButton));
password.textProperty().addListener(new RequieredListener(addButton));
this.getDialogPane().setContent(grid);
// Convert the result to a username-password-pair when the login button is clicked.
this.setResultConverter(dialogButton -> {
try {
if (dialogButton == addButtonType) {
return new LocalServer(serverName.getText(), address.getText(), Integer.parseInt(port.getText()), password.getText());
}
} catch (NumberFormatException e) {
return null;
}
return null;
});
}
示例13: randomDeviceStatus
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public static Optional<TcpMsgResponseRandomDeviceStatus> randomDeviceStatus() throws NumberFormatException {
Dialog<TcpMsgResponseRandomDeviceStatus> dialog = new Dialog<>();
dialog.setTitle("随机状态信息");
dialog.setHeaderText("随机设备的状态信息");
ButtonType loginButtonType = new ButtonType("发送", ButtonBar.ButtonData.OK_DONE);
dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);
// Create the username and password labels and fields.
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 150, 10, 10));
TextField textFieldGroupId = new TextField();
textFieldGroupId.setPromptText("1 - 120");
TextField textFieldLength = new TextField();
textFieldLength.setPromptText("1 - 60_0000");
TextField textFieldStatus = new TextField();
textFieldStatus.setPromptText("1 - 6");
grid.add(new Label("组号: "), 0, 0);
grid.add(textFieldGroupId, 1, 0);
grid.add(new Label("范围: "), 0, 1);
grid.add(textFieldLength, 1, 1);
grid.addRow(2, new Label("状态码: "));
// grid.add(, 0, 2);
grid.add(textFieldStatus, 1, 2);
// Enable/Disable login button depending on whether a username was entered.
Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType);
loginButton.setDisable(true);
// Do some validation (using the Java 8 lambda syntax).
textFieldGroupId.textProperty().addListener((observable, oldValue, newValue) -> loginButton.setDisable(fieldisEmpty(textFieldGroupId, textFieldLength, textFieldStatus)));
textFieldLength.textProperty().addListener((observable, oldValue, newValue) -> loginButton.setDisable(fieldisEmpty(textFieldGroupId, textFieldLength, textFieldStatus)));
textFieldStatus.textProperty().addListener((observable, oldValue, newValue) -> loginButton.setDisable(fieldisEmpty(textFieldGroupId, textFieldLength, textFieldStatus)));
dialog.getDialogPane().setContent(grid);
// Request focus on the username field by default.
Platform.runLater(textFieldGroupId::requestFocus);
dialog.setResultConverter(dialogButton -> {
if (dialogButton == loginButtonType) {
try {
TcpMsgResponseRandomDeviceStatus tcpMsgResponseDeviceStatus = new TcpMsgResponseRandomDeviceStatus(Integer.parseInt(
textFieldGroupId.getText().trim()),
Integer.parseInt(textFieldStatus.getText().trim()),
Integer.parseInt(textFieldLength.getText().trim()));
return tcpMsgResponseDeviceStatus;
} catch (NumberFormatException e) {
System.out.println("空");
return new TcpMsgResponseRandomDeviceStatus(-1, -1, -1);
}
}
return null;
});
return dialog.showAndWait();
}
示例14: BanDialog
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public BanDialog(String playerName, String defaultReason, int defaultDuration) {
super();
// Create the custom dialog.
this.setTitle("Ban dialog");
this.setHeaderText("Do you really want to ban " + playerName + " ?");
// Set the button types.
ButtonType loginButtonType = new ButtonType("OK", ButtonData.OK_DONE);
this.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);
// Create the username and password labels and fields.
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 150, 10, 10));
TextField reason = new TextField();
reason.setText(defaultReason);
TextField duration = new TextField();
duration.setText(defaultDuration+"");
duration.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if (!newValue.matches("\\d*")) {
duration.setText(newValue.replaceAll("[^\\d]", ""));
}
}
});
grid.add(new Label("Reason"), 0, 0);
grid.add(reason, 1, 0);
grid.add(new Label("Duration, in days (0 = perm)"), 0, 1);
grid.add(duration, 1, 1);
Node loginButton = this.getDialogPane().lookupButton(loginButtonType);
reason.textProperty().addListener((observable, oldValue, newValue) -> {
loginButton.setDisable(newValue.trim().isEmpty());
});
this.getDialogPane().setContent(grid);
this.setResultConverter(dialogButton -> {
if (dialogButton == loginButtonType) {
return new Pair<>(reason.getText(), Integer.parseInt(duration.getText()));
}
return null;
});
}
示例15: ConfigDialogPane
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
/**
* <p>
* Creates the view for a config dialog.
* </p>
*
* <p>
* Text fields and checkboxes have to be initialized from a
* {@link edu.kit.iti.formal.stvs.model.config.GlobalConfig} model. For that, use the
* {@link ConfigDialogManager}.
* </p>
*/
public ConfigDialogPane() {
verificationTimeout = new PositiveIntegerInputField();
simulationTimeout = new PositiveIntegerInputField();
editorFontSize = new PositiveIntegerInputField();
editorFontFamily = new TextField();
showLineNumbers = new CheckBox();
uiLanguage = new ComboBox<>();
nuxmvFilename = new FileSelectionField();
z3Path = new FileSelectionField();
getetaCommand = new TextField();
maxLineRollout = new PositiveIntegerInputField();
okButtonType = new ButtonType("Save", ButtonBar.ButtonData.OK_DONE);
this.getButtonTypes().addAll(okButtonType, ButtonType.CANCEL);
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 10, 10, 10));
grid.add(new Label("Verification Timeout"), 0, 0);
grid.add(verificationTimeout, 1, 0);
grid.add(new Label("Simulation Timeout"), 0, 1);
grid.add(simulationTimeout, 1, 1);
grid.add(new Label("Editor Fontsize"), 0, 2);
grid.add(editorFontSize, 1, 2);
grid.add(new Label("Editor Font Family"), 0, 3);
grid.add(editorFontFamily, 1, 3);
grid.add(new Label("Show Line Numbers"), 0, 4);
grid.add(showLineNumbers, 1, 4);
grid.add(new Label("User Interface Language"), 0, 5);
grid.add(uiLanguage, 1, 5);
grid.add(new Label("Path to NuXmv Executable"), 0, 6);
grid.add(nuxmvFilename, 1, 6);
grid.add(new Label("Path to Z3"), 0, 7);
grid.add(z3Path, 1, 7);
grid.add(new Label("GeTeTa Command"), 0, 9);
grid.add(getetaCommand, 1, 9);
Text getetaCommandDescription =
new Text("Use ${code} and ${spec} for code and specification" + " filename substitution.");
getetaCommandDescription.setStyle("-fx-font-style: italic");
grid.add(getetaCommandDescription, 0, 10, 2, 1);
grid.add(new Label("Maximum Number of Rollouts per Line"), 0, 11);
grid.add(maxLineRollout, 1, 11);
this.setContent(grid);
ViewUtils.setupClass(this);
}