java - how can i display an object's string method using javafx? -


the main method in calculate extends enemytype class. switch statement has 9 cases nested in while loop each instantiating subclass constructs enemytype. (should uml diagram or something?) void calc() method displays result in system output, ending switch statement, returning loop in calculate main() method.

this class attempts use javafx.scene.control.combobox; fire nested switch statement. think issue somewhere between descriptionpane, or setall() void method in subclasses. contents of subclass setall() void method display in descriptonpane, or label or something. prints console.

@override public void start(stage primarystage) {     descriptionpane d = new descriptionpane();     label lbl = new label();      combobox<string> cbotypes = new combobox<>();     observablelist<string> items = fxcollections.observablearraylist       ("light grineer", "medium grineer", "heavy grineer",                "light corpus", "medium corpus", "heavy corpus",               "light infested", "medium infested", "heavy infested");     cbotypes.getitems().addall(items);     cbotypes.setvalue(items.get(0));     cbotypes.setonaction(e -> {          currentindex = items.indexof(cbotypes.getvalue());          switch(currentindex){         case 1: system.out.println("lightgrineer"); new lightgrineer().setall();         case 2: system.out.println("mediumgrineer"); new mediumgrineer().setall(); break;         case 3: system.out.println("heavygrineer"); new heavygrineer().setall(); break;         case 4: system.out.println("lightcorpus"); new lightcorpus().setall(); break;         case 5: system.out.println("mediumcorpus"); new mediumcorpus().setall(); break;         case 6: system.out.println("heavycorpus"); new heavycorpus().setall(); break;         case 7: system.out.println("lightinfested"); new lightinfested().setall(); break;         case 8: system.out.println("mediuminfested"); new mediuminfested().setall(); break;         case 9: system.out.println("heavyinfested"); new heavyinfested().setall(); break;      }       });     vbox vbox = new vbox(20);     vbox.getchildren().add(d);     vbox.setalignment(pos.center_left);      hbox hbox = new hbox(10);     hbox.getchildren().addall(new label("choose enemy type: "), cbotypes);     hbox.setalignment(pos.center);       borderpane pane = new borderpane();     pane.setbottom(hbox);     pane.setleft(vbox);      // create scene , place in stage     scene scene = new scene(pane, 900, 400);     primarystage.settitle("enemytypes_by_johnryan"); // set stage title     primarystage.setscene(scene); // place scene in stage     primarystage.show(); // display stage    } 


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -