• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JavaFX / SceneBuilder Issues

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

I am working on a Software 1 project where I have to construct an application with a GUI from a mockup image and a UML.  They have assigned NetBeans for the IDE and Scene Builder for the GUI design.

So far, I have just created an empty JavaFX Project, added a main class, .fxml for the opening screen, and a .css.

This code was included within the AnchorPane of my .fxml upon creation.  



Upon compile, I see this message:


Dec 12, 2017 9:22:12 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
INFO: Could not find stylesheet: jar:file:/C:/Users/Removed/Documents/NetBeansProjects/SoftwareOneProject/dist/run102474145/SoftwareOneProject.jar!/Documents/NetBeansProjects/SoftwareI%20Project/src/softwarei/project/project.css



The style sheet is located in the project folder alongside the other files.  Does anyone see what is happening here?

Thanks,
Andrew
 
Rancher
Posts: 285
14
Eclipse IDE C++ Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are assigning what ide to use? That's weird! Anyways, I don't use netbeans but I think css should be assigned like this?
scene.getStylesheets().add("packageName/applicationName.css");

seems you have got code for "project.css" and "mainscreen.css" in there?
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That doesn't look like the correct syntax for a stylesheet, at least I haven't seen that before.  Try something like this:
Or go into SceneBuilder, select the BorderPane in the Hierarchy menu on the left, then click the Properties menu on the right and scroll down to the StyleSheets entry.
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

S Fox wrote:I think css should be assigned like this?
scene.getStylesheets().add("packageName/applicationName.css");


This is how you would add the stylesheet through code, but the OP is using FXML.
 
S Fox
Rancher
Posts: 285
14
Eclipse IDE C++ Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh ok, I was assigning mine that way even with fxml, still new to it
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And that's fine -- you can mix code and FXML -- but it's not what the OP asked about.
 
Rancher
Posts: 387
30
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Change to the directory where the jar is located.

In your log message that is:
 C:/Users/Removed/Documents/NetBeansProjects/SoftwareOneProject/dist/run102474145/SoftwareOneProject.jar
But, I guess it could change between runs depending upon what NetBeans is doing.

Run jar tvf SoftwareOneProject.jar

Post the output of to this forum.

See if the css file is actually where you expect it to be in the jar.
 
Andrew Linton Bradford
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wasn't paying close attention before, but I do see that they created a temporary directory, then tore it down.

I tried running the command from the directory the .css file was located, but there were no tar files in there.



Also, now I'm getting a nice version mismatch error.  Scene Builder is updated.



I also just found out one of my main classes has to be abstract, as per the instructions.  I'm already pulling my hair out from this and my other projects.  
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I tried running the command from the directory the .css file was located, but there were no tar files in there.  


I thought you were instructed to cd to where the jar file is.

Also, now I'm getting a nice version mismatch error.  Scene Builder is updated.


It looks like SceneBuilder is running on Java 9 but you're trying to execute it on Java 8.
reply
    Bookmark Topic Watch Topic
  • New Topic