JavaFX editable ComboBox in a table view -


i using editable combobox cell in table view. here combobox cell class

public class comboboxcell extends tablecell<classesproperty, string> {      private combobox<string> combobox;      public comboboxcell() {     }      @override     public void startedit() {         super.startedit();          if (combobox == null) {             createcombobox();         }          setgraphic(combobox);         setcontentdisplay(contentdisplay.graphic_only);           platform.runlater(new runnable() {              @override             public void run() {             combobox.requestfocus();             combobox.geteditor().requestfocus();             combobox.geteditor().selectall();               }         });       }      @override     public void canceledit() {         super.canceledit();          settext(string.valueof(getitem()));         setcontentdisplay(contentdisplay.text_only);     }      public void updateitem(string item, boolean empty) {         super.updateitem(item, empty);          if (empty) {             settext(null);             setgraphic(null);         } else {             if (isediting()) {                 if (combobox != null) {                     combobox.setvalue(getstring());                 }                 setgraphic(combobox);                 setcontentdisplay(contentdisplay.graphic_only);             } else {                 settext(getstring());                 setcontentdisplay(contentdisplay.text_only);             }         }     }      private void createcombobox() {         // classescontroller.getlevelchoice() observable list of string         combobox = new combobox<>(classescontroller.getlevelchoice());         combobox.seteditable(true);         combobox.setminwidth(this.getwidth() - this.getgraphictextgap()*2);         combobox.setonkeypressed(new eventhandler<keyevent>() {             @override             public void handle(keyevent t) {                 if (t.getcode() == keycode.enter) {                     commitedit(combobox.getselectionmodel().getselecteditem());                 } else if (t.getcode() == keycode.escape) {                     canceledit();                 }             }         });     }      private string getstring() {         return getitem() == null ? "" : getitem().tostring();     } } 

the problem need press 3 clicks on table cell text field of combo box edit contents. there way make in 2 clicks? used platforn runlater when try edit cell @ first time takes 3 mouse clicks @ second time 2 clicks.

in overridden cell.startedit() method, add listview textfield, add listview setgraphic. show listview directly once row selected , cell clicked, listview inside tablecell, yet find way make popup


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -