kleine änderung an der image url

This commit is contained in:
Felix Düsterhaus 2023-01-31 16:22:57 +01:00
parent 8a03439ab6
commit 4ccb2c80f2
2 changed files with 8 additions and 6 deletions

View File

@ -127,11 +127,13 @@ public class HelloController {
@FXML @FXML
private String veggieImageUrl = "vegetarisch.png"; final String imagePathUrl = "file:target/classes/com/example/vpr_javafx/pics/";
@FXML @FXML
private String veganUrl = "vegan.png"; final String veggieImageUrl = imagePathUrl + "vegetarisch.png";
@FXML @FXML
private String meatUrl = "fleisch.png"; final String veganImageUrl = imagePathUrl + "vegan.png";
@FXML
final String meatImageUrl = imagePathUrl + "fleisch.png";
@FXML @FXML
private String imageUrl; private String imageUrl;
@ -163,16 +165,16 @@ public class HelloController {
String dayMenu = dish+"\n"+sideDish+"\n"+"("+allergenic+")"; String dayMenu = dish+"\n"+sideDish+"\n"+"("+allergenic+")";
if(typ.equals("Fleisch")) { if(typ.equals("Fleisch")) {
imageUrl=meatUrl; imageUrl=meatImageUrl;
} }
if(typ.equals("Vegetarisch")) { if(typ.equals("Vegetarisch")) {
imageUrl=veggieImageUrl; imageUrl=veggieImageUrl;
} }
if(typ.equals("Vegan")) { if(typ.equals("Vegan")) {
imageUrl=veganUrl; imageUrl=veganImageUrl;
} }
Image image = new Image("file:target/classes/com/example/vpr_javafx/pics/" + imageUrl); Image image = new Image(imageUrl);
switch (i) { switch (i) {
case 0: case 0: