How to Fire event on scrollBar visible in javaFX? -
at time of scroll bar visible or occur want fire event. till i've done
private scrollbar getverticalscrollbar() { scrollbar result = null; (node n : scrollpaneid.lookupall(".scroll-bar")) { if (n instanceof scrollbar) { scrollbar bar = (scrollbar) n; if (bar.getorientation().equals(orientation.vertical)) { result = bar; } } } return result; } scrollbar bar = getverticalscrollbar();
through can check if scroll bar appear or not
if(bar.isvisible()) { }
but works after scrollbar visible. requirement fire event when scrollbar appear
you can try adding changelistener visible property.something below fire every time visibility changes put logic inside changed method according requirement
result.visibleproperty().addlistener(new changelistener<boolean>() { @override public void changed(final observablevalue<? extends boolean> observablevalue, final boolean aboolean, final boolean aboolean2) { system.out.println("scrol pane visible"); } });
Comments
Post a Comment