本文整理匯總了Java中javafx.scene.layout.GridPane.setColumnIndex方法的典型用法代碼示例。如果您正苦於以下問題:Java GridPane.setColumnIndex方法的具體用法?Java GridPane.setColumnIndex怎麽用?Java GridPane.setColumnIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.layout.GridPane
的用法示例。
在下文中一共展示了GridPane.setColumnIndex方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Actions
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
public Actions() {
columnConstraints = new ColumnConstraints();
columnConstraints0 = new ColumnConstraints();
columnConstraints1 = new ColumnConstraints();
rowConstraints = new RowConstraints();
button = new Button();
button0 = new Button();
button1 = new Button();
setPrefHeight(32.0);
setPrefWidth(186.0);
setStyle("-fx-background-color: none;");
getStylesheets().add("/view/common/../../css/main.css");
columnConstraints.setHgrow(javafx.scene.layout.Priority.SOMETIMES);
columnConstraints.setMaxWidth(120.0);
columnConstraints.setMinWidth(10.0);
columnConstraints.setPrefWidth(95.0);
columnConstraints0.setHgrow(javafx.scene.layout.Priority.SOMETIMES);
columnConstraints0.setMaxWidth(150.0);
columnConstraints0.setMinWidth(10.0);
columnConstraints0.setPrefWidth(100.0);
columnConstraints1.setHgrow(javafx.scene.layout.Priority.SOMETIMES);
columnConstraints1.setMaxWidth(192.0);
columnConstraints1.setMinWidth(10.0);
columnConstraints1.setPrefWidth(110.0);
rowConstraints.setMinHeight(10.0);
rowConstraints.setPrefHeight(30.0);
rowConstraints.setVgrow(javafx.scene.layout.Priority.SOMETIMES);
button.setDefaultButton(true);
button.setMnemonicParsing(false);
button.setOnAction(this::handleEditButton);
button.setText("Edit");
GridPane.setColumnIndex(button0, 1);
button0.setMnemonicParsing(false);
button0.setOnAction(this::handleViewButton);
button0.getStyleClass().add("btn-primary");
button0.setText("View");
GridPane.setColumnIndex(button1, 2);
button1.setCancelButton(true);
button1.setMnemonicParsing(false);
button1.setOnAction(this::handleDeleteButton);
button1.setText("Delete");
getColumnConstraints().add(columnConstraints);
getColumnConstraints().add(columnConstraints0);
getColumnConstraints().add(columnConstraints1);
getRowConstraints().add(rowConstraints);
getChildren().add(button);
getChildren().add(button0);
getChildren().add(button1);
}
示例2: addEditLabelsPane
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
/**
* Sets up the editable ListView to edit the labels/items we want to see in
* the comboboxes on the main screen.
*/
private void addEditLabelsPane() {
labelsList = new ListView<>();
// first set up the listview with empty labels in order to allow editing
ObservableList<String> itemsLabelsList = FXCollections
.observableArrayList("", "", "", "", "");
// get the labels from the database and store them in the listview
ArrayList<String> labelStrings = getLabels();
// add items starting at the top
for (int i = 0; i < labelStrings.size(); i++) {
itemsLabelsList.set(i, labelStrings.get(i));
}
// set a CellFactory on the listview to be able make the cells editable
// using setEditable(true) isn't enough
labelsList.setCellFactory(TextFieldListCell.forListView());
labelsList.setEditable(true);
// give the listview an id (FXML) so we can look it up by its id, and
// toggle the visibility
labelsList.setId("labelsListView");
labelsList.setItems(itemsLabelsList);
labelsList.setVisible(false);
// "magik numbers" are figured out by observations
labelsList.setPrefWidth(120);
labelsList
.setPrefHeight((LISTVIEW_ROW_HEIGHT * MAX_NUMBER_LABELS) + 18);
// position the listview in the settings pane
GridPane.setColumnIndex(labelsList, 1);
GridPane.setRowIndex(labelsList, 0);
GridPane.setRowSpan(labelsList, 2);
// when editing a label in the listview, update the value
// in the database and setup the main gridpane with the new items in the
// comboboxes
labelsList.setOnEditCommit(event -> {
labelsList.getItems().set(event.getIndex(), event.getNewValue());
updateLabel(event.getIndex(), event.getNewValue());
controller.setupGridPane(controller.focusDay);
});
editLabelsPane.getChildren().add(labelsList);
}
示例3: addChangeNumberOfDaysSettings
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
/**
* Adds the Spinners to be able to change the number of days to move and
* number of days to show to the settings pane.
*/
private void addChangeNumberOfDaysSettings() {
// Adding the spinner to change the number of days to move.
numberOfMovingDaysSpinner = new Spinner<>();
SpinnerValueFactory<Integer> valueFactory
= new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 14,
controller.numberOfMovingDays);
numberOfMovingDaysSpinner.setValueFactory(valueFactory);
numberOfMovingDaysSpinner.setId("numberOfMovingDaysSpinner");
numberOfMovingDaysSpinner.setPrefWidth(70);
GridPane.setColumnIndex(numberOfMovingDaysSpinner, 2);
editDaysPane.getChildren().add(numberOfMovingDaysSpinner);
// Adding the spinner to change the number of days to show.
numberOfShowDaysSpinner = new Spinner<>();
// magik value 31 is the length of the longest month, just to be sure
SpinnerValueFactory<Integer> valueShowFactory
= new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 31,
controller.numberOfDays);
numberOfShowDaysSpinner.setValueFactory(valueShowFactory);
numberOfShowDaysSpinner.setId("numberOfShowDaysSpinner");
numberOfShowDaysSpinner.setPrefWidth(70);
GridPane.setColumnIndex(numberOfShowDaysSpinner, 2);
GridPane.setRowIndex(numberOfShowDaysSpinner, 1);
editDaysPane.getChildren().add(numberOfShowDaysSpinner);
// Adding the spinner to change the number of columns.
maxColumnsSpinner = new Spinner<>();
// Get the previous value from the database.
int defaultValue = Integer
.valueOf(getSetting(Controller.MAX_COLUMNS_NAME));
SpinnerValueFactory<Integer> valueColumnFactory
= new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 14,
defaultValue);
maxColumnsSpinner.setValueFactory(valueColumnFactory);
maxColumnsSpinner.setId("maxColumnsSpinner");
maxColumnsSpinner.setPrefWidth(70);
GridPane.setColumnIndex(maxColumnsSpinner, 2);
GridPane.setRowIndex(maxColumnsSpinner, 2);
editDaysPane.getChildren().add(maxColumnsSpinner);
}