本文整理匯總了Java中javafx.scene.layout.GridPane.addRow方法的典型用法代碼示例。如果您正苦於以下問題:Java GridPane.addRow方法的具體用法?Java GridPane.addRow怎麽用?Java GridPane.addRow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.layout.GridPane
的用法示例。
在下文中一共展示了GridPane.addRow方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupNotConnectedPane
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
public void setupNotConnectedPane() {
GridPane pane = new GridPane();
pane.setVgap(15);
notConnectedPane = pane;
notConnectedPane.setPadding(new Insets(15, 15, 15, 15));
Label l = new Label("Not connected");
connectButton = new Button("Connect", AssetsLoader.getIcon("connect.png"));
editButton = new Button("Edit server informations...", AssetsLoader.getIcon("edit.png"));
connectButton.setOnAction(this::connectButtonAction);
editButton.setOnAction(this::editButtonAction);
piConnect = new ProgressIndicator();
piConnect.setVisible(false);
pane.addRow(0, connectButton);
pane.addRow(1, editButton);
pane.addRow(2, piConnect);
}
示例2: 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();
}
示例3: create
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
private void create() {
try {
BorderPane root = FXMLLoader.load(getClass().getResource("/startup/index.fxml"));
scene = new Scene(root, 640, 480);
primaryStage.setScene(scene);
primaryStage.centerOnScreen();
primaryStage.show();
loadButton = (Button) scene.lookup("#loadButton");
exitButton = (Button) scene.lookup("#exitButton");
createButton = (Button) scene.lookup("#createButton");
} catch(Exception e) {
e.printStackTrace();
}
GridPane grid = (GridPane) scene.lookup("#grid");
grid.addRow(0,
new TemplateView(store, new BlankTemplate()),
new TemplateView(store, new Template1()),
new TemplateView(store, new Template2())
);
grid.addRow(1,
new TemplateView(store, new Template3()),
new TemplateView(store, new Template4()),
new TemplateView(store, new Template5())
);
}
示例4: getTitleNodde
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
@Override
protected Node getTitleNodde() {
GridPane result = new GridPane();
result.setHgap(5);
result.addRow(0, AssetsLoader.getIcon("wsp_icon.png"), getConnectionStatusIcon(),
new Label(wspServer.getName()));
return result;
}
示例5: EditOrganizationStage
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
public EditOrganizationStage(Organization organization, OrganizationManagerStage oms) {
super();
setTitle("Manage " + organization.getName());
serverPane = new ServerPane(organization, oms);
memberPane = new MemberPane(organization, this);
GridPane mainGP = new GridPane();
mainGP.setPadding(new Insets(15));
mainGP.addRow(0, serverPane, memberPane);
mainGP.setHgap(15);
mainPane = mainGP;
Scene scene = new Scene(mainPane);
this.setScene(scene);
}
示例6: MemberPane
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
public MemberPane(Organization organization, EditOrganizationStage oms) {
super();
this.organization = organization;
this.eos = oms;
members = FXCollections.observableArrayList();
forceUpdateMemberList();
memberTable = new TableView<>(members);
TableColumn<MemberView, String> nameCol = new TableColumn<>("Name");
nameCol.setCellValueFactory(new PropertyValueFactory<>("username"));
ColumnConstraints cc = new ColumnConstraints();
cc.setPercentWidth(100);
memberTable.getColumns().add(nameCol);
memberTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
buttonPane = new GridPane();
buttonPane.setPadding(new Insets(10, 0, 0, 0));
buttonPane.setHgap(5);
addMember = new Button("Add Member...");
removeMember = new Button("Remove selected");
transfertOwnership = new Button("Transfert Ownership");
buttonPane.addRow(0, addMember, removeMember, transfertOwnership);
addMember.setOnAction(this::addMemberAction);
removeMember.setOnAction(this::removeMemberAction);
transfertOwnership.setOnAction(this::transferOwnershipAction);
removeMember.setDisable(true);
transfertOwnership.setDisable(true);
Label title = new Label("Members :");
title.setPadding(new Insets(0, 0, 10, 0));
setTop(title);
setCenter(memberTable);
setBottom(buttonPane);
memberTable.getSelectionModel().selectedItemProperty().addListener((obs, oldSelection, newSelection) -> {
if (newSelection == null || newSelection.isYou()) {
removeMember.setDisable(true);
transfertOwnership.setDisable(true);
} else {
removeMember.setDisable(false);
transfertOwnership.setDisable(false);
}
});
}
示例7: ServerPane
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
public ServerPane(Organization organization, OrganizationManagerStage oms) {
super();
this.organization = organization;
this.oms = oms;
servers = FXCollections.observableArrayList();
forceUpdateServerList();
serverTable = new TableView<>(servers);
serverTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
TableColumn<ServerView, String> nameCol = new TableColumn<>("Name");
TableColumn<ServerView, String> addressCol = new TableColumn<>("Address");
nameCol.setCellValueFactory(new PropertyValueFactory<>("name"));
addressCol.setCellValueFactory(new PropertyValueFactory<>("address"));
serverTable.getColumns().add(nameCol);
serverTable.getColumns().add(addressCol);
buttonPane = new GridPane();
buttonPane.setPadding(new Insets(10, 0, 0, 0));
buttonPane.setHgap(5);
addButton = new Button("Add Server...");
editButton = new Button("Edit selected...");
removeButton = new Button("Remove selected");
addButton.setOnAction(this::addServerAction);
editButton.setOnAction(this::editServerAction);
removeButton.setOnAction(this::removeServerAction);
editButton.setDisable(true);
removeButton.setDisable(true);
buttonPane.addRow(0, addButton, editButton, removeButton);
Label title = new Label("Servers :");
title.setPadding(new Insets(0, 0, 10, 0));
setTop(title);
setCenter(serverTable);
setBottom(buttonPane);
serverTable.getSelectionModel().selectedItemProperty().addListener((obs, oldSelection, newSelection) -> {
if (newSelection == null) {
editButton.setDisable(true);
removeButton.setDisable(true);
} else {
editButton.setDisable(false);
removeButton.setDisable(false);
}
});
}
示例8: AddMemberDialog
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
public AddMemberDialog(Organization organization) {
super();
this.organization = organization;
this.setTitle("Add a member");
this.setHeaderText("Search user");
ButtonType addButtonType = new ButtonType("Add selected", ButtonData.OK_DONE);
this.getDialogPane().getButtonTypes().addAll(addButtonType, ButtonType.CANCEL);
BorderPane mainPane = new BorderPane();
GridPane queryPane = new GridPane();
queryField = new TextField();
Button searchButton = new Button("Search");
searchButton.setOnAction(this::searchAction);
queryField.setOnAction(this::searchAction);
searchList = FXCollections.observableArrayList();
TableView<MemberView> searchResult = new TableView<>(searchList);
searchResult.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
TableColumn<MemberView, String> nameCol = new TableColumn<>("Name");
nameCol.setCellValueFactory(new PropertyValueFactory<>("username"));
searchResult.getColumns().add(nameCol);
queryPane.addRow(0, queryField, searchButton);
queryPane.setHgap(5);
resultCount = new Label();
queryPane.setPadding(new Insets(0, 0, 10, 0));
resultCount.setPadding(new Insets(10, 0, 0, 0));
mainPane.setTop(queryPane);
mainPane.setCenter(searchResult);
mainPane.setBottom(resultCount);
this.getDialogPane().setContent(mainPane);
this.setResultConverter(dialogButton -> {
if (dialogButton == addButtonType) {
Member result = searchResult.selectionModelProperty().get().getSelectedItem().getMember();
Alert conf = new Alert(AlertType.CONFIRMATION, "Do you really want to add " + result.getUsername() + " to your organization ?");
Optional<ButtonType> answer = conf.showAndWait();
if (answer.isPresent() && answer.get() == ButtonType.OK)
return result;
else
return null;
}
return null;
});
}
示例9: ResponseDeviceStatusResult
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
public static Optional<TcpMsgResponseDeviceStatus> ResponseDeviceStatusResult() throws NumberFormatException {
Dialog<TcpMsgResponseDeviceStatus> 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 textFieldDeviceId = new TextField();
textFieldDeviceId.setPromptText("1 - 100");
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(textFieldDeviceId, 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, textFieldDeviceId, textFieldStatus)));
textFieldDeviceId.textProperty().addListener((observable, oldValue, newValue) -> loginButton.setDisable(fieldisEmpty(textFieldGroupId, textFieldDeviceId, textFieldStatus)));
textFieldStatus.textProperty().addListener((observable, oldValue, newValue) -> loginButton.setDisable(fieldisEmpty(textFieldGroupId, textFieldDeviceId, textFieldStatus)));
dialog.getDialogPane().setContent(grid);
// Request focus on the username field by default.
Platform.runLater(textFieldGroupId::requestFocus);
dialog.setResultConverter(dialogButton -> {
if (dialogButton == loginButtonType) {
try {
TcpMsgResponseDeviceStatus tcpMsgResponseDeviceStatus = new TcpMsgResponseDeviceStatus(Integer.parseInt(
textFieldGroupId.getText().trim()),
Integer.parseInt(textFieldDeviceId.getText().trim()),
Integer.parseInt(textFieldStatus.getText().trim()));
return tcpMsgResponseDeviceStatus;
} catch (NumberFormatException e) {
System.out.println("空");
return new TcpMsgResponseDeviceStatus(-1, -1, -1);
}
}
return null;
});
return dialog.showAndWait();
}
示例10: 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();
}
示例11: addSpecialInstrumentationItem
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
public static void addSpecialInstrumentationItem(int id, KeyValuePair sectionType, KeyValuePair specialInstrumentation, int specialInstrumentationCount,
List<SpecialInstrumentationEntity> specialInstrumentationEntityList, GridPane specialInstrumentationContent,
ComboBox<KeyValuePair> specialInstrumentationSectionGroupComboBox, NumberField specialInstrumentationNumberField) {
GridPane tmpPane = new GridPane();
ComboBox<KeyValuePair> sectionTypeComboBox = new ComboBox<>(specialInstrumentationSectionGroupComboBox.getItems());
sectionTypeComboBox.getSelectionModel().select(sectionType);
sectionTypeComboBox.setMaxWidth(100);
sectionTypeComboBox.setMinWidth(100);
tmpPane.addColumn(0, sectionTypeComboBox);
ComboBox<KeyValuePair> specialInstrumentationComboBox = new ComboBox<>(TeamF.client.helper.gui.InstrumentationHelper.getInstrumentTypes((SectionGroupType) sectionTypeComboBox.getSelectionModel().getSelectedItem().getValue()));
specialInstrumentationComboBox.getSelectionModel().selectFirst();
specialInstrumentationComboBox.setMaxWidth(100);
specialInstrumentationComboBox.setMinWidth(100);
tmpPane.addColumn(1, specialInstrumentationComboBox);
NumberField tmpNumberField = null;
try {
tmpNumberField = new NumberField(specialInstrumentationCount, specialInstrumentationNumberField.getMinValue().intValue(), specialInstrumentationNumberField.getMaxValue().intValue());
tmpPane.addColumn(2, tmpNumberField);
tmpNumberField.setMaxWidth(60);
tmpNumberField.setStyle("-fx-opacity: 1");
} catch (NumberRangeException e) {
}
sectionTypeComboBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null) {
if(((TeamF.client.helper.gui.InstrumentationHelper.getInstrumentTypes((SectionGroupType) sectionTypeComboBox.getSelectionModel().
getSelectedItem().getValue())))!=null) {
specialInstrumentationComboBox.setItems((TeamF.client.helper.gui.InstrumentationHelper.getInstrumentTypes((SectionGroupType) sectionTypeComboBox.getSelectionModel().
getSelectedItem().getValue())));
specialInstrumentationComboBox.getSelectionModel().selectFirst();
}
}
});
Button tmpButton = new Button("-");
tmpPane.addColumn(3, tmpButton);
specialInstrumentationContent.addRow(specialInstrumentationEntityList.size()+1, tmpPane);
specialInstrumentationContent.setColumnSpan(tmpPane, 4);
SpecialInstrumentationEntity specialInstrumentationEntity = new SpecialInstrumentationEntity(id, sectionTypeComboBox, specialInstrumentationComboBox, tmpNumberField, tmpPane);
tmpButton.setOnAction(e -> removeSpecialInstrumentationItem(specialInstrumentationEntity, specialInstrumentationContent, specialInstrumentationEntityList));
specialInstrumentationEntityList.add(specialInstrumentationEntity);
}
示例12: getTitleNodde
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
protected Node getTitleNodde() {
GridPane result = new GridPane();
result.setHgap(5);
result.addRow(0, getConnectionStatusIcon(), new Label(server.getName()));
return result;
}
示例13: ConnectToWSPDialog
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
public ConnectToWSPDialog(WebServiceProvider wsp) {
super();
// Create the custom dialog.
this.setTitle("Sign in");
this.setHeaderText("WSP informations");
// Set the button types.
ButtonType addButtonType = new ButtonType("Sign in", ButtonData.OK_DONE);
this.getDialogPane().getButtonTypes().addAll(addButtonType, ButtonType.CANCEL);
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 150, 10, 10));
Button openDiscordUrlButton = new Button("Sign in via Discord");
TextField codeField = new TextField();
openDiscordUrlButton.setOnAction((event) -> {
try {
App.getCurrentInstance().getHostServices().showDocument(wsp.getDiscordAuthURL());
} catch (MalformedURLException e) {
Alert a = ErrorUtils.getAlertFromException(e);
a.show();
e.printStackTrace();
}
});
grid.addRow(0, openDiscordUrlButton);
grid.addRow(1, new Label("Authorization code"), codeField);
Node okButton = this.getDialogPane().lookupButton(addButtonType);
// Verify required inputs
// TODO not working
codeField.textProperty().addListener(new RequieredListener(okButton));
this.getDialogPane().setContent(grid);
this.setResultConverter(dialogButton -> {
if (dialogButton.getButtonData().equals(ButtonData.OK_DONE)) {
return codeField.getText();
}
return null;
});
}