B4J Question What javafx css class do I need to reference to target a Pane?

Cableguy

Expert
Licensed User
Longtime User
Hi guys,

I need to set css styles in an external stylesheet file for the "Pane" view... The thing is... there isn't a Pane node in javafx...
For testing purposes I am using the Pane.id to access it, but it's my ideal solution.
So, anyone knows?
 

zed

Active Member
Licensed User
I don't know if this solution suits you, but it works

Style CSS:
Pane.Style = "-fx-border-color:blue red red red; -fx-background-color:lightgray; fx-border-width: 6 2 2 2; -fx-border-style: dashed solid solid solid;"
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
I don't know if this solution suits you, but it works

Style CSS:
Pane.Style = "-fx-border-color:blue red red red; -fx-background-color:lightgray; fx-border-width: 6 2 2 2; -fx-border-style: dashed solid solid solid;"
Hi @zed

Thanks but it's not what I am after
 
Upvote 0

teddybear

Well-Known Member
Licensed User
Hi guys,

I need to set css styles in an external stylesheet file for the "Pane" view... The thing is... there isn't a Pane node in javafx...
For testing purposes I am using the Pane.id to access it, but it's my ideal solution.
So, anyone knows?
I'm not sure if it is what you need
B4X:
Pane.StyleClasses.Add("pane")
"pane" is from an external stylesheet file
CSS:
.pane {
    -fx-background-color: red;
}
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
I'm not sure if it is what you need
B4X:
Pane.StyleClasses.Add("pane")
Thanks, but that is not what I am asking. I am already using that to target specific views.
What I am trying to figure out is what kind of javafx pane is a B4J Pane, so that I can target all panes of this type without having to add the styleclass to the view.
For example, I have 3 TreeViews in my app, and I only needed to add the .treeview to my css file, and that targets all present and futur treeviews without need of anything else.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
.Pane{} does not work in an external CSS file.
Or maybe I didn't do it right
I'm starting to believe you're right
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
A newly generated pane in B4j does not have a styleclass assigned, the same as the default Javafx pane view. Whereas a Treeview is created with the 'tree-view' styleclass by default. You can add your own in code (Pane1.Styleclasses.Add("ClassName") as suggested above, or by using a designer script extension if you want to do it in the designer https://www.b4x.com/android/forum/t...ass-designer-script-extension.143060/#content

You can add the same styleclass to multiple panes and then access the style class from the external style sheet.
 
Last edited:
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Stangely just saw this...
Me as OP didn't get a new notification about this last answer...
 
Upvote 0
Top