0
javafxを使用して9つのボタンを表示しようとしています。forループを使用して新しいボタンオブジェクトを作成し、javafxを使用して表示する方法
public class Main extends Application
{
public void start(Stage primaryStage) throws Exception
{
Button[] button = new Button[10];
Pane pane = new Pane();
for(int i=0; i < 9; i++)
{
button[i].setText("hi");
button[i].setText("hi");
button[i].setLayoutX(i*10);
System.out.println(button[i].getText());
pane.getChildren().addAll(button[i]);
}
Scene scene = new Scene(pane);
primaryStage.setScene(scene);
primaryStage.show();
}
ボタンの向きはどのようにする必要がありますか?ボタンが彼らに何を言わなければならないのですか、もっと詳細を教えてください。 –