Questions tagged [javafx-css]

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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
52 views

Best Approach for Managing CSS Stylesheets and Style Classes in a JavaFX Application

I'm working on a JavaFX application with numerous CSS files. These CSS files are unique in that they don't extend control classes like .vbox {} or .button {}; instead, they define custom node CSS ...
FARS's user avatar
  • 321
1 vote
0 answers
81 views

JavaFX choicebox [combobox] Prompt Text Color

I am working on a project using JavaFX. I have a question about styling the choicebox control UI. I am new to JavaFX, so please be kind. For the choicebox UI control, I changed the prompt background ...
Steve T's user avatar
  • 323
1 vote
0 answers
51 views

JavaFX css, loaded from a fxml file, doesn't seem to be loading an image

So, I am making a project where I need to add a background image to an anchor panel, and I am trying to be clean and use a separate css. So far my project structure looks like this: D:. ├───.idea │ └...
Gabe Lily's user avatar
0 votes
1 answer
45 views

Inline JavaFX CSS has troubles with properties

I have a LineChart and I want to change the -fx-background-color of its -chart-plot-background property. I want to do it without using an external CSS file (and only through the code, since I want to ...
Keen Teen's user avatar
2 votes
1 answer
90 views

Removing the blue color effect when DatePicker is clicked

Is there a way to change the default color that makes the DatePicker's textField appear to be highlighted in blue when it's clicked? I have read all related questions that I came accross after hours ...
Mira's user avatar
  • 43
0 votes
1 answer
32 views

JavaFX : style defined in fxml file (via SceneBuilder) cannot be overridden by the CSS file, how do I do this?

How do I force style from CSS to override style from FXML So I have an fxml file to which I added style (via Scene Builder, it works). I have given the nodes a style class name, and am calling it ...
Jax's user avatar
  • 23
2 votes
1 answer
106 views

How to fix out-of-place 'expected RBRACE' error when parsing CSS with jfx?

I was adding some variables to my CSS file, and I seem to have broken it. I have never used variables in CSS before (im not much of a front-end guy), so I dont know, if I did something wrong or the ...
Luh0's user avatar
  • 105
4 votes
1 answer
325 views

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 ...
human0id's user avatar
2 votes
1 answer
163 views

JavaFX: Give Line Chart Series of multiple tables different colors

I have an application that displays several Line Charts with several Series like this: I'd like to change the color of each Series but haven't found a way to achieve this. The only thing I found is ...
Wewius's user avatar
  • 87
3 votes
1 answer
224 views

Can't use a CSS located inside a JAR file in an JavaFX FXML scene

When I open the following FXML file in IntelliJ: <VBox alignment="CENTER" spacing="20.0" stylesheets="@/org/kordamp/bootstrapfx/bootstrapfx.css" xmlns="http://...
Juanan's user avatar
  • 1,385
0 votes
1 answer
81 views

How create Indent for letters in button. JavaFX [closed]

I have standard button and me need create indent for letters in this button, how it do? Sorry behind my English.. I had tried find in documentation JavaFX CSS the decision but him not or i him no find....
Dokat's user avatar
  • 11
2 votes
0 answers
56 views

JavaFX CSS - How to curve a border radius outwards?

I am trying to give a tab the following effect when being selected: Example image You can see the selected export tab's bottom right corner curving over on top of the other tab. How could this be ...
Valtteri Valo's user avatar
0 votes
1 answer
27 views

How to use Partial Border with CSS in javaFX?

So i am working on an App and in menu bar, I would like to give Menu elements some cool looking separators. So I found a way that seems to work with HTML: .menu { border-right: 2px dotted #666666; ...
Stanisław Maliński's user avatar
-1 votes
1 answer
427 views

I'm trying to change the background color of textarea in scenebuilder, but the outline color is changing

In similar questions, it was written that if you set the background-color style, the background color will change, but in my case the outline changes Scene Builder configuration: Result: And for ...
skver's user avatar
  • 3
0 votes
2 answers
257 views

Why aren't my CSS borders showing up in JavaFX gui?

I'm trying to show walls on the GUI (fxml) with CSS borders using .getStyleClass().add() but they're not showing up. I'm using a switch that adds the corresponding style classes to the cells. The Java ...
Ludvig Nobel's user avatar
0 votes
0 answers
111 views

JavaFX button hover underline animation like in css

Can you give me tips to create this animation in JavaFX? animation Or underline may move from left to right My current .css file .button{ -fx-background-color: rgba(0,0,0,0.1); -fx-shape: &...
zawww's user avatar
  • 1
-2 votes
1 answer
250 views

Why does JavaFX Node have wrong sizes in initialize method after css is applied?

I have a VBox that have several AnchorPane. I decided to add css style to these AnchorPane: -fx-border-width. But the VBox is inside another "main" AnchorPane, and main AnchorPane is inside ...
MicroKlizma's user avatar
1 vote
0 answers
260 views

Customize ControlsFX Notification Popup using CSS

I am using the ControlsFX Notifications class to create a notification popup. Everything about it is great, except for the fact that I can't style it with CSS. From the research that I did, it says ...
JMisley's user avatar
  • 11
3 votes
0 answers
586 views

error in java (Javafx): com.sun.javafx.css.StyleManager$ImageCache getCachedImage

I am having a problem adding an image to my button in javafx. The program hierarchy is as in the image: the marks are for the files working with the button the fxml to create the button are ...
Abdelrahman Nassar's user avatar
0 votes
0 answers
157 views

JavaFX Make WebEngine setUserStyleSheetLocation detect CSS file in a JAR

I'm trying to style a JavaFX WebEngine using the setUserStyleSheetLocation method. The method's documentation says it requires a "local URL" starting with data:, file:, jar:, or jrt:. I want ...
Sam Hooper's user avatar
0 votes
1 answer
100 views

Can you dynamically apply a colour scheme to a single css file?

I have 4 different css files that are identical except they use different colour schemes i.e. red, blue, green. At the start of my program a user chooses which colour scheme they want and then the ...
user avatar
1 vote
1 answer
353 views

JavaFX TabPane remove border between Tabs and content

I want to remove the tiny border between the Tabs in a TabPane and their content. This border is part of the headers-region, and I've put its background in green in the images below. My application (...
Sam Hooper's user avatar
2 votes
1 answer
429 views

Is there a way to make a Datepicker round? (JavaFX)

I've been trying to customize with css my JavaFX application...so far so good untill I reach the Datepicker... I tried a lot of different aproaches but none of them seem to work. Is there a way to ...
David Reyes's user avatar
0 votes
1 answer
438 views

What's the difference between -fx-text-fill and -fx-text-inner-color in JavaFX CSS?

From the JavaFX CSS Reference Guide I know enough about the -fx-text-fill property to use it. Working on a larger JavaFX project that has recently been updated to JavaFX 16, I came across some CSS ...
Chaoskatze's user avatar
2 votes
1 answer
120 views

JavaFX css grid inconsistent

The following code produces and infinitely pannable grid and also allows for zooming in and out. The grid is being drawn using css. My issue is that the css grid doesn't work well when zoomed in very ...
Asis's user avatar
  • 339
0 votes
2 answers
1k views

Add css style to ButtonType in JavaFX

I have an alert. I'm adding two ButtonTypes to it. I'm also adding a stylesheet to it. But how can I make the Discard changes red? I have already a btn-red class in my CSS file. Alert alert = new ...
SDG6's user avatar
  • 83
3 votes
1 answer
499 views

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 :...
jpell's user avatar
  • 198
0 votes
1 answer
541 views

How can I apply a drop shadow to the bottom of a table row on hover

This is giving me only a drop shadow on top. Increasing the y-offset does nothing. It looks like it might be "behind something" .table-row-cell:hover { -fx-effect: dropshadow(gaussian, ...
jpell's user avatar
  • 198
4 votes
1 answer
694 views

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 ...
Tech Expert Wizard's user avatar
0 votes
2 answers
230 views

How to remove a line of shadow under javafx button

Using JavaFX 15 There's a line of shadow below the border of the JavaFX FXML button. is it possible to make it transparent using CSS? As I do not know which attribute it belongs to. Picture of the ...
Teo Shi Bin's user avatar
0 votes
0 answers
83 views

JavaFX CSS how do I blend Text color to appear as white when a progress bar overlaps it?

I have this image of a progress bar: I am trying to make the text change color as the bar overlaps it. I have no idea how to do this in JavaFX since it is not as flexible as the known CSS. I tried to ...
Laith Budairi's user avatar
0 votes
0 answers
381 views

Styling DatePicker ArrowButton in Javafx

How to achieve the following style for Datepicker Arrow Button? I am able to Achieve the following Style For Arrow Button. Below Css is used for achieving the above style .date-picker > .arrow-...
Viraj Shedge's user avatar
0 votes
1 answer
1k views

How to remove blue focus border from TableView?

I'm styling a TableView. I set the border color to white (same as background color) so it is invisible. However, when the table is focused, the border becomes blue. I tried adding table-view:focused { ...
Allan Juan's user avatar
  • 2,157
0 votes
1 answer
328 views

Styling JFoenix Tabpane

I am using JFoneix Library for creating a tabpane in javafx. Everything works fine however i am unable to remove the extended line connecting the tabs. How can i achieve that? Below Css has been used ...
Viraj Shedge's user avatar
0 votes
1 answer
848 views

Cannot add CSS classes to my JavaFX Label

I am making a simple todolist app. Here is a watered-down version of it: public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception{ ...
Ayaan Pathan's user avatar
0 votes
0 answers
720 views

Cant find CSS style sheet in java fx

So this is the file structure im working with, I have the app.java as my main java file and I tried these two lines of code to no avail scene.getStylesheets().add("mainpage.css"); scene....
andrewaleks's user avatar
4 votes
3 answers
474 views

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 ...
Joseph_Marzbani's user avatar
0 votes
1 answer
370 views

center align textarea in JavaFX with CSS

I know I am supposed to set -fx-text-alignment: center; in order to achieve a center-aligned textarea. #txtFaContent { -fx-text-alignment: center; } with txtFaContent being the ID of my textarea ...
Joseph_Marzbani's user avatar
0 votes
1 answer
180 views

How do you make ENTER trigger onAction for JavaFX globally?

I saw in another question that this was the solution for when you want to press enter to trigger onAction btn.defaultButtonProperty().bind(item_btn.focusedProperty()); Is there a way to do this ...
pam's user avatar
  • 113
0 votes
1 answer
1k views

How to add a hover property to button from the javafx controller instead of CSS

Suppose I have a toggle button in JavaFX CSS defined as such. .btn:hover{ -fx-background-color: #ffffff; } I have several toggle buttons in a FlowPane, but they all need to have different colors ...
pam's user avatar
  • 113
0 votes
0 answers
196 views

How can I align text directly beneath an image In FXML?

In HTML5 to alight a text directly beneath an image we can use <figcaption>. <figure> <img src="img.jpg" alt="my img"/> <figcaption> Your text </figcaption> </...
user avatar
0 votes
1 answer
596 views

How to set the margin and padding of an ImageView?

How to set the margin and the padding of an <ImageView>? I did fx-padding: 50px; and fx-margin: 50px; but it doesn't work. My code : <ImageView style="fx-padding: 50px; fx-margin: 50px;" ...
user avatar
0 votes
0 answers
242 views

newline in javafx fxml or css

I'm new to javafx (and pretty much programming in general) and am trying to add \n characters to my fxml file. I've tried the text="${'10\nquestions'}" method as a test but I get can't resolve symbol '...
chewy19's user avatar
0 votes
1 answer
1k views

How to style the GridPane using CSS in JavaFx

I'm new in JavaFx. I have a GridPane created in FXML. I want to style that GridPane as the following image. I have tried with the following answers and tried with more CSS elements. But none of these ...
H Athukorala's user avatar
5 votes
2 answers
1k views

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 ...
Alex Johnson's user avatar
0 votes
0 answers
537 views

JavaFx: Context menu dynamic style

I have a problem with context menus. The items in the context menu can be styled, but it doesn't work dynamic. I mean for example at the initialize I add a styleclass to the MenuItem and by an event I ...
Sunflame's user avatar
  • 3,065
0 votes
1 answer
383 views

JavaFX - Style first and last tab only

Is there a way (CSS or Java) to style first and last tab only in a dynamic TabPane? Example : Thanks!
adxl's user avatar
  • 849
0 votes
1 answer
1k views

JavaFX change selected tab close button background programmatically

I'm trying to change the close icon background of the selected tab only, the problem is that it works when there is one tab, but when I add more nothing happens until I close the first one, here is ...
adxl's user avatar
  • 849
3 votes
1 answer
6k views

Button Hover and pressed effect CSS Javafx

I am new to CSS and have the following CSS style defined for the button, with the id and the custom style is applied, but not the hover and pressed effect. #bevel-grey { -fx-background-color: ...
Lakshmi Narayanan's user avatar
1 vote
1 answer
207 views

How to separate a border and an effect?

Currently, I have a button with the following CSS: Button { -fx-text-fill: -fx-color-text; -fx-font: 15pt "Raleway SemiBold"; -fx-background-color: -fx-color-theme; -fx-...
FireController1847's user avatar