aspose file tools*
The moose likes JavaFX and the fly likes Adding CSS produces error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JavaFX
Bookmark "Adding CSS produces error" Watch "Adding CSS produces error" New topic
Author

Adding CSS produces error

kevin flint
Greenhorn

Joined: May 05, 2012
Posts: 3
Hi, I'm new to JavaFX.

I just started doing this.


^ How I arranged my files.

Here's the code:



I don't know where I went wrong, but here's the error.


My CSS code:



Where did I go wrong?
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

getStylesheets().add(...) needs the path to the resource, not the external form of the URL -- which starts with a protocol.

See Skinning JavaFX Applications with CSS for an example.


luck, db
There are no new questions, but there may be new answers.
kevin flint
Greenhorn

Joined: May 05, 2012
Posts: 3
I tried doing it like this


I saved the main file and the css file in the same package.

Got this new error.
kevin flint
Greenhorn

Joined: May 05, 2012
Posts: 3
I got it working now. I just rebuilt the project. Weird.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

Nothing weird about it. Rebuilding a NetBeans project copies resources to the build/classes folder. Keep that in mind whenever you use any kind of resources.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding CSS produces error