因此,我必须在值min和max之间绘制N个矩形。我有代码来绘制矩形。但是,我不知道如何给它命令行参数N,min和max。这就是我所拥有的
import javafx.application.Application;
import javafx.scene.layout.AnchorPane;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
public class testRect extends Application {
@Override
public void start(Stage Stage) throws Exception {
AnchorPane root = new AnchorPane();
Scene scene = new Scene(root, 500, 500, Color.LIGHTGREY);
Stage.setScene(scene);
int N = Integer.parseInt(args[0]);
int min = Integer.parseInt(args[1]);
int max = Integer.parseInt(args[2]);
int interval = ((max - min)/ (N-1));
Rectangle r = null;
while(min < max + 1){
for(int i = 0; i < N; i++) {
r = …Run Code Online (Sandbox Code Playgroud)