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]
141 questions
31
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
- 11,148
- 9
- 49
- 63
20
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
- 731
- 8
- 16
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
- 3,396
- 6
- 52
- 107
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
- 405
- 4
- 14
7
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
- 75
- 1
- 1
- 7
6
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
- 1,749
- 2
- 15
- 32
6
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
- 187
- 1
- 1
- 9
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
- 504
- 5
- 15
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
- 1
- 10
4
votes
1 answer
How do I correctly use variables in JavaFX CSS Stylesheets?
I am building a small password manager using JavaFX and currently working on make it easy to change the color theme. For that, I declared variables containing the hexcodes of different colors and saved'em in a stylesheet called "utility.css". This…

human0id
- 43
- 2
4
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
- 365
- 1
- 6
- 21
4
votes
3 answers
Where can I find a complete official reference on JavaFX CSS?
When I want to change the background colour of my TextArea in JavaFX (with CSS), many people recommend "-fx-control-inner-background". But when I look up the Oracle's CSS reference there's no such a thing as "-fx-control-inner-background"! In fact…

Joseph_Marzbani
- 1,796
- 4
- 22
- 36
4
votes
0 answers
What is 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
- 535
- 4
- 11
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
- 8,165
- 2
- 21
- 52
4
votes
1 answer
JavaFx menu item accelerator Javafx css
I have tried to iconified JavaFX menu item label. I got the icon duplicated for both menu item label and accelerator label.
Here is an image that illustrates my issue.
Here is the Javafx css code:
.menu-item > .label {
}
#miRestore .label{
…

abdou amer
- 819
- 2
- 16
- 43