From 01b95196a389a54dd6ec108ea3704e3d522a2776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20D=C3=BCsterhaus?= Date: Mon, 30 Jan 2023 17:45:57 +0100 Subject: [PATCH 1/2] =?UTF-8?q?HelloController=20imageview=20+=20allergene?= =?UTF-8?q?=20hinzugef=C3=BCgt,=20menue.txt=20um=20allergene=20erweitert,?= =?UTF-8?q?=20view=20angepasst?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- menue.txt | 40 +++---- .../example/vpr_javafx/HelloController.java | 61 ++++++++++- .../example/vpr_javafx/HelloController.class | Bin 5101 -> 6485 bytes .../example/vpr_javafx/MenuOverview-view.fxml | 99 +++++++++--------- 4 files changed, 132 insertions(+), 68 deletions(-) diff --git a/menue.txt b/menue.txt index bd6ce28..18e8d87 100644 --- a/menue.txt +++ b/menue.txt @@ -1,20 +1,20 @@ -Montag;Pommes;mit Kroketten und Gemüse;Vegan -Montag;Vegane Waffel;mit Puderzucker;DessertV -Montag;Schnitzel;mit Kroketten, Gemüse und Soße;Fleisch -Montag;Wackelpudding;mit Vanillesoße;Dessert -Dienstag;Rote Linsen Curry;mit Süßkartoffeln;Vegan -Dienstag;Vegane Pancakes;mit Ahornsirup;DessertV -Dienstag;Gebratene Nudeln;mit Gemüse;Vegetarisch -Dienstag;Berliner;mit Erdbeerfüllung;Dessert -Mittwoch;Bratkartoffeln;mit veganer Bratensoße;Vegan -Mittwoch;Pudding;mit Schokostreuseln;DessertV -Mittwoch;Bratkartoffeln;mit Leberkäse und Ei;Fleisch -Mittwoch;Pudding;mit Vanillesoße;Dessert -Donnerstag;Bauerntopf;mit veganem Hack;Vegan -Donnerstag;Bananenbrot;mit Datteln;DessertV -Donnerstag;Bauerntopf;mit veganem Hack;Vegan -Donnerstag;Bananenbrot;mit Datteln;DessertV -Freitag;Bauerntopf;mit veganem Hack;Vegan -Freitag;Bananenbrot;mit Datteln;DessertV -Freitag;Bauerntopf;mit veganem Hack;Vegan -Freitag;Bananenbrot;mit Datteln;DessertV \ No newline at end of file +Montag;Pommes;mit Kroketten und Gemüse;Vegan;g,2,3 +Montag;Vegane Waffel;mit Puderzucker;DessertV;g,b,k +Montag;Schnitzel;mit Kroketten, Gemüse und Soße;Fleisch;g,c,a,2,3 +Montag;Wackelpudding;mit Vanillesoße;Dessert;c,2 +Dienstag;Rote Linsen Curry;mit Süßkartoffeln;Vegan;g,b,2,3 +Dienstag;Vegane Pancakes;mit Ahornsirup;DessertV;g,b,3 +Dienstag;Gebratene Nudeln;mit Gemüse;Vegetarisch;b,c,a,i,3 +Dienstag;Berliner;mit Erdbeerfüllung;Dessert;c,a +Mittwoch;Bratkartoffeln;mit veganer Bratensoße;Vegan;b,2,3 +Mittwoch;Pudding;mit Schokostreuseln;DessertV;b,2 +Mittwoch;Bratkartoffeln;mit Leberkäse und Ei;Fleisch;a,j,2,3 +Mittwoch;Pudding;mit Vanillesoße;Dessert;c,2 +Donnerstag;Bauerntopf;mit veganem Hack;Vegan;g,c,a,h,1,2,3 +Donnerstag;Bananenbrot;mit Datteln;DessertV;g,c +Donnerstag;Bauerntopf;mit veganem Hack;Vegan;g,c,a,h,1,2,3 +Donnerstag;Bananenbrot;mit Datteln;DessertV;g,c +Freitag;Bauerntopf;mit veganem Hack;Vegan;g,c,a,h,1,2,3 +Freitag;Bananenbrot;mit Datteln;DessertV;g,c +Freitag;Bauerntopf;mit veganem Hack;Vegan;g,c,a,h,1,2,3 +Freitag;Bananenbrot;mit Datteln;DessertV;g,c \ No newline at end of file diff --git a/src/main/java/com/example/vpr_javafx/HelloController.java b/src/main/java/com/example/vpr_javafx/HelloController.java index 4e911ba..3b8b6aa 100644 --- a/src/main/java/com/example/vpr_javafx/HelloController.java +++ b/src/main/java/com/example/vpr_javafx/HelloController.java @@ -7,8 +7,12 @@ import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.*; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; import javafx.stage.Stage; +import java.io.Console; +import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; @@ -57,6 +61,27 @@ public class HelloController { @FXML private Label lFriD2; + @FXML + private ImageView imgImage1; + @FXML + private ImageView imgImage2; + @FXML + private ImageView imgImage3; + @FXML + private ImageView imgImage4; + @FXML + private ImageView imgImage5; + @FXML + private ImageView imgImage6; + @FXML + private ImageView imgImage7; + @FXML + private ImageView imgImage8; + @FXML + private ImageView imgImage9; + @FXML + private ImageView imgImage10; + @FXML private TextField tfPhone; @FXML @@ -67,6 +92,15 @@ public class HelloController { @FXML private Label allergene; + @FXML + private String veggieImageUrl = "pics/vegetarisch.png"; + @FXML + private String veganUrl = "pics/vegan.png"; + @FXML + private String meatUrl = "pics/fleisch.png"; + @FXML + private String imageUrl; + @FXML protected void OnSignInButton(ActionEvent event) throws IOException { @@ -96,70 +130,95 @@ public class HelloController { for (int i = 0; i < menu.size(); i++) { + String[] parts = menu.get(i).split(";"); String dish = parts[1]; String sideDish = parts[2]; + String typ = parts[3]; + String allergenic = parts[4]; - String dayMenu = dish+"\n"+sideDish; + String dayMenu = dish+"\n"+sideDish+"\n"+"("+allergenic+")"; + + if(typ.equals("Fleisch")) { + imageUrl=meatUrl; + } + if(typ.equals("Vegetarisch")) { + imageUrl=veggieImageUrl; + } + if(typ.equals("Vegan")) { + imageUrl=veganUrl; + } + + Image image = new Image("C:/Unterricht/VPR_Projekt/target/classes/com/example/vpr_javafx/" + imageUrl); switch (i) { case 0: lMonH1.setText(dayMenu); + imgImage1.setImage(image); break; case 1: lMonD1.setText(dayMenu); break; case 2: lMonH2.setText(dayMenu); + imgImage2.setImage(image); break; case 3: lMonD2.setText(dayMenu); break; case 4: lTueH1.setText(dayMenu); + imgImage3.setImage(image); break; case 5: lTueD1.setText(dayMenu); break; case 6: lTueH2.setText(dayMenu); + imgImage4.setImage(image); break; case 7: lTueD2.setText(dayMenu); break; case 8: lWednH1.setText(dayMenu); + imgImage5.setImage(image); break; case 9: lWednD1.setText(dayMenu); break; case 10: lWednH2.setText(dayMenu); + imgImage6.setImage(image); break; case 11: lWednD2.setText(dayMenu); break; case 12: lThurH1.setText(dayMenu); + imgImage7.setImage(image); break; case 13: lThurD1.setText(dayMenu); break; case 14: lThurH2.setText(dayMenu); + imgImage8.setImage(image); break; case 15: lThurD2.setText(dayMenu); break; case 16: lFriH1.setText(dayMenu); + imgImage9.setImage(image); break; case 17: lFriD1.setText(dayMenu); break; case 18: lFriH2.setText(dayMenu); + imgImage10.setImage(image); break; case 19: lFriD2.setText(dayMenu); diff --git a/target/classes/com/example/vpr_javafx/HelloController.class b/target/classes/com/example/vpr_javafx/HelloController.class index d171c350e332db8f6a4a55ecfd15e0491e2bbf92..bde13864374e1ffcd07b24795aa932534e913a14 100644 GIT binary patch literal 6485 zcmZ`;31Ae}8UEg8li3Udfp7)^mqQ>xvIugxD=1e?GyzI52x{qMGszCw%r3jLAz-yy ztyNpA#cHKmu_{ujTB#5a@T6MLdLPw#(8H_RL#wq`rQe&`O?H_8yxBM3eDD4L``>&2 z`(}9J>wWhFm?x&I@S#Y7UqdlU1O~3tJM~apx7tF>n%5aoTcG45(=zS(0!5Q6n*s<3 z3`v^Nbg0v4Gi*I&rlYayq}5gm75x-w8v0{^z{F^xBV=^x9m%*6>P)8A%8pyRLbXOb zo>-Ky>{KEiH&Oxv*iV~j)OF}>#u=%&KzV(y4~=%pwAvy83?wmURkw2X$~6p@#scg^ zx7a#>p&WxlY>gZFt_{~PLQ<6uL$}FPFj8RbQJkz#w3*go-8ResMzQ-$+DKK~UABq} zjFFK#R$%C4ub-7ok}+1pIE-hrl%coOm~lgrD_wTRHshgMJsoS%lMxxR<1|dfB>H8y zE{`QFa)S<&p-M*$%Lql?ScO&^U3QIW#9JaNDltXDR1MQmB`_u%*`v_eHRnmT=EUXP za3(k#T*@4{M5;w#Lf?+$2svkFN@q?G7}uvC1#AVg1&%pN&>3%C z#Vm}GmlHLF5fRWj^|;x>nUGHf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H1c*nA3farRxC#^)?gbp zp&tXRdS&jm$fVd@8i(icU2Z|=oC&5{%Q(PIE#f`>6-sr~xeTx3 zHM(F8KPkV5*ZJ}M2K6d8L^Hq7nFooS2=NJ*ZO|}B!w)oQ8dhj%4gW1s{`(=Da`(Pz zg_OdNsJupbuy!5a8a=tEDOdX{T3^IDFJeP??KumUy@XDI$HcB>3tqyO8d}lX^yvxo zZCR08l})XvTa~2~o9kZY_K>Y#z@UrsxtjW$!*(f~#a3p!j_nS%y=+giDYw4L_7>Z_ zZ11yu$o3I+)Uh4Swverb?JTx7M)Bh2`UzaNA0JRI#PWNThhzC2$~$8Db;_f${5<7S zEI&orkL8CckHzxcly}AQZpv51@;K#dV%esAeJo#2`Nml8r+jlPcT&DBme*0fGnP-M zd`~PdrhI=a&!_xgEE|*`3gz83V*kfC>_37Z&ss-_1M9yxJ@sQ^2l`Q=@OIAqqltquuPAS;T?XMyo+6Uk6$D2<0^c> zFOUy$4gSM8eT3`rU+iWSZWIl;iIKQj%*CyY#%&^vI~b8W#d6%usN5sg;y%%a`$an* z5IuNM^kT2L5D$q<@UW2BCyIDPT!BYLz$CgFkBe*Zq__p9xC_s6H&2WE@QiqnJF1jS zi?|#=riHawDK5s_VNt9W1Ncc;6zj!iT7H0e+el46r59@W1$aGvj$c4fR|>zxuR>q# zi3{%ydP$W`H0sxsRLOLs`G08C(8bERT@?%~r%Pz~O{H#Hf!WEwPgv9ZZ?tf*O4Pay z8uq0Qsj7D?RfV;*j&Xy|s6N*8Br{j#d`%cX^*?gpK`;w%R-JBoY;`r^)#A6|tlu$K WpaBBEXZvedFFK{aGj{(%^Zx<3Is=ga diff --git a/target/classes/com/example/vpr_javafx/MenuOverview-view.fxml b/target/classes/com/example/vpr_javafx/MenuOverview-view.fxml index 9b6e622..6a5cd21 100644 --- a/target/classes/com/example/vpr_javafx/MenuOverview-view.fxml +++ b/target/classes/com/example/vpr_javafx/MenuOverview-view.fxml @@ -1,19 +1,14 @@ - - - - - - - - - - - + + + + + + - -