Comments (2)
I spent several hours investigating this question and finally I have to reference as usual stylesheet from project resources:
"bootstrapfx.css" is a copy from the Maven .jar
I've tried to use Gluon Scene Builder, whitch it is said to have Maven suport to import dependencies, but it is too much unstable software so I returned to classic Oracle JavaFX Scene Builder.
from bootstrapfx.
I'm aware that this question was asked more than a year ago, but I'd like to share how I solved it... and honestly, because in the process I stumbled upon a related problem and perhaps someone can enlighten me with a solution, see below :)
To use BootstrapFX in SB and preview the results, I can do the following (as seen in @aalmiray answer here: https://stackoverflow.com/a/64404062/243532):
- Open my FXML file (hello-view.fxml) in SB
- Open the JAR/FXML manager
Add the org.kordamp.bootstrapfx:bootstrap-core:0.4.0 JAR from Maven (using the "Manually add Library from repository")
Set the bootstrapfx.css stylesheet to the root node of the scene. For that, I assumed the following:
- the bootstrapfx.css is available in the /org/kordamp/bootstrapfx/bootstrapfx.css path
I needed to click on "Switch to classpath relative path" and add the full path to the file:
Now I can see all the available CSS styles and apply them from SB to any of the scene's nodes:
So far so good. However, when I open the FXML file in IntelliJ (where I have the BootstrapFX library defined as a dependency in Maven) I get this error:
Cannot resolve directory 'org': (I'm assuming that stylesheets="@/org/kordamp/bootstrapfx/bootstrapfx.css" should look into the proper JAR dependency in my Maven external libraries and get the CSS file from there... in fact, isn't it what was really happening in SB?)
And of course, when I run the application from IntelliJ, it yields this error:
Caused by: javafx.fxml.LoadException: Invalid resource: /org/kordamp/bootstrapfx/bootstrapfx.css not found on the classpath
Is there any way to specify in the stylesheets attribute the path to a CSS file located inside a JAR file so we can run the JavaFX application without errors both in SB and from IntelliJ/Maven?
PD: I've also posted this last question in StackOverflow:
https://stackoverflow.com/questions/75195364/cant-use-a-css-located-inside-a-jar-file-in-an-javafx-fxml-scene
from bootstrapfx.
Related Issues (20)
- Checkbox does not render correctly HOT 1
- How to rotate panel HOT 1
- The css file not found HOT 2
- There is an official documentation? HOT 6
- [README.md] Repo jcenter.bintray.com should be changed to https HOT 1
- Styling ComboBox? HOT 1
- Add support for spacing (padding, margin etc.)
- size classes don't work on Label
- Build failed, any idea on how to fix? HOT 2
- Incorrect CSS syntax/values in bootstrapfx.css?
- JFXCentral Badge
- Incompatibility Issue with ControlsFX Glyphs When Using BootstrapFX
- The font display in the button is incorrect
- How to set back ground image
- Panel heading text missing panel-title style HOT 1
- Are there any examples of how to use this library HOT 1
- A great project, that's what I need, thanks a lot :) HOT 1
- unrecognized character HOT 1
- Outline Buttons HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bootstrapfx.