animation - JavaFX Marquee go out of my node -


i have issue marquee animation javafx. have hbox 3 nodes , in second node have text node inside need marquee transformation, when text goes out of second node need doesn't visible.

i'll go set picture show issue (the text visible in white area).

text introduces inside white node

my hbox code:

    hbox bill = new hbox(0);     bill.getchildren().addall(logopane,product,total);     bill.setbackground(new background(new backgroundfill(color.web("#ffffff"), cornerradii.empty, insets.empty)));     bill.sethgrow(product, priority.always); 

animation:

    timelineanimation = new timeline();     final keyvalue kv = new keyvalue(productlabel.translatexproperty(), -1000);     final keyframe kf = new keyframe(duration.millis(2000), kv);     timelineanimation.getkeyframes().add(kf); 

and how define product node:

productlabel.setfont(new font("times new roman",30));      product = new stackpane();     product.setmaxwidth(2000);     product.setmaxheight(100);     product.setminwidth(574);     product.setminheight(100);      product.getchildren().add(productlabel);     product.setbackground(new background(new backgroundfill(color.red, cornerradii.empty, insets.empty)));     product.setalignment(productlabel, pos.center); 

hope enough information.

thanks!

simply add rectangle clip product pane , bind it's size size of pane:

rectangle clip = new rectangle(); product.layoutboundsproperty().addlistener((observable, oldvalue, newvalue) -> {     clip.setwidth(newvalue.getwidth());     clip.setheight(newvalue.getheight()); }); product.setclip(clip); 

this make sure no descendants of product drawn outside bounds of node.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -