scaletransform - Javafx Scalling Up and down a visit card with ScaleTransition does not work -
i need scale visit card on mouse entered , scale down it's original size on mouse exited use 2 scaletransition 1 scale , 1 scale down. it's works when mouse entered/exited on single visit card when pass mouse on multiple visit card become bigger , bigger or smaller , smaller. don't know how manage this.
here's code :
public class itemvisitcardpanel extends borderpane{ private runnable loadingtask; private scaletransition scaletransition01; private scaletransition scaletransition02; private jfxdepthmanager depthmanager; public itemvisitcardpanel() { super.setminheight(180.0); super.setmaxwidth(475.0); super.setpadding(new insets(10)); this.getstyleclass().add("rounded-pane"); this.getstyleclass().add("bordered-pane-thin-level03"); this.getstyleclass().add("item-visit-card"); this.scaletransition01 = new scaletransition(duration.millis(200), this); this.scaletransition01.setbyx(0.1f); this.scaletransition01.setbyy(0.1f); this.scaletransition02 = new scaletransition(duration.millis(200), this); this.scaletransition02.setbyx(-0.1f); this.scaletransition02.setbyy(-0.1f); this.depthmanager = new jfxdepthmanager(); this.setonmouseentered(evententered->{ if(!this.scaletransition01.getstatus().equals(animation.status.running) && !this.scaletransition02.getstatus().equals(animation.status.running)){ this.scaletransition01.play(); this.depthmanager.setdepth(this,5); } }); this.setonmouseexited(eventexited->{ if(!this.scaletransition02.getstatus().equals(animation.status.running) && !this.scaletransition01.getstatus().equals(animation.status.running)){ this.scaletransition02.play(); this.depthmanager.setdepth(this,0); } }); } /** * définit une tache de background qui va par exemple charger une image ou autre * @param loadingtask */ public void setloadingtask(runnable loadingtask) { this.loadingtask = loadingtask; } public runnable getloadingtask() { return loadingtask; } public void setminsize(int width,int height){ if(width>0 && height >0){ super.setminsize(width, height); } } }
Comments
Post a Comment