当前位置: 首页>>代码示例>>Java>>正文


Java GridPane.add方法代码示例

本文整理汇总了Java中javafx.scene.layout.GridPane.add方法的典型用法代码示例。如果您正苦于以下问题:Java GridPane.add方法的具体用法?Java GridPane.add怎么用?Java GridPane.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.layout.GridPane的用法示例。


在下文中一共展示了GridPane.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createComponents

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override
@FXThread
protected void createComponents() {
    super.createComponents();

    final GridPane gridPane = new GridPane();
    gridPane.prefWidthProperty().bind(widthProperty().multiply(DEFAULT_FIELD_W_PERCENT));

    xField = new FloatTextField();
    xField.addChangeListener((observable, oldValue, newValue) -> change());
    xField.prefWidthProperty().bind(gridPane.widthProperty().divide(3));

    yField = new FloatTextField();
    yField.addChangeListener((observable, oldValue, newValue) -> change());
    yField.prefWidthProperty().bind(gridPane.widthProperty().divide(3));

    zField = new FloatTextField();
    zField.addChangeListener((observable, oldValue, newValue) -> change());
    zField.prefWidthProperty().bind(gridPane.widthProperty().divide(3));

    gridPane.add(xField, 0, 0);
    gridPane.add(yField, 1, 0);
    gridPane.add(zField, 2, 0);

    FXUtils.addClassesTo(gridPane, CSSClasses.DEF_GRID_PANE, CSSClasses.TEXT_INPUT_CONTAINER);
    FXUtils.addClassesTo(xField, yField, zField, CSSClasses.ABSTRACT_PARAM_CONTROL_VECTOR3F_FIELD,
            CSSClasses.TRANSPARENT_TEXT_FIELD);
    FXUtils.addToPane(gridPane, this);

    UIUtils.addFocusBinding(gridPane, xField, yField, zField);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:32,代码来源:Vector3fPropertyEditorControl.java

示例2: addEntry

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void addEntry(String personName, String personId, String filmName, String filmId, String zeit) {
    StackPane pane = null;
    try {
        pane = FXMLLoader.load(MainWindowController.class.getResource("../Views/ReservationEntry.fxml"));
        GridPane gridPane = (GridPane) pane.getChildren().get(0);

        gridPane.add(new Label(personName), 0, 0);
        gridPane.add(new Label(personId), 1, 0);
        gridPane.add(new Label(filmName), 2, 0);
        gridPane.add(new Label(filmId), 3, 0);
        gridPane.add(new Label(zeit), 4, 0);
        entries.getItems().add(gridPane);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:fabianbaechli,项目名称:kino_system,代码行数:17,代码来源:ShowReservationsController.java

示例3: 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();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:49,代码来源:TitledPaneSample.java

示例4: createContent

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override
@FXThread
protected void createContent(@NotNull final GridPane root) {
    super.createContent(root);

    final Label customBoxLabel = new Label(Messages.CREATE_SCENE_FILTER_DIALOG_CUSTOM_BOX + ":");
    customBoxLabel.prefWidthProperty().bind(root.widthProperty().multiply(DEFAULT_LABEL_W_PERCENT2));

    customCheckBox = new CheckBox();
    customCheckBox.prefWidthProperty().bind(root.widthProperty().multiply(DEFAULT_FIELD_W_PERCENT2));

    final Label builtInLabel = new Label(Messages.CREATE_SCENE_FILTER_DIALOG_BUILT_IN + ":");
    builtInLabel.prefWidthProperty().bind(root.widthProperty().multiply(DEFAULT_LABEL_W_PERCENT2));

    builtInBox = new ComboBox<>();
    builtInBox.disableProperty().bind(customCheckBox.selectedProperty());
    builtInBox.getItems().addAll(BUILT_IN_NAMES);
    builtInBox.getSelectionModel().select(BUILT_IN_NAMES.first());
    builtInBox.prefWidthProperty().bind(root.widthProperty().multiply(DEFAULT_FIELD_W_PERCENT2));

    final Label customNameLabel = new Label(Messages.CREATE_SCENE_FILTER_DIALOG_CUSTOM_FIELD + ":");
    customNameLabel.prefWidthProperty().bind(root.widthProperty().multiply(DEFAULT_LABEL_W_PERCENT2));

    filterNameField = new TextField();
    filterNameField.disableProperty().bind(customCheckBox.selectedProperty().not());
    filterNameField.prefWidthProperty().bind(root.widthProperty().multiply(DEFAULT_FIELD_W_PERCENT2));

    root.add(builtInLabel, 0, 0);
    root.add(builtInBox, 1, 0);
    root.add(customBoxLabel, 0, 1);
    root.add(customCheckBox, 1, 1);
    root.add(customNameLabel, 0, 2);
    root.add(filterNameField, 1, 2);

    FXUtils.addClassTo(builtInLabel, customBoxLabel, customNameLabel, CSSClasses.DIALOG_DYNAMIC_LABEL);
    FXUtils.addClassTo(builtInBox, customCheckBox, filterNameField, CSSClasses.DIALOG_FIELD);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:38,代码来源:CreateSceneFilterDialog.java

示例5: renderTo

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override
public void renderTo(GridPane contentPane, int rowIndex) {
    GridPane.setHgrow(textArea, Priority.ALWAYS);
    if (vGrow) {
        GridPane.setVgrow(textArea, Priority.ALWAYS);
    } else {
        this.textArea.setPrefRowCount(rowCount);
    }

    contentPane.add(getLabel(), 0, rowIndex);
    contentPane.add(textArea, 1, rowIndex);

}
 
开发者ID:yiding-he,项目名称:redisfx,代码行数:14,代码来源:TextAreaFormField.java

示例6: start

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override public void start(Stage stage) {
    GridPane pane           = new GridPane();
    Label    nonInteractive = new Label("Non Interactive");
    Label    interactive    = new Label("Interactive");

    pane.add(nonInteractive, 0, 0);
    pane.add(nonInteractiveSunburstChart, 0, 1);
    pane.add(interactive, 1, 0);
    pane.add(interactiveSunburstChart, 1, 1);

    GridPane.setHalignment(nonInteractive, HPos.CENTER);
    GridPane.setHalignment(interactive, HPos.CENTER);

    pane.setPadding(new Insets(10));

    Scene scene = new Scene(pane);

    stage.setTitle("Sunburst Chart");
    stage.setScene(scene);
    stage.show();

    interactiveSunburstChart.setAutoTextColor(true);

    //timer.start();

    // Calculate number of nodes
    calcNoOfNodes(nonInteractiveSunburstChart);
    System.out.println(noOfNodes + " Nodes in non interactive Sunburst Chart");

    noOfNodes = 0;
    calcNoOfNodes(interactiveSunburstChart);
    System.out.println(noOfNodes + " Nodes in interactive Sunburst Chart");
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:34,代码来源:SunburstChartTest.java

示例7: ExceptionAlert

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public ExceptionAlert(T throwable) {
    super(AlertType.ERROR);
    this.throwable = throwable;

    this.setTitle(throwable.getClass().getSimpleName());
    this.setHeaderText(throwable.getMessage());

    // Content Setter
    // REF http://code.makery.ch/blog/javafx-dialogs-official/
    Label label = new Label("Error details:");

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    throwable.printStackTrace(pw);
    this.stackTraceString = sw.toString();

    TextArea exceptionTextArea = new TextArea(this.stackTraceString);
    exceptionTextArea.setEditable(false);
    exceptionTextArea.setWrapText(true);

    exceptionTextArea.setPrefSize(this.getDialogPane().getWidth()-20, this.getDialogPane().getHeight());
    GridPane.setVgrow(exceptionTextArea, Priority.ALWAYS);
    GridPane.setHgrow(exceptionTextArea, Priority.ALWAYS);

    GridPane expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    expContent.add(label, 0, 0);
    expContent.add(exceptionTextArea, 0, 1);

    this.getDialogPane().setExpandableContent(expContent);
    this.getDialogPane().setMinHeight(300);
}
 
开发者ID:erayerdin,项目名称:primitivefxmvc,代码行数:33,代码来源:ExceptionAlert.java

示例8: start

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override public void start(Stage stage) {
    GridPane pane = new GridPane();
    Label nonInteractive = new Label("Non Interactive");
    Label interactive    = new Label("Interactive");

    pane.add(nonInteractive, 0, 0);
    pane.add(nonInteractiveSunburstChart, 0, 1);
    pane.add(interactive, 1, 0);
    pane.add(interactiveSunburstChart, 1, 1);

    GridPane.setHalignment(nonInteractive, HPos.CENTER);
    GridPane.setHalignment(interactive, HPos.CENTER);

    pane.setPadding(new Insets(10));

    Scene scene = new Scene(pane);

    stage.setTitle("JavaFX Sunburst Chart");
    stage.setScene(scene);
    stage.show();

    interactiveSunburstChart.setAutoTextColor(true);

    //timer.start();

    // Calculate number of nodes
    calcNoOfNodes(nonInteractiveSunburstChart);
    System.out.println(noOfNodes + " Nodes in non interactive Sunburst Chart");

    noOfNodes = 0;
    calcNoOfNodes(interactiveSunburstChart);
    System.out.println(noOfNodes + " Nodes in interactive Sunburst Chart");
}
 
开发者ID:HanSolo,项目名称:SunburstChart,代码行数:34,代码来源:Demo.java

示例9: MovieCell

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public MovieCell(MovieView movieView) {
    this.movieView = movieView;

    GridPane gridPane = new GridPane();

    ColumnConstraints col1 = new ColumnConstraints();
    ColumnConstraints col2 = new ColumnConstraints();
    ColumnConstraints col3 = new ColumnConstraints();
    ColumnConstraints col4 = new ColumnConstraints();
    ColumnConstraints col5 = new ColumnConstraints();

    col4.setHgrow(Priority.ALWAYS);

    gridPane.getColumnConstraints().setAll(col1, col2, col3, col4, col5);
    gridPane.setHgap(10);

    // director image
    directorImage = new ImageView();
    directorImage.setFitWidth(60);
    directorImage.setFitHeight(60);
    directorImage.setEffect(new InnerShadow());
    gridPane.add(directorImage, 0, 0);
    GridPane.setRowSpan(directorImage, 2);
    GridPane.setValignment(directorImage, VPos.TOP);

    // title and year
    titleLabel = new Label();
    titleLabel.getStyleClass().add("title-label");
    gridPane.add(titleLabel, 1, 0);
    GridPane.setColumnSpan(titleLabel, 2);
    GridPane.setValignment(titleLabel, VPos.TOP);

    // director label
    directorLabel = new Label();
    directorLabel.getStyleClass().add("director-label");
    gridPane.add(directorLabel, 1, 1);
    GridPane.setValignment(directorLabel, VPos.TOP);

    // genre label
    genreLabel = new Label();
    genreLabel.getStyleClass().add("genre-label");
    gridPane.add(genreLabel, 4, 0);

    // trailer label
    trailerLabel = FontAwesomeIconFactory.get().createIconLabel(FontAwesomeIcon.FILM, "", "14px", "14px", ContentDisplay.GRAPHIC_ONLY);
    trailerLabel.getStyleClass().add("trailer-label");
    gridPane.add(trailerLabel, 3, 0);
    GridPane.setHalignment(trailerLabel, HPos.LEFT);
    GridPane.setValignment(trailerLabel, VPos.TOP);

    trailerLabel.setOnMouseClicked(evt -> {
        try {
            Movie movie = getItem();
            movieView.setSelectedTrailer(MovieApp.class.getResource("/trailers/" + movie.getTrailer()).toExternalForm());
        } catch (NullPointerException e) {
            movieView.setSelectedTrailer(MovieApp.class.getResource("/TrailerMissing.mp4").toExternalForm());
        }
    });

    setGraphic(gridPane);
    setContentDisplay(ContentDisplay.GRAPHIC_ONLY);

    movieView.useClippingProperty().addListener(it -> updateClipping());
    updateClipping();
}
 
开发者ID:hendrikebbers,项目名称:ExtremeGuiMakeover,代码行数:66,代码来源:MovieCell.java

示例10: handleSaveAndQuitGame

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public void handleSaveAndQuitGame(int status) throws IOException{
   
    Dialog<ButtonType> popup = new Dialog<>();
    popup.setTitle("Sauvegarder et quitter la partie");
    ButtonType saveAndQuit = new ButtonType("Sauvegarder et quitter", ButtonBar.ButtonData.LEFT);
    ButtonType cancel = new ButtonType("Annuler", ButtonBar.ButtonData.RIGHT);
    popup.getDialogPane().getButtonTypes().addAll(saveAndQuit, cancel);

    GridPane grid = new GridPane();
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(20, 150, 10, 10));
    TextField saveName = new TextField();
    
    String saveString;
    if (core.getMode() == Consts.PVP) {
        saveString = core.getPlayers()[Consts.PLAYER1].getName() + "-" + core.getPlayers()[Consts.PLAYER2].getName() + "-turn" + core.getTurn();
    } else if (core.getMode() == Consts.PVAI) {
        saveString = core.getPlayers()[Consts.PLAYER1].getName() + "-AI_"
                + (core.getDifficulty() == Consts.EASY ? "EASY" : core.getDifficulty() == Consts.MEDIUM ? "MEDIUM" : "HARD")
                + "-turn" + core.getTurn();
    }
    else{
        saveString =  "AI_"+ (core.getDifficulty() == Consts.EASY ? "EASY-" : core.getDifficulty() == Consts.MEDIUM ? "MEDIUM-" : "HARD-")+ core.getPlayers()[Consts.PLAYER2].getName()+"-turn" + core.getTurn();
    }
    saveName.setPromptText(saveString);

    popup.getDialogPane().setContent(grid);
    grid.add(new Label("Nom de la sauvegarde :"), 0, 0);
    grid.add(saveName, 1, 0);

    Optional<ButtonType> result = popup.showAndWait();
    if (result.get().getButtonData() == ButtonBar.ButtonData.LEFT) {
        if (!saveName.getText().equals("")) {
            saveString = saveName.getText();
        }
        if (core.save(saveString))
            takeSnapshot(saveString);
        switch (status) {
            case (Consts.GO_TO_MAIN):
                refreshor.stop();
                main.showMainMenu();
                break;
            case (Consts.GO_TO_LOAD):
                refreshor.stop();
                main.showLoadGameScreen();
                break;
            case (Consts.GO_TO_GAME):
                relaunchGameScreen();
                break;
        }
    }
}
 
开发者ID:Plinz,项目名称:Hive_Game,代码行数:54,代码来源:GameScreenController.java

示例11: start

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
	loadData();
	tree = new J48();
	tree.buildClassifier(data);

	noClassificationChart = buildChart("No Classification (click to add new data)", buildSingleSeries());
	clusteredChart = buildChart("Clustered", buildClusteredSeries());
	realDataChart = buildChart("Real Data (+ Decision Tree classification for new data)", buildLabeledSeries());

	noClassificationChart.setOnMouseClicked(e -> {
		Axis<Number> xAxis = noClassificationChart.getXAxis();
		Axis<Number> yAxis = noClassificationChart.getYAxis();
		Point2D mouseSceneCoords = new Point2D(e.getSceneX(), e.getSceneY());
		double x = xAxis.sceneToLocal(mouseSceneCoords).getX();
		double y = yAxis.sceneToLocal(mouseSceneCoords).getY();
		Number xValue = xAxis.getValueForDisplay(x);
		Number yValue = yAxis.getValueForDisplay(y);
		reloadSeries(xValue, yValue);
	});

	Label lblDecisionTreeTitle = new Label("Decision Tree generated for the Iris dataset:");
	Text txtTree = new Text(tree.toString());
	String graph = tree.graph();
	SwingNode sw = new SwingNode();
	SwingUtilities.invokeLater(() -> {
		TreeVisualizer treeVisualizer = new TreeVisualizer(null, graph, new PlaceNode2());
		treeVisualizer.setPreferredSize(new Dimension(600, 500));
		sw.setContent(treeVisualizer);
	});

	Button btnRestore = new Button("Restore original data");
	Button btnSwapColors = new Button("Swap clustered chart colors");
	StackPane spTree = new StackPane(sw);
	spTree.setPrefWidth(300);
	spTree.setPrefHeight(350);
	VBox vbDecisionTree = new VBox(5, lblDecisionTreeTitle, new Separator(), spTree,
			new HBox(10, btnRestore, btnSwapColors));
	btnRestore.setOnAction(e -> {
		loadData();
		reloadSeries();
	});
	btnSwapColors.setOnAction(e -> swapClusteredChartSeriesColors());
	lblDecisionTreeTitle.setTextFill(Color.DARKRED);
	lblDecisionTreeTitle.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, FontPosture.ITALIC, 16));
	txtTree.setTranslateX(100);
	txtTree.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, FontPosture.ITALIC, 14));
	txtTree.setLineSpacing(1);
	txtTree.setTextAlignment(TextAlignment.LEFT);
	vbDecisionTree.setTranslateY(20);
	vbDecisionTree.setTranslateX(20);

	GridPane gpRoot = new GridPane();
	gpRoot.add(realDataChart, 0, 0);
	gpRoot.add(clusteredChart, 1, 0);
	gpRoot.add(noClassificationChart, 0, 1);
	gpRoot.add(vbDecisionTree, 1, 1);

	stage.setScene(new Scene(gpRoot));
	stage.setTitle("Íris dataset clustering and visualization");
	stage.show();
}
 
