java - Parent pane should get resized to outer bounds of rotated child pane -



java - Parent pane should get resized to outer bounds of rotated child pane -

i want pane resized rotated kid pane. problem: code:

public class test extends application { public void start(final stage stage) throws exception { pane p1 = new pane(); p1.setbackground(new background(new backgroundfill(color.cyan, null, null))); p1.setprefsize(100, 100); p1.setminsize(100, 100); p1.setmaxsize(100, 100); p1.setrotate(45); pane p2 = new pane(p1); p2.setbackground(new background(new backgroundfill(color.red, null, null))); p2.setlayoutx(150); p2.setlayouty(150); grouping root = new group(p2); scene scene = new scene(root); stage.settitle("pane test"); stage.setscene(scene); stage.setwidth(400); stage.setheight(400); stage.setresizable(false); stage.show(); } public static void main(string[] args) { launch(args); } }

i want parent pane cover area obstructed kid entirely. should this:

i got working putting pane p1 grouping , set grouping borderpane instead of pane p2 position center. maybe not best solution because using node, works.

public class test extends application { public void start(final stage stage) throws exception { pane p1 = new pane(); p1.setbackground(new background(new backgroundfill(color.cyan, null, null))); p1.setprefsize(100, 100); p1.setminsize(100, 100); p1.setmaxsize(100, 100); p1.setrotate(45); grouping g = new group(p1); borderpane.setalignment(g, pos.center); borderpane p2 = new borderpane(g); p2.setbackground(new background(new backgroundfill(color.red, null, null))); p2.setlayoutx(150); p2.setlayouty(150); grouping root = new group(p2); scene scene = new scene(root); stage.settitle("pane test"); stage.setscene(scene); stage.setwidth(400); stage.setheight(400); stage.setresizable(false); stage.show(); p1.setrotate(20); } public static void main(string[] args) { launch(args); } }

java layout javafx pane

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -