Ugly flashing when opening a css-styled stage
Robert Krüger
krueger at lesspain.de
Sun Jun 1 08:18:39 UTC 2014
Hi,
I'm in the process of evaluating Java FX 8 for our currently
Swing-based product (also Java 8) on OSX.
My first attempt to style a stage's background resulted in an ugly
flashing effect which I would classify as a show-stopper for
delivering a commercial product. This looks like it is caused by the
stage being drawn at least once before the style has been applied, and
I am wondering what the mistake is since my code is more or less a
straight-forward hello world:
package jfxtest;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class JXTest extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
final StackPane pane = new StackPane();
final Button closeButton = new Button("Close");
closeButton.setOnAction(event -> primaryStage.close());
pane.getChildren().add(closeButton);
final Scene scene = new Scene(pane, 800, 600);
scene.getStylesheets().add("dark.css");
scene.getStylesheets();
primaryStage.setScene(scene);
primaryStage.setTitle(getClass().getSimpleName());
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
with dark.css being:
.root {
-fx-background: rgb(54, 54, 54);
}
Is this a Mac-specific problem? Is there a workaround? Which of the
two mailing lists is the more appropriate one to post these things
(JFX problems which look like they might be platform-specific) to?
Thanks,
Robert
More information about the openjfx-dev
mailing list