Article 58EFZ JavaFX program doesn't locate CSS file

JavaFX program doesn't locate CSS file

by
kkoistinen
from LinuxQuestions.org on (#58EFZ)
Hello everyone,

I am using Kubuntu 20.04 with Eclipse 2020-06. I am trying to learn JavaFX and have this problem with CSS files. My program code is as follows (actually code is from "Learn JavaFX 8"). My JavaFX version is 14 and Java version is 11.

Code:public void start(Stage stage) {
Button yesBtn = new Button("Yes");
Button noBtn = new Button("No");
Button cancelBtn = new Button("Cancel");

HBox root = new HBox();
root.getChildren().addAll(yesBtn,noBtn,cancelBtn);

Scene scene = new Scene(root);

scene.getStylesheets().add("/home/kkoistinen74/buttonstyles.css");

stage.setScene(scene);
stage.setTitle("Styling buttons");;
stage.show();When I run this program I get the following error:

syysk. 22, 2020 4:09:51 IP. com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
WARNING: Resource "/home/kkoistinen74/buttonstyles.css" not found.

In the book there's suggestion to change Classpath. I have tried instructions given here:

https://howtech.tv/pc/how-to-set-and...path-in-linux/

without any success. The idea with the CSS is to change outlook of buttons in code and actually unmodified buttons are displayed. I tried to browse net for answers but couldn't find anything that works.

Yours

Kimmolatest?d=yIl2AUoC8zA latest?i=f4oXssabiUg:TDWD7a6UyVk:F7zBnMy latest?i=f4oXssabiUg:TDWD7a6UyVk:V_sGLiP latest?d=qj6IDK7rITs latest?i=f4oXssabiUg:TDWD7a6UyVk:gIN9vFwf4oXssabiUg
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments