CSS can be used to style a UI created with JavaFX. It is based on CSS version 2.1. This tag should be used for questions about styling JavaFX Nodes using CSS.
Questions tagged [javafx-css]
122 questions
28
votes
2 answers
How do I add margin to a JavaFX element using CSS?
I have the following fragment of FXML:
Is it possible to add a spacing of 10px…
vbezhenar
- 8,347
- 6
- 40
- 53
17
votes
0 answers
JavaFx Css, 'Not' selector
the following css would select all cells with 'new' style class and set it's color to green
.table-view .new:filled {
-fx-background-color: green;
}
but on selection, it stays green, what I want is to respect the usual selection color, so is…
DrAhmedJava
- 661
- 8
- 14
14
votes
1 answer
How to programmatically set the color or texture of a tab label in JavaFX?
I have a TabPane with several Tabs. If the results of an operation in the Tab failed, I want to set the Tab Label to a Fill red or perhaps the texture to hashed (for those with color blindness). I want to reset the Color back to its default,…
likejudo
- 2,611
- 6
- 39
- 83
7
votes
2 answers
Remove arrow on JavaFX menuButton
Hi JavaFX Stylesheet expert,
How do I remove the default arrow on JavaFX menuButton.
I have figured how to change the color and make in unvisible with
.menu-button {
-fx-mark-color: transparent;
}
or
.menu-button .arrow {
…
Ivancodescratch
- 455
- 4
- 12
5
votes
1 answer
How can I change the color of a JFXSlider's thumb according to the color of the slider at the current position of the thumb on the slider?
I'm using a JFXSlider in JavaFX and I've used a linear gradient for the color of the JFXSlider's track (with CSS). However, I'd also like to change the color of the thumb to that of the slider for that position. I've used the following CSS for the…
Tech Expert Wizard
- 343
- 1
- 3
- 18
5
votes
2 answers
How can I make Radio Buttons and Check Boxes change size relative to the system resolution?
I know there are plenty of solutions out there to help with changing the size of a radio button or check box, but I need a way to make the size relative using em in my .css file or some other inline solution.
I'm trying to get my controls to appear…
Alex Johnson
- 434
- 4
- 15
5
votes
1 answer
JavaFX Dropshadow CSS: What do the parameters mean? How to implement width and height in CSS?
I've been searching for this all over the internet, but for most of the questions I viewed that answered in CSS, people just gave code without explaining them.
-fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.3), 10, 0.5, 0.0, 0.0);
For this line of…
Hykilpikonna
- 781
- 8
- 27
5
votes
1 answer
Convert color from CSS to javafx color object
I am wondering if it is possible to convert a color defined in CSS like
.root {
my-blue: rgb(50,100,200);
}
Into a Color Object in JavaFX.
For example with the CSS definition I could use setStyle on a Node to set its…
Zydar
- 167
- 10
5
votes
2 answers
How to change TextArea background color more than once?
I have a TextArea in my JavaFX program that I want to be able to allow the user to set the background color of. I was able to figure out how to change the background color using an external css file by doing this.
.text-area .content {
…
Josh
- 177
- 1
- 1
- 7
4
votes
0 answers
an equivalent feature of the 'not' css selector in javafx
is there a way to do something similar to "not([name="selector"]) " in JavaFX ?
I have a VBox with a styleClass and I want to style its components except for one of them which is indexed by a specific selector, here's approximately what I want to…
otmane42
- 82
- 8
4
votes
2 answers
JavaFX: Multiple selectors modifying the same property
I have a stylesheet like this:
*
{
-fx-font-size: 15px;
}
.title
{
-fx-font-size: 20px;
}
I had thought that since * is more generic than .title, then the -fx-font-size defined in .title would have precedence over it, but I'm wrong. No…
Jai
- 7,616
- 2
- 17
- 43
4
votes
2 answers
The rule "-fx-text-alignment" doesn't work?
I'm creating a simple user interface with JavaFX, where some labels showing texts are used. I tried to move text to the center of labels with the rule:
-fx-text-alignment: center
yet it doesn't work and text is still located on the left by default.…
Oscar
- 1,198
- 1
- 13
- 20
4
votes
2 answers
JavaFX-CSS: How to "move" style of parent to a child?
The trigger for this was a quick experiment to solve TreeItem selection width: the requirement is to highlight only the text, not the whole tree cell. Nothing easier than that (said Frederik :)
implement a custom TreeCell with a Label as graphic…
kleopatra
- 49,346
- 26
- 88
- 189
4
votes
4 answers
JavaFx how to align only one column-header in tableview?
How to align title of only one column in tableview?
The following css aligns all column-header but I want to align just one column:
.table-view .column-header .label{
-fx-alignment:CENTER
}
DOM
- 45
- 1
- 1
- 7
3
votes
1 answer
After adding a drop shadow to a list cell hovering and selection events are bugged
So I added the below fx-css to a list-cell.
.list-cell:selected:filled:hover {
-fx-view-order: -1;
-fx-effect: dropshadow(gaussian, #67676D, 12, 0.05, 0.0, 2);
}
Note when a list-cell is :selected its background is grey.
Now it seems the…
jpell
- 199
- 1
- 9