Monday, 15 February 2010

javafx - Call event handler -



javafx - Call event handler -

i have tabpane test button calls code:

button bt1 = new button("select"); bt1.setonaction(new eventhandler<actionevent>() { @override public void handle(final actionevent event) { treeclass.getconnectedagentsmap(); treepane.gettreeview().getselectionmodel().clearandselect(3); } });

this code selects treenode treeview:

cell.setonmouseclicked((mouseevent me) -> { if (!cell.isempty()) { /// action } });

as can see event triggered when mouse selects tree row. tried phone call tree cell action code:

cell.selectedproperty().addlistener(new changelistener<boolean>() { @override public void changed(observablevalue<? extends boolean> observable, boolean oldvalue, boolean newvalue) { /// action } });

but it's not proper way utilize because several times new tab opened. there way when click button phone call action event?

final point2d windowcoord = new point2d(scene.getwindow().getx(), scene.getwindow().gety()); final point2d scenecoord = new point2d(scene.getx(), main.getstage().getscene().gety()); final point2d nodecoord = mycontrol.localtoscene(0.0, 0.0); final double x = math.round(windowcoord.getx() + scenecoord.getx() + nodecoord.getx()); final double y = math.round(windowcoord.gety() + scenecoord.gety() + nodecoord.gety()); seek { robot robot = new robot(); robot.mousemove(new double(x).intvalue()+1, new double(y).intvalue()); robot.mousepress(inputevent.button1_mask); robot.mouserelease(inputevent.button1_mask); } grab (awtexception ex) { ex.printstacktrace(); }

some of code borrowed this website.

javafx javafx-2 javafx-8

No comments:

Post a Comment