In JavaFX 2, using CSS, is it possible to create a background with 2 colors? Think of e.g. a TableCell with a height of 10 px. I want to the first 2 px (vertica
Look, how to understand the CSSRef:
http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html
Look at
-fx-background-image :
uri [ , uri ]*
A series of image URIs separated by commas.
Look at
-fx-background-repeat
repeat-style [ , repeat-style ]*
where repeat-style = repeat-x | repeat-y | [repeat | space | round | stretch | no-repeat]{1,2}
A series of values separated by commas. Each repeat-style item in the series applies to the corresponding image in the background-image series.
Look at : -fx-background-position
bg-position [ , bg-position ]* where = [ [ [ size | left | center | right ] [ size | top | center | bottom ]? ] | [ [ center | [ left | right ] size? ] || [ center | [ top | bottom ] size? ] ]
A series of values separated by commas. Each bg-position item in the series applies to the corresponding image in the background-image series.
So, what can you see : you should describe 2 images, (2x2 pixels each - one red and one - grey) Two bg positions, and two repeat styles for each of them corresponding.
How?
example :
{
-fx-backdround-image : "path_to_red", "path_to_grey";
-fx-background-repeat : repeat-x, stretch;
-fx-background-position : 0px 0px, 0px 2px;
}
I don't give a garantee on workness of the code, but the idea seems correct.
Maybe possible with only colors instead of images when using insets. Example from original JavaFX CSS:
.table-row-cell:odd {
-fx-background-color: -fx-table-cell-border-color, derive(-fx-control-inner-background,-5%);
-fx-background-insets: 0, 0 0 1 0;
}
[6 characters...]