4

I am trying to create a panel inside another panel. The inner one is supposed to be larger than the parrent, but whatever extends beyond the parent's bounds should not be painted. How do i do that?

Note: it is important that the child is larger than the parent, so please note that i can not bind childs dimensions to the parent's ones.

Help!

user3455810
  • 99
  • 1
  • 7
  • Look at [How to restrict visibility of items?](http://stackoverflow.com/questions/15920680/how-to-restrict-visibility-of-items) and [Clip an HBox inside a GridPane](http://stackoverflow.com/questions/15476063/clip-an-hbox-inside-a-gridpane). – Uluk Biy Mar 24 '14 at 17:45

1 Answers1

7

Better late than never, you simply have to clip your child node to a Rectangle that will act as a viewport :

childPane.setClip(new Rectangle(400, 277));
Someone
  • 216
  • 3
  • 8