how to use border spacing property in javafx ?
Like in css for html
table.ex1 {
border-collapse: separate;
border-spacing: 10px 50px;
}
How do i use border spacing in javafx?
Inside a TabPane wherer i want to put a bottom border under each tab and my css is
.tab-pane:focused > .tab-header-area > .headers-region > .tab:selected .focus-indicator {
-fx-border-width: 4px;
-fx-border-color: transparent transparent white transparent;
}
its working and i have nice bottom border but i need some more border spacing , so someone please tell me how to do that ?
thanks in advance.
.tab:top{
-fx-background-color: transparent;
-fx-border-insets: 0 0 0 0;
-fx-border-color: white white white white ;
-fx-padding: 15px;
}
I think there is no border-spacing type property in javafx css but anyway you can do it in TabPane by -fx-padding property for tab.
Add some -fx-border-insets. Something like
.tab-pane:focused > .tab-header-area > .headers-region > .tab:selected .focus-indicator {
-fx-border-width: 4px, 0px;
-fx-border-color: transparent transparent white transparent, transparent;
-fx-border-insets: 0px 0px 2px 0px, 0px 0px 4px 0px ;
}
Check the CSS documentation for Region for details.
Related
I have this css styling for tabpane javafx:
.tab {
-fx-background-color: #002f6c;
}
.tab-pane>*.tab-header-area>*.tab-header-background
{
-fx-background-color: -fx-outer-border, -fx-text-box-border, #002f6c;
}
.tab:selected {
-fx-background-color: #0041a0;
}
.tab-label {
-fx-text-fill: #ffffff;
}
.tab-pane:focused > .tab-header-area > .headers-region > .tab:selected .focus-indicator
{
-fx-border-radius: 0px;
-fx-border-width: 0px 0px 0px 0px;
-fx-border-color: #4d1a4dff;
}
But i still can't rid of this white border near my tabs:
Can somebody help me with it?
The white border effect is because of the background color insets applied on .tab-header-background. Modifiying the code below should do the trick.
.tab-pane>*.tab-header-area>*.tab-header-background {
-fx-background-color: #002f6c;
-fx-background-insets:0;
}
I'm trying to create a button that has two colors as a border.
The two colors i need used are blue: #00a7e1, orange: #f6531d.
I would like to just use css if possible.
Thank in advance!
link to button concept
Example:
.btn
{
border: 0;
padding: 4px;
display: inline-block;
background: linear-gradient(20deg, #00a7e1 49%, #e65300 50%);
}
.bg
{
background: #349645;
padding: 8px 14px;
font: bold 24px Consolas;
}
.btn:active .bg
{
background: #0a1117;
color: #ffffff;
}
<div class="btn"><div class="bg">YOU'R TITLE</div></div>
<button class="btn"><div class="bg">YOU'R TITLE</div></div>
You may also play with gradient and background-clip (see comments in CSS)
button {
vertical-align: top;
border: 5px solid transparent;/* give extra space for gradients colors */
font-size: 2.5rem;
margin: 0.25em;
padding: 0.5em 2em;
background: linear-gradient(#333, #333),/* black turned into gradient to hold with background-clip and hide the 2 color gradient under it */
linear-gradient(/* 2 colors to draw under the borders also via background-clip*/
to bottom left,
rgb(230, 83, 0) 50%,
gray 51%,
rgb(0, 166, 224) 40%
)
no-repeat center center;
background-clip:
padding-box, /* drawn inside including padding area */
border-box;/* drawn also under borders */
background-size:
100% 100%,
110% 150%;/* must be bigger than 100% so it include also borders, else it repeats */
color: white;
box-shadow: 0 0 2px 2px black, inset 0 0 2px black;/* did you want this too ? */
}
<button>BUTTON</button> <button> TO</button> <button> PLAY</button>
If you think this is too much, you also have border-image .
Simply use border-image with a gradient:
button {
padding:20px;
border:5px solid;
border-image:linear-gradient(60deg,#00a7e1 50%,#f6531d 0) 20;
background:transparent;
}
<button>some text</button>
I am using .tab-pane .tab {} to change tab header color and width. This has no problem.
.tab-pane .tab
{
-fx-background-color: linear-gradient(to bottom, repeat, #CCCCCC , #808080 );
-fx-pref-width: 150.0;
-fx-text-alignment: CENTER; <-- does not work
}
However, the text alignment has no effect, how do I do this?
Having a look on modena.css searching for the TabPane you will find out that the tab-label alignment is already by default to the CENTER but you have change the width of the .tab to 150.0 although the label width is still the same. So you need to specify the alignment and the width to the tab's label as well like this :
.tab-pane .tab
{
-fx-background-color: linear-gradient(to bottom, repeat, #CCCCCC , #808080 );
-fx-pref-width: 150.0;
}
.tab-pane > .tab-header-area > .headers-region > .tab > .tab-container > .tab-label {
-fx-alignment: CENTER;
-fx-pref-width: 150.0;
-fx-text-fill: -fx-text-base-color;
}
I am currently using CSS to create a dark theme for an application I created. I am having issue creating a dark themed scrollbar, which appears inside a TreeTableView. Most of the scrollbar looks correct, but there is a small extra header created that isn't styled. Here is a picture, of my progress below:
The TreeTableView is very simple. It has two TreeTableColumns.
My current css relating to the table is below:
.tree-table-view
{
-fx-background-color: #404040;
}
.tree-table-view .scroll-bar
{
-fx-background-color: transparent;
}
.tree-table-view *.column-header-background *.show-hide-columns-button
{
-fx-background-color: #404040;
}
.tree-table-column
{
-fx-background-color: #404040;
-fx-border-color: #2d862d;
-fx-border-width: 0px 1px 0px 0px;
}
.tree-table-column .label
{
-fx-border-color: #2d862d;
-fx-border-insets: 0px 5px 0px 5px;
-fx-border-width: 0px 0px 1px 0px;
}
.tree-table-cell
{
-fx-text-fill: #e6e6e6;
-fx-padding: 0px 5px 0px 5px;
}
.tree-table-row-cell .arrow
{
-fx-background-color: #2d862d;
}
Does anyone know what css class I can use to make the white 'extra header' in the top-left corner have a black background? I would really appreciate it.
Any help will be greatly appreciated. Thanks!
.tree-table-view .filler {
}
Was the selector I needed. Thanks JNS!
i'd like to customize the appearance of a Menu in my JavaFX8 application. How can i get rid or style the color of the 'white outline' shown in the following screenshot?
i tryed:
#MainMenuBar
{
-fx-text-fill: #bbbbbb;
-fx-background-color: #3c3f41;
-fx-border-color: #555555;
-fx-border-style: solid;
-fx-border-width: 0 0 1px 0;
}
.menu-item
{
-fx-background-color: #3c3f41;
-fx-text-fill: #bbbbbb;
-fx-border-color: transparent;
}
but it still there is this white otuline.
Thx,
seems you have to also style the 'context-menu'.
it worked by adding:
.context-menu
{
-fx-background-color: #3c3f41;
-fx-border-color: #555555;
-fx-border-style: solid;
-fx-border-width: 1px;
}
This and this answers on SO helped me to figure it out, thanks all.