public MaterialToolbar() { getStyleClass().add("material-toolbar"); mainIcon = new AnimatedIcon(); mainIcon.setIconFill(Color.WHITE); changeViewAnimationCircle = new Circle(); changeViewAnimationCircle.setOpacity(0); changeViewAnimationCircle.setManaged(false); currentTitle = new Label("Main"); currentTitle.getStyleClass().add("material-toolbar-text"); changeViewAnimationTitle = new Label(); changeViewAnimationTitle.setOpacity(0); changeViewAnimationTitle.getStyleClass().add("material-toolbar-text"); background = new Rectangle(); background.setManaged(false); background.setFill(Color.DARKSLATEBLUE); backgroundClip = new Rectangle(); backgroundClip.setFill(Color.BLACK); backgroundClip.xProperty().bind(background.xProperty()); backgroundClip.yProperty().bind(background.yProperty()); backgroundClip.widthProperty().bind(background.widthProperty()); backgroundClip.heightProperty().bind(background.heightProperty()); changeViewAnimationCircle.setClip(backgroundClip); actionBox = new HBox(); actionBox.setSpacing(6); getChildren() .addAll( mainIcon, changeViewAnimationCircle, currentTitle, changeViewAnimationTitle, background, actionBox); background.toBack(); changeViewAnimationCircle.toFront(); changeViewAnimationTitle.toFront(); currentTitle.toFront(); mainIcon.toFront(); actionBox.toFront(); }