Skip to main content

All Questions

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

In javafx apply css styles to only the top-level menus but not their sub-menus

In a javafx proj with fxml & css files for ui design & styling, naturally there is a MenuBar containing a menu-tree like: Edit | Copy Paste View | ShowGrid Show Zoom | ...
Y.F.'s user avatar
  • 69
3 votes
1 answer
64 views

How to Make Table's Horizontal, Vertical corner's Wheel background Color transparent in JavaFx?

Here is the image of the frame. I have highlighted the corners that i want to make transparent. I am facing the issue in making the corners colors of the table transparent. I don't why it is not ...
AdnanArch's user avatar
  • 116
0 votes
1 answer
146 views

:hover not working JavaFX CSS for FontAwesomeIconView

I've got a problem where the :hover CSS option is not working properly. This is the CSS: .body:hover { -fx-background-color: #b8fffd; } .exitIcon:hover { -fx-fill: gray; } The body hover ...
Tymo Tymo's user avatar
  • 103
0 votes
1 answer
63 views

Changing scale for ImageView

I have a problem with setting scaleX on ImageView. Here is a part of my code: bgImage.widthProperty().addListener((observable, oldValue, newValue) -> { double n = newValue.doubleValue() ...
mausor11's user avatar
1 vote
0 answers
66 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
2 votes
1 answer
586 views

Cannot style hbox or vbox

Quite frustrating as I follow guidelines and basic tutorial. I can apply CSS styles to differnt elements but not to vbox or hbox. I have the following simple Apps creating a simple scene using a FMXL ...
DenisShanghai's user avatar
0 votes
1 answer
304 views

How can I use round edges on a scrollpane? [duplicate]

I am trying to have round edges, so I tried to look around and found these answers: https://www.reddit.com/r/JavaFX/comments/tlnhfl/rounded_edges_for_textarea_within_a_scrollpane/ JavaFX ScrollPane ...
hellwraiz's user avatar
  • 471
0 votes
1 answer
315 views

Transparent background in JavaFX

So I know this has been discussed in different threads already, but sadly I haven't found a working solution yet, altough I tried alot, even with chatGPT, which ended in it assuming, there is ...
human0id's user avatar
0 votes
0 answers
92 views

JavaFX : Inline CSS button hover effect

I am trying to apply inline hover effect for my buttons. public class scMain implements Initializable { @FXML private Button view1,view2; @Override public void initialize(URL url, ...
Luqman's user avatar
  • 19
-1 votes
1 answer
58 views

Superscripts not showing

I am trying to display some calculator functions using FXML and CSS embedded. My goal is to insert this sign "xⁿ" and othe calculator's commom operations symbols. My Calculator app doesnt ...
IkhideIfidon's user avatar
1 vote
1 answer
860 views

Fill all the TabPane width with tabs in JavaFx

In JavaFx, I have done a TabPane with this appearance: As you see, there is a blank on the right, at the space reserved to the arrow button in case of too short TabPane. I would like to fill the ...
Skartt's user avatar
  • 581
0 votes
1 answer
165 views

I am making a scene switch program in javafx but when i click to switch it shows error, but when i do it without css it worked fine

This is my App.java file import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.*; import javafx.stage.Stage; public class App extends Application { @Override ...
Dev's user avatar
  • 41
0 votes
1 answer
598 views

JavaFX/CSS Display an svg shape on the right side of a combo box list cell

I'm looking to create a combo box whom selected item should set its text bold and display a tick at the right side of the list cell (the tick icon is a SVG): Currently in my code the tick takes all ...
Skartt's user avatar
  • 581
0 votes
0 answers
69 views

printing input from JavaFX TextArea to console gives errors [duplicate]

I am trying to print the input from a user in a TextArea to the console. //controller private void btnClick(ActionEvent event) { System.out.println(input.getText()); } //fxml ... &...
Elevate's user avatar
  • 67
0 votes
1 answer
127 views

JavaFX Panes are not scaling accordingly

I am trying to make a board game in JavaFX for a school project. I have made a FXML based on the lowest possible resolution the game should be playable in (800x600). Although as soon as I make the ...
Wessel van leeuwen's user avatar
0 votes
0 answers
148 views

JavaFX CSS image loading on Linux

I would like to load an image as a background image in a css file included by my fxml file. I am certain that the CSS is working, because I can change the background color for instance, but when I try ...
Bastien D's user avatar
2 votes
2 answers
698 views

JavaFX Variable Font Issue

I am in strife. I am using a Bahnschrift Variable Font as a font for all of the text & labels of my JavaFX program. However, when I am going to use a variant of the font, the font only appears as ...
codingClown's user avatar
0 votes
0 answers
258 views

JavaFX| Label changing the window's background clolor

I'm trying to write up two CSS stylesheets for my application (light theme, dark theme). I have an existing stylesheet where I declare the global font, after that one, I set up the initial theme. This ...
rtkay123's user avatar
0 votes
1 answer
293 views

JavaFX FXML Background Image: How to select an image from a folder without knowing exactly its' name?

I am trying to set the background image of a JavaFX program same as the user background. The background image in windows is found in : "%AppData%\Microsoft\Windows\Themes\CachedFiles" and ...
TestUser1's user avatar
0 votes
1 answer
542 views

JavaFx : Is it possible to align the Box above the Text content in a checkbox?

I want to achieve somthing like this :
vi90's user avatar
  • 73
0 votes
0 answers
269 views

Make two buttons hover together when mouse is over one of the buttons

I have two buttons in a stack pane so one smaller button is on top of another larger button. StackPane -----> Btn1 -----> Btn2 Ex: When I hover over btn two, i want button one to still be in it'...
teepers's user avatar
  • 22
1 vote
1 answer
826 views

how to add an object in java lang to the fxml file

im trying to make a game I have made a grid of cells in a java class and another part of the UI in the fxml file but when I run it ide gives: JavaFX Application Thread" java.lang.RuntimeException: ...
reza bagherian 's user avatar
0 votes
0 answers
109 views

How to fix fx id bug in javafx? [duplicate]

I was trying to make a simple JavaFX file. It contains the main class, a controller, and an XML file. I opened the XML file in the scene builder. Then added a button on the anchor pane. Gave the ...
user avatar
0 votes
0 answers
153 views

JavaFX 13 - Caret in TextField wrong color/size

After setting the global text color in my JavaFX application in CSS (*{ -fx-font-size: 9px; -fx-text-fill: #000000 } I've noticed that the caret in TextFields is 2px thick and a different color to the ...
Oliver Dalton's user avatar
2 votes
1 answer
1k views

Image tag in FXML (JavaFX), how to set size using css?

I'm learning to use CSS with FXML and I'm having trouble setting the size of an Image. I have four images, and I want them all to be the same size. But I can't get the CSS to work. My FXML is as ...
alehel's user avatar
  • 386
2 votes
1 answer
984 views

JavaFX: How to add CSS to an Image element in FXML

I have the following FXML: <VBox id="customerFormPane" styleClass="customerForm" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.customer.CustomerFormController" > <...
M.E.'s user avatar
  • 5,466
2 votes
1 answer
2k views

How to set JavaFX Circle Radius using CSS?

is there any CSS property that would set the Circle's radius? Intuitively I've tried "fx-radius" or "fx-size" but that's not it. I don't want to set each circle radius separately in fxml file; <...
Sheb's user avatar
  • 175
1 vote
1 answer
457 views

How do I make a media-query for a canvas made in Java?

Media queries in CSS file has no effect on the GUI made in javaFX. I have made a canvas using javaFX. I have used FXML to setup the different GUI elements. Then I have used a CSS file to style ...
Kasper Rolf Larssen's user avatar
0 votes
1 answer
388 views

How to show elements on FXML file loaded in JavaFX application?

I need to understand how to show elements inserted in FXML file loaded by Main javaFX application, my JavaFX application main is: // imports omitted public class Main extends Application { @Override ...
M. Petri's user avatar
1 vote
0 answers
271 views

-fx-cursor: url("CCursor.png"); Gives java.lang.String cannot be cast to javafx.scene.Cursor

EDIT: Thanks to ZhenyaM for showing me this i used this in the Main() class that intellij gives you with a javafx project: Image image = new Image("batman.png"); //pass in the image path scene....
SW CreeperKing's user avatar
0 votes
3 answers
2k views

how to control CSS file from the Java controller in JavaFX

i've build an app with one theme and i use for that a CSS file when i finished it i m trying to give the User the choice of choicing colors that he prefer and the CSS file is included in the FXML ...
Samer's user avatar
  • 161
1 vote
1 answer
391 views

JavaFX: How to give more than one Circle the same size?

my question seems simple, but I didn't find a good way yet. I want to have several Circles defined in my FXML, 10 circles should have a radius of 10px, 20 others should have one of 6px. I want to ...
mismyl's user avatar
  • 153
0 votes
0 answers
42 views

Images not load on compile but shown in SceneBuilder

So I'm making an application in java using JavaFX with the FXML files rather than coding the UI in java. To add this project is being handled in Gradle. I'm using a stylesheet to configure my UI and ...
Lucky38i's user avatar
  • 135
0 votes
1 answer
211 views

Applying CSS to stack charts in FXML

I am trying to implement a set of stacked charts in FXML similar to this example. I'm fairly inexperienced and couldn't find whole examples of setting up CSS in FXML Controller. Trying to adapt code ...
Kyle's user avatar
  • 3
1 vote
0 answers
87 views

JavaFX CSS is not working when using fx:factory to populate custom GridPane component

I have a problem with CSS on Component when fx:factory is used, additionaly gridLinesVisible property does not seem to work either. Let me get to the point, my component looks like this: <?import ...
Rafał Janicki's user avatar
0 votes
1 answer
1k views

JavaFX - css doesn't work in my project, but can work in scene builder

I'm learning to use Scene Builder.I have read some same question but I'm still so confused. I write a css to set the background,this is my css code: @charset"UTF-8"; .bodybg{ -fx-background-...
Moon's user avatar
  • 73
0 votes
1 answer
359 views

JFoenix JFXTreeTableView column heading alignment

I am writing a JavaFX application in which I am creating a table using the JFXTreeTableView component from the JFoenix library. By default, the column headings are center aligned. I would like the ...
Christopher Conroy's user avatar
0 votes
1 answer
40 views

Using CSS only in FXML

I am mainly a web developer learning Java and currently, I am working on FXML. There are a lot of possibilities in terms of positioning and styling like the panes, but since I am familiar with CSS I ...
Sinan Samet's user avatar
  • 6,732
0 votes
0 answers
285 views

AnchorPane on mouse click padding

Is there any way to make AnchorPane containing button and few Text to do padding while clicked on it like a button? I`m using JavaFX and CSS and this is my code. Everything works but not padding ...
Beforeu's user avatar
  • 83
1 vote
0 answers
27 views

Javafx scene builder CSS SetStyle overwrite [duplicate]

I am working on an basic javafx GUI, and I need to create button, that changes background color. I want "Nightmode" button to change background color, but it causes "java.lang.NullPointerException" I ...
Jkt44's user avatar
  • 47
3 votes
1 answer
2k views

Java FX buttons slightly smaller when clicked/focus

I have an issue where my buttons in JavaFX become slightly smaller when clicked. here you can see that the "change password" button is clicked/selected. here you can see the "admin functions" ...
HamishD's user avatar
  • 349
0 votes
0 answers
431 views

JavaFX how to add dynamically element defined in fxml

I have list, in javaFx, to populate with pretty complex elements. I have defined created fxml layout for each element. Is there any way for me to initialize this fxml files as elements in list which ...
Kuba Sienek Sienkiewicz's user avatar
0 votes
1 answer
121 views

JavaFX. Why fixed radius size gradient can't be positioned?

I want to make a radial-gradient background and place it in bottom right corner of my Region element. I want it to have a fixed radius of 30px. According to documentation I can either specify ...
Alyona's user avatar
  • 1,798
0 votes
1 answer
284 views

Java - FXML,CSS

I have been trying to style this scroll bar for quite some time using css. with some help I managed to get somewhere but this little white box underneath doesn't want to disappear. How do you get rid ...
Gunther9's user avatar
1 vote
1 answer
2k views

JavaFX styling TableColumn cells

I am building a TableView in Gluon Scene Builder. I want to have a different background colour for cells in each column. Can I do this just through the FXML file and CSS? With a CSS style class ....
Duane Allman's user avatar
1 vote
0 answers
1k views

JavaFX border correct width in Scene Builder but not on running program

The Problem: I have a HBox called MenuContainer within which I have a MenuBar, I have used FXML to lay things out and CSS to style. I want a 1px border beneath my MenuContainer so I gave it the style: ...
Samuel Wykes's user avatar
1 vote
0 answers
326 views

JavaFX TableView `Show Columns` button overlaps very right column header

Got a little problem with the JavaFX TableView, the button at the top right, if enabled, it overlaps with the very right column header. I don't apply any css to the table whatsoever. Here is the ...
Marcel's user avatar
  • 1,596
0 votes
2 answers
66 views

Background properties not working from stylesheet

I'm trying to set a background image for all buttons in the application, when I set it via FXML file it works fine but when I use CSS stylesheet to set it it doesn't work although some other ...
Free Palestine's user avatar
1 vote
0 answers
224 views

CSS Resource not found when opening scene from other JavaFX

I have ViewMiscFXML.fxml class in which I have TreeTableView, I want styling for that. But the output says: WARNING: Resource "../css/styles.css" not found. I am opening ViewMiscFXML.fxml class from ...
Muhammad Yawar's user avatar
0 votes
1 answer
652 views

Add events by css class name javafx

Here I create a css class and add them to 10 labels. (Buttons in dashboard. As Mouse over events are same, same class is used) Now I want to change the button style after it is pressed. And that mouse ...
KNB's user avatar
  • 127