Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove gray bg behind the tabs in JFX

Tags:

So is there any way to remove the gray area behind the tab(s): example

I've tried to do this with CSS, but didn't find how.

like image 252
4lex1v Avatar asked May 15 '12 21:05

4lex1v


Video Answer


2 Answers

To set the background color of the tabpane header write in the CSS file:

.tab-pane .tab-header-area .tab-header-background {
    -fx-background-color: yellow;
}


To remove the borders write:

.tab-pane .tab-header-area .tab-header-background {
    -fx-effect: null;
}


To remove the header completely set opacity to 0:

.tab-pane .tab-header-area .tab-header-background {
    -fx-opacity: 0;
}


More on style class tab-pane you can find here:
http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html#tabpane

like image 134
user2229691 Avatar answered Oct 09 '22 17:10

user2229691


JavaFX has a built-in default CSS sheet named caspian.css. Please read this post: https://stackoverflow.com/a/10149050/682495.
To change the default CSS, add this selector to your CSS file and customize it:

.tab-pane *.tab-header-background {
    -fx-background-color: -fx-outer-border, -fx-inner-border, derive(-fx-color, -20%);
    -fx-effect: innershadow(two-pass-box , rgba(0,0,0,0.6) , 4, 0.0 , 0 , 0);
}
like image 31
Uluk Biy Avatar answered Oct 09 '22 16:10

Uluk Biy