◎サンプルコード
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);//VBoxの場合は、ここを VBox box = new VBox(1)に変更する
box.getChildren().addAll(button1,button2,button3,button4);
BorderPane root = new BorderPane();
root.setLeft(box);
stage.setScene(new Scene(root));
stage.show();
}
}
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme