MouseListener on editable JavaFX ComboBox -


mouseevent not working javafx combobox when set editable. working on non editable combobox. there way set mouseevent on editable combobox?

package editablecombobox;  import javafx.application.application; import javafx.event.eventhandler; import javafx.scene.scene; import javafx.scene.control.combobox; import javafx.scene.input.mouseevent; import javafx.scene.layout.stackpane; import javafx.stage.stage;  public class editablecombobox extends application {  @override public void start(stage primarystage) {     combobox combo = new combobox();     combo.seteditable(true);      combo.setonmousepressed(new eventhandler<mouseevent>() {    //adding mouseevent on combobox         @override         public void handle(mouseevent event) {             system.out.println("mouse pressed!!!");         }      });      stackpane root = new stackpane();     root.getchildren().add(combo);      scene scene = new scene(root, 300, 250);      primarystage.setscene(scene);     primarystage.show(); }  public static void main(string[] args) {     launch(args); }  } 

setonmousepressed not working.

i guess interested in editable textfield area of combobox. need add mouselistener editor(textfield) of combobox. try using :

combo.geteditor().setonmousepressed(new eventhandler<mouseevent>() {          @override      public void handle(mouseevent event) {         system.out.println("mouse pressed!!!");      } }); 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -