I am currently making a poker game in java. The model works just fine. I do however also have to make a proper view for the game. I have to use javaFX scenebuilider as well as a graphic view class with actual code. In order to do this I made a superview to include both. When i am trying to run my application I get a white window and a nullpointerexception (for the code I included).
I do not get what I am doing wrong, since no one ever explained to me the basics of Imageviews and loading images in.
I made a package "res" where I embedded all the pics that represent my cards in the deck. Also note that k.toString() automatically generates the proper name of the file including the ".png" part. I printed it out and I am sure it works!
I use the for-loop to go through my list of cards that make the deck. My cards are generated in the Class Card. So basically I am going through an ArrayList of cards.
public void initializeDeck(){
for(Card c:model.getRound().getDeck().getList()){
int index = model.getRound().getDeck().getList().indexOf(c);
imv = new ImageView(new Image(getClass().getResourceAsStream("/res/"+k.toString()),95, 141, false, true));
deckView.add(index, imv);
}
getChildren().addAll(stapelView);
}