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.

Useful resources

141 questions
0
votes
1 answer

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 globally for all buttons, or will I have to…
pam
  • 113
  • 1
  • 10
0
votes
1 answer

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 that are determined in the controller. How can I…
pam
  • 113
  • 1
  • 10
0
votes
0 answers

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

In HTML5 to alight a text directly beneath an image we can use
.
my img
Your text
Now I am working on a JavaFX application and I want to alight the next…
user13600214
0
votes
1 answer

How to set the margin and padding of an ImageView?

How to set the margin and the padding of an ? I did fx-padding: 50px; and fx-margin: 50px; but it doesn't work. My code :
user13600214
0
votes
0 answers

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 '10\nquestions'. Learning how to put \n…
chewy19
  • 3
  • 3
0
votes
1 answer

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 helped me to do this. JavaFX CSS class for…
H Athukorala
  • 739
  • 11
  • 32
0
votes
0 answers

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 remove it, but the style still remains there.…
Sunflame
  • 2,993
  • 4
  • 24
  • 48
0
votes
1 answer

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
  • 829
  • 1
  • 9
  • 19
0
votes
1 answer

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 what I did…
adxl
  • 829
  • 1
  • 9
  • 19
0
votes
0 answers

JavaFX change .root css class in runtime

I created a JavaFX application with the scene builder and wanted to adjust the font size according to the current window height on change. So I thought I could declare my font sizes with "em" and just change the css class ".root" to set the "1em"…
YaennuuH
  • 19
  • 2
0
votes
1 answer

I cannot set "-fx-text-fill: white" to external css to style Text nested in a GridPane nested in an Accordion in JavaFX

I have been searching the internet and asking many for help with this problem. I am trying to set the "-fx-text-fill" for a Text component nested within a Girdpane, nested within a TitledPane, nested within an accordion for Javafx. I want to style…
Corbin
  • 77
  • 7
0
votes
0 answers

How do I change the complete combobox in JavaFX via CSS

I created a window in JavaFX Scene Builder and costumized the look via CSS. It works fine but the settings for the combobox doesnt apply for the whole box. How do I correct this?
Zehke
  • 129
  • 1
  • 1
  • 11
0
votes
0 answers

how to solve javafx table-view focused problem?

I have a problem in javafx table view focused problem. This is my table view when unfocused as shown in figure. The table view when focused: But when i am outside of the table view and click show-hide-column button the table does not get…
0
votes
1 answer

how to use Vgrow ALWAYS property in javafx css

I have a table view in javafx scene-builder. I want to use Vgrow ALWAYS property using css. My table-view is within the HBox. The scene-builder allow me to use this property. as shown. But how i do it using css. please help me. I have tried it in…
0
votes
1 answer

JavaFX: How to change the color of text in TextArea corresponding to the selectRange

I am planning to get the range of selected text from TextArea and change the font color of the selectRange. My TextArea is initialized as a part of FXML file. I'm able to get the selectRange by using textArea.getSelection(), I would like to color…
Karthik SP
  • 77
  • 2
  • 12