I found that I can remove the background of TabPane using CSS. But how I can do this by using
TabPane tabPane = new TabPane(); tabPane.setStyle("-fx-effect: null;");
It's much better to use external style sheets in general, and when you're setting the style of a node which is not part of the api of the controls you've created (the header region, in this case), there's really no other viable option.
If you really want to use setStyle(...) instead of an external style sheet (why????) you could use a lookup:
but lookups seem less robust to me than using the standard mechanisms. You also need to make sure you do this after the css has been applied to the tab pane, which usually means after the stage has been shown.