java - How can I get the default button region as a Shape? -


i struggling intersections need .getshape() on button. api states

when null, region rendered rounded rectangle.

that means default button dont have shape set. don't want .setshape() on button check intersections need .getshape() of button comes null.

is there way default shape of button node while .getshape() returns null ?

i have 2 .observablearraylist() buttons , circles (kind of bubbles)

private final observablelist<circle> circles = fxcollections.observablearraylist(); private final observablelist<button> buttonslist = fxcollections.observablearraylist(); private final objectproperty<boundstype> selectedboundstype = new simpleobjectproperty<>(boundstype.bounds_in_parent); 

then add of buttons , circles obs lists:

buttonslist.addall(rootpane.getchildrenunmodifiable()                     .stream()                     .filter(node -> node instanceof button)                     .map(node -> (button) node)                     .collect(collectors.tolist())); 

circles bit different add them separately mouse click. , check intersections between circles , buttons.

for (button btn : buttonslist) {                 (circle c : circles) {                     shapepair pair = new shapepair(c.getshape(), btn.getshape());                     if (pair.intersects(selectedboundstype.get())) {                         system.out.println("colision");                         //logic                     }                 } } 

but said btn.getshape() gets me null ;(

right think easier do

for (button btn : buttonslist) {     (circle c : circles) {         if (btn.getboundsinparent().intersects(b.getboundsinparent())) {             system.out.println("colision");         }     } } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -