我正在尝试为JavaFX程序显示一副牌,但我一直在标题中收到错误。我在之前的程序中设置了相同的设置并且运行正常。现在我一直在标题中得到错误。
package pickFourCards;
import java.util.ArrayList;
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
import javafx.scene.layout.BorderPane;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
public class PickFourCards extends Application
{
@Override
public void start(Stage primaryStage) throws Exception
{
// TODO Auto-generated method stub
Image card = new Image ("./image.card");
ImageView imageView = new ImageView(card);
ArrayList<Integer> deck = new ArrayList<>();
for (int i = 1; i < 52; i++)
{
deck.add(i);
}//end for
HBox pane = new HBox(10);
pane.setAlignment(Pos.CENTER);
Button refresh = new Button("Refresh");
//put okhandler class here
pane.getChildren().addAll(refresh);
//it's right at this line I get the error
for(int h = 0; h < 4; h++)
pane.getChildren().add(new ImageView((card) + (deck.get(h)) + ".png"));
//end h
//this is the same set up in previous program too ^
Scene scene = new Scene(pane);
primaryStage.setTitle("Excercise15_1");
primaryStage.setScene(scene);
primaryStage.show();
}//start(Stage)
}//end class