11package GUI ;
22
33import Scanner .KanjiScanner ;
4+ import Scanner .Translator ;
45import javafx .application .Application ;
56import javafx .application .Platform ;
67import javafx .geometry .Insets ;
@@ -18,6 +19,9 @@ public class App extends Application {
1819 private KanjiScanner scanner ;
1920 private final Label kanjiLabel = new Label ("Kanji" );
2021 private final Label meaningLabel = new Label ("Meaning" );
22+ private final Label yomiDict = new Label ("Yomi Meaning" );
23+ private final static Translator translator = new Translator ();
24+
2125
2226 public App () {
2327 try {
@@ -37,12 +41,14 @@ public void start(Stage stage) {
3741 grid .setVgap (10 );
3842 grid .setPadding (new Insets (25 , 25 , 25 , 25 ));
3943 grid .add (kanjiLabel , 0 , 0 );
40- grid .add (meaningLabel , 0 , 1 );
44+ grid .add (yomiDict , 0 , 1 );
45+ grid .add (meaningLabel , 0 , 2 );
4146 Scene scene = new Scene (grid , 640 , 480 );
4247
43- var font = new Font ("Segoe UI" , 24 );
48+ var font = new Font ("Segoe UI" , 18 );
4449 kanjiLabel .setFont (font );
4550 meaningLabel .setFont (font );
51+ yomiDict .setFont (font );
4652 stage .setScene (scene );
4753 stage .show ();
4854
@@ -64,10 +70,14 @@ public void start(Stage stage) {
6470 if (result .bestMatchingCharacters .equals (lastResult )){
6571 continue ;
6672 }
73+
74+
75+ var yomiMeaning = translator .searchFor (result .words .get (0 ).kanji );
6776 //Change the kanji labels text
6877 Platform .runLater ( () -> {
6978 this .kanjiLabel .setText (result .words .get (0 ).kanji );
70- this .meaningLabel .setText (result .words .get (0 ).description );
79+ this .yomiDict .setText ("YomiDict:\n " + yomiMeaning );
80+ this .meaningLabel .setText ("InternalDict: \n " + result .words .get (0 ).description );
7181 });
7282
7383 lastResult = result .bestMatchingCharacters ;
0 commit comments