开发者ID:jesuino,项目名称:java-ml-projects,代码行数:63,代码来源:Clustering.java

示例12: SpielFeld

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
/**
 * Konstruktormethode zur Einrichtung des Spielfeldes.
 */

public SpielFeld() {
    // spiel enthaelt die Spiellogik
    spiel = new Spiel(this);

    // Arrays fuer Auswahl-Buttons und die Spielsteine
    button = new Button[7];
    field = new Label[42];

    // Bilder fuer Auswahl-Button, Spieler1, Spieler2 und "leere Steine"
    user = new Image("user.gif");
    red = new Image("red.gif");
    green = new Image("green.gif");
    gray = new Image("grau.gif");

    // Spieler1 ist rot, Spieler2 gruen
    ROT = 1;
    GRUEN = 2;


    // Initialisierung des Labels am oberen Rand
    display = new Label("Rot beginnt!");
    labelBox = new HBox(display);
    labelBox.setAlignment(Pos.CENTER);
    labelBox.setStyle("-fx-background-color: red;");
    this.setTop(labelBox);

    // Initialisierung des Spielfeldes in der Mitte
    gridPanel = new GridPane();
    gridPanel.setAlignment(Pos.CENTER);
    gridPanel.setStyle("-fx-background-color: black;");
    gridPanel.setPadding(new Insets(3));
    // Hinzufuegen der Auswahlknoepfe mit Event-Handlern
    for (int i = 0; i < 7; i++) {
        button[i] = new Button("", new ImageView(user));
        button[i].setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
        button[i].addEventHandler(ActionEvent.ACTION, e -> spiel.waehleSpalte(e));
        gridPanel.add(button[i], i, 0);
    }
    // Hinzufuegen der "Spielsteine"
    for (int i = 0; i < 42; i++) {
        field[i] = new Label("", new ImageView(gray));
        field[i].setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
        field[i].setStyle("-fx-border-color: white;");
        gridPanel.add(field[i], i % 7, i / 7 + 1);
    }
    this.setCenter(gridPanel);

    // Initialisierung der "Menue-Buttons" am unteren Rand
    buttonBox = new HBox(20);
    buttonBox.setAlignment(Pos.CENTER);
    buttonBox.setPadding(new Insets(5));
    neuesSpiel = new Button("Neues Spiel");
    neuesSpiel.addEventHandler(ActionEvent.ACTION, e -> spiel.clean());
    hilfe = new Button("Hilfe");
    hilfe.addEventHandler(ActionEvent.ACTION, e -> new HilfeDialog().showAndWait());
    buttonBox.getChildren().addAll(neuesSpiel, hilfe);
    this.setBottom(buttonBox);
}
 
开发者ID:CAPTNCAPS,项目名称:java.IF17wi,代码行数:63,代码来源:SpielFeld.java

示例13: createLevelControlSettings

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
/**
 * Create settings of level control.
 */
private void createLevelControlSettings() {

    final Label smoothlyLabel = new Label(Messages.EDITING_COMPONENT_SMOOTHLY + ":");
    smoothlyLabel.prefWidthProperty().bind(widthProperty().multiply(LABEL_PERCENT));

    levelControlSmoothly = new CheckBox();
    levelControlSmoothly.prefWidthProperty().bind(widthProperty().multiply(FIELD_PERCENT));
    levelControlSmoothly.selectedProperty()
            .addListener((observable, oldValue, newValue) -> changeLevelControlSmoothly(newValue));

    final Label useMarkerLabel = new Label(Messages.EDITING_COMPONENT_USE_MARKER + ":");
    useMarkerLabel.prefWidthProperty().bind(widthProperty().multiply(LABEL_PERCENT));

    levelControlUseMarker = new CheckBox();
    levelControlUseMarker.prefWidthProperty().bind(widthProperty().multiply(FIELD_PERCENT));
    levelControlUseMarker.selectedProperty()
            .addListener((observable, oldValue, newValue) -> changeLevelControlUseMarker(newValue));

    final Label levelLabel = new Label(Messages.EDITING_COMPONENT_LEVEL + ":");
    levelLabel.prefWidthProperty().bind(widthProperty().multiply(LABEL_PERCENT));

    levelControlLevelField = new FloatTextField();
    levelControlLevelField.prefWidthProperty().bind(widthProperty().multiply(FIELD_PERCENT));
    levelControlLevelField.setMinMax(0F, Integer.MAX_VALUE);
    levelControlLevelField.addChangeListener((observable, oldValue, newValue) -> changeLevelControlLevel(newValue));
    levelControlLevelField.disableProperty()
            .bind(levelControlUseMarker.selectedProperty());

    levelControlSettings = new GridPane();
    levelControlSettings.add(smoothlyLabel, 0, 0);
    levelControlSettings.add(levelControlSmoothly, 1, 0);
    levelControlSettings.add(useMarkerLabel, 0, 1);
    levelControlSettings.add(levelControlUseMarker, 1, 1);
    levelControlSettings.add(levelLabel, 0, 2);
    levelControlSettings.add(levelControlLevelField, 1, 2);

    FXUtils.addClassTo(smoothlyLabel, useMarkerLabel, levelLabel,
            CSSClasses.ABSTRACT_PARAM_CONTROL_PARAM_NAME_SINGLE_ROW);

    FXUtils.addClassesTo(levelControlSettings, CSSClasses.DEF_GRID_PANE);
    FXUtils.addClassTo(levelControlLevelField, CSSClasses.ABSTRACT_PARAM_CONTROL_COMBO_BOX);
    FXUtils.addClassTo(levelControlSmoothly, levelControlUseMarker, CSSClasses.ABSTRACT_PARAM_CONTROL_CHECK_BOX);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:47,代码来源:TerrainEditingComponent.java

示例14: loadMappings

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void loadMappings(MappingFormat format) {
	Window window = gui.getScene().getWindow();
	Path file;

	if (format == null || format.hasSingleFile()) {
		file = Gui.requestFile("Select mapping file", window, getMappingLoadExtensionFilters(), true);
	} else {
		file = Gui.requestDir("Select mapping dir", window);
	}

	if (file == null) return;

	Dialog<boolean[]> dialog = new Dialog<>();
	//dialog.initModality(Modality.APPLICATION_MODAL);
	dialog.setResizable(true);
	dialog.setTitle("UID Setup");
	dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);

	GridPane grid = new GridPane();
	grid.setHgap(GuiConstants.padding);
	grid.setVgap(GuiConstants.padding);

	grid.add(new Label("Target:"), 0, 0);

	ToggleGroup targetGroup = new ToggleGroup();
	RadioButton rbA = new RadioButton("A");
	rbA.setToggleGroup(targetGroup);
	rbA.setSelected(true);
	grid.add(rbA, 1, 0);
	RadioButton rbB = new RadioButton("B");
	rbB.setToggleGroup(targetGroup);
	grid.add(rbB, 2, 0);

	CheckBox replaceBox = new CheckBox("Replace");
	replaceBox.setSelected(true);
	grid.add(replaceBox, 0, 1, 3, 1);

	dialog.getDialogPane().setContent(grid);
	dialog.setResultConverter(button -> button == ButtonType.OK ? new boolean[] { rbA.isSelected(), replaceBox.isSelected() } : null);

	Optional<boolean[]> resultOpt = dialog.showAndWait();
	if (!resultOpt.isPresent()) return;

	boolean[] result = resultOpt.get();

	boolean forA = result[0];
	boolean replace = result[1];

	try {
		gui.getMatcher().readMappings(file, format, forA, replace);
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		return;
	}

	gui.onMappingChange();
}
 
开发者ID:sfPlayer1,项目名称:Matcher,代码行数:59,代码来源:FileMenu.java

示例15: addChildren

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void addChildren(GridPane gridPane, Node heading, Node instructions, Node closeButton) {
  	gridPane.add(heading, 0, 0);
gridPane.add(instructions, 0, 1);
gridPane.add(closeButton, 0, 2);
  }
 
开发者ID:nonilole,项目名称:Conan,代码行数:6,代码来源:InstructionsView.java


注:本文中的javafx.scene.layout.GridPane.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。