public class Main extends Application {
@Override
public void start(Stage primaryStage) {
ScrollPane scrollPane = new ScrollPane();
VBox vbox = new VBox();
for (int i = 0; i < 50; i++) {
Label label = new Label("Label " + i);
label.getStyleClass().add("test");
vbox.getChildren().add(label);
}
scrollPane.setContent(vbox);
Scene scene = new Scene(scrollPane, 500, 500);
primaryStage.setScene(scene);
scene.getStylesheets().add("/style.css");
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
style.css:
.test.label .text {
-fx-fill: white;
-fx-stroke: red;
-fx-stroke-type: outside;
}
JDK and JavaFX 13
The labels render just fine but when I try to scroll it lags really much.
I expect it to be as smooth as it is when used without -fx-stroke-type: outside;
, for example, replacing the contents of style.css with
.test.label .text {
-fx-fill: white;
-fx-stroke: red;
/* -fx-stroke-type: outside; */
}
fixes the scrolling lag but the stroke overlaps the fill as it is drawn inside of the text.
I've tried running with Java and JavaFX 11 as well but there was no difference.