[Personal memorandum] Button layout created with javafx in Eclipse (in the case of HBox / VBox)

â—Ž Sample code
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;



public class Sample extends Application {
	public static void main(String[] args) {
		launch(args);
	}

	public void start(Stage stage) {
		stage.setWidth(500);
		stage.setHeight(500);

		Button button1 = new Button("1");
		Button button2 = new Button("2");
		Button button3 = new Button("3");
		Button button4 = new Button("4");
		button1.setPrefSize(100,100);
		button2.setPrefSize(100,100);
		button3.setPrefSize(100,100);
		button4.setPrefSize(100,100);


		HBox box = new HBox(1);//For VBox, here is VBox box= new VBox(1)Change to
      box.getChildren().addAll(button1,button2,button3,button4);


		BorderPane root = new BorderPane();
		root.setLeft(box);
		stage.setScene(new Scene(root));
		stage.show();
	}
}

Recommended Posts

[Personal memorandum] Button layout created with javafx in Eclipse (in the case of HBox / VBox)
[Personal memorandum] Effect of javafx VBox / setOnAction by Eclipse, etc.
Introduction of javaFX in Eclipse (April 2020)
[Personal memorandum] Eclipse button placement control object generation
List the contents of categories created with Active Hash
Get the name of the test case in the JUnit test class
Personal summary of the guys often used in JUnit 4