java - JavaFX - Control Item best suited for my needs? -


i want have box keeps list of string objects. not choicebox, combobox, etc because needs displayed without having click open box. user can add new entries entering them in textfield below , pressing enter. control item can't textfield either because you're not able click on individual lines of textfield. in application, i'd able double click on item delete it. if that's easy, maybe double click allow me edit entry?

can here suggest something? of control types know of, cannot think of single thing.

enter image description here

you can use listview textfield. it's rather easy make cells editable, since there way create cell factory using textfieldlistcell.forlistview

listview<string> lv = new listview<>();  // make cells editable lv.seteditable(true); lv.setcellfactory(textfieldlistcell.forlistview());  // print selected item console lv.getselectionmodel().selecteditemproperty().addlistener((observable, oldvalue, newvalue) -> {     system.out.println("selected item: "+ newvalue); });  textfield tf = new textfield(); // add new text textfield item listview tf.setonaction((event) -> {     lv.getitems().add(tf.gettext());     tf.clear(); });  vbox root = new vbox(lv, tf); // todo: add root scene 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -