lundi 22 août 2016

JavaFX, How to Resize a Checkbox?

I can't seem to resize a check box, regardless of using width/height, minWidth/minHeight or maxWidth/maxHeight. Changing the min width only seems to effect the nodes padding

package checkboxtest;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.CheckBox;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class CheckBoxTest extends Application {

    @Override
    public void start(Stage primaryStage) {

        CheckBox checkBoxResize = new CheckBox("Resize");
        checkBoxResize.setMinWidth(300);
        checkBoxResize.setMinHeight(300);

        CheckBox checkBoxNoResize = new CheckBox("No Resize");

        StackPane root = new StackPane();
        root.getChildren().add(checkBoxResize);
        root.getChildren().add(checkBoxNoResize);

        Scene scene = new Scene(root, 300, 250);

        primaryStage.setTitle("Hello Checkbox!");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }

}




Aucun commentaire:

Enregistrer un commentaire