The following style looks as expected on SceneBuilder. (The only visible border is the bottom one and it is dotted.)
But it looks different on runtime. (All borders are visible and solid.)
.floatingPanel-title{
-fx-text-alignment: center;
-fx-text-fill: CORNFLOWERBLUE;
-fx-font-weight: bold;
-fx-font-size: 15px;
-fx-background-color: #545050;
-fx-border-style: none none dotted none;
-fx-border-color: white;
}
I tried some by swaping the lines or commenting-out some parts but the problem is still an issue.
What do you suggest as a solution?
Note:
1) I applied this style to a label and also a panel. The problem is valid for both.
2) I have already tried clean-compile. Problem still exists.
It seems to be a bug, sorry. On my testing with JavaFX 8u40:
1) Even though the official JavaFX CSS Reference Guide says on -fx-border-style
as
A series of border style values, separated by commas. Each item in the series applies to the corresponding item in the series of border colors.
The comma separated example behaves weird and wrongly than not comma separated one. i.e. these
-fx-border-style: dotted dashed dashed dashed;
-fx-border-color: red red red red;
-fx-border-width: 2;
and
-fx-border-style: dotted , dashed , dashed , dashed;
-fx-border-color: red red red red;
-fx-border-width: 2;
renders differently. Not using commas seems more accurate despite the doc.
2) The border style option none
is not working in JavaFX 8 but in JavaFX 2. Instead of this you may choose to use hidden
.
-fx-border-style: hidden hidden dotted hidden;
3) The different rendering of SceneBuilder and at runtime may be caused by usage of different versions of JavaFX. You can inspect the used version by
System.out.println(com.sun.javafx.runtime.VersionInfo.getRuntimeVersion());
Finally, after observation of yourself, you are welcome to file a jira issue or vote for existing one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With