Ugly flashing when opening a css-styled stage

2014-06-01 Thread Robert Krüger
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


Re: Ugly flashing when opening a css-styled stage

2014-06-01 Thread Jeff Martin
I haven't seen this, but here's a hack you can try:

// Show stage transparent once to get proper drawing
_stage.setOpacity(0); _stage.show(); _stage.hide(); 
_stage.setOpacity(1);

I've done this before to trigger Stage to set it's width/height property (which 
I needed to position the stage property).

jeff


On Jun 1, 2014, at 3:18 AM, Robert Krüger  wrote:

> 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



Re: Ugly flashing when opening a css-styled stage

2014-06-02 Thread Robert Krüger
Thanks but it does not seem to improve the situation.

btw, I am using 1.8.0_05-b13 on Mac OS 10.9.3 on a retina MBP.

On Sun, Jun 1, 2014 at 9:59 PM, Jeff Martin  wrote:
> I haven't seen this, but here's a hack you can try:
>
> // Show stage transparent once to get proper drawing
> _stage.setOpacity(0); _stage.show(); _stage.hide(); 
> _stage.setOpacity(1);
>
> I've done this before to trigger Stage to set it's width/height property 
> (which I needed to position the stage property).
>
> jeff
>
>
> On Jun 1, 2014, at 3:18 AM, Robert Krüger  wrote:
>
>> 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
>


Re: Ugly flashing when opening a css-styled stage

2014-06-02 Thread Tom Schindl
To rule out CSS is the reason you could directly set the background:

pane.setBackground(new Background(new BackgroundFill(Color.rgb(54, 54,
54), CornerRadii.EMPTY, Insets.EMPTY)));

Does that improve the situation?

Tom


On 02.06.14 09:51, Robert Krüger wrote:
> Thanks but it does not seem to improve the situation.
> 
> btw, I am using 1.8.0_05-b13 on Mac OS 10.9.3 on a retina MBP.
> 
> On Sun, Jun 1, 2014 at 9:59 PM, Jeff Martin  wrote:
>> I haven't seen this, but here's a hack you can try:
>>
>> // Show stage transparent once to get proper drawing
>> _stage.setOpacity(0); _stage.show(); _stage.hide(); 
>> _stage.setOpacity(1);
>>
>> I've done this before to trigger Stage to set it's width/height property 
>> (which I needed to position the stage property).
>>
>> jeff
>>
>>
>> On Jun 1, 2014, at 3:18 AM, Robert Krüger  wrote:
>>
>>> 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
>>



Re: Ugly flashing when opening a css-styled stage

2014-06-02 Thread Robert Krüger
No, it does not. So it is not the CSS.


On Mon, Jun 2, 2014 at 10:04 AM, Tom Schindl
 wrote:
> To rule out CSS is the reason you could directly set the background:
>
> pane.setBackground(new Background(new BackgroundFill(Color.rgb(54, 54,
> 54), CornerRadii.EMPTY, Insets.EMPTY)));
>
> Does that improve the situation?
>
> Tom
>
>
> On 02.06.14 09:51, Robert Krüger wrote:
>> Thanks but it does not seem to improve the situation.
>>
>> btw, I am using 1.8.0_05-b13 on Mac OS 10.9.3 on a retina MBP.
>>
>> On Sun, Jun 1, 2014 at 9:59 PM, Jeff Martin  wrote:
>>> I haven't seen this, but here's a hack you can try:
>>>
>>> // Show stage transparent once to get proper drawing
>>> _stage.setOpacity(0); _stage.show(); _stage.hide(); 
>>> _stage.setOpacity(1);
>>>
>>> I've done this before to trigger Stage to set it's width/height property 
>>> (which I needed to position the stage property).
>>>
>>> jeff
>>>
>>>
>>> On Jun 1, 2014, at 3:18 AM, Robert Krüger  wrote:
>>>
 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
>>>
>


Re: Ugly flashing when opening a css-styled stage

2014-06-02 Thread Anthony Petrov

Hi Robert,


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?


FYI: the JDK Mac OS X Port Project has been completed long time ago, so 
currently the macosx-port-dev@ mailing list isn't appropriate for almost 
anything.


Please report JavaFX bugs at: https://javafx-jira.kenai.com/

AWT/Swing/JDK bugs can be reported at: 
http://bugreport.java.com/bugreport/ (or http://bugs.sun.com/ )


If you wish to participate in the development of the technologies (e.g. 
you want to contribute a patch for JavaFX or JDK platform), then you're 
welcome to post your suggestions on the appropriate development mailing 
lists (openjfx-dev@, awt-dev@, swing-dev@, etc.)


--
best regards,
Anthony

On 6/1/2014 12:18 PM, Robert Krüger wrote:

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



Re: Ugly flashing when opening a css-styled stage

2014-06-02 Thread Robert Krüger
Hi Anthony

On Mon, Jun 2, 2014 at 3:01 PM, Anthony Petrov
 wrote:
> Hi Robert,
>
>
>> 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?
>
>
> FYI: the JDK Mac OS X Port Project has been completed long time ago, so
> currently the macosx-port-dev@ mailing list isn't appropriate for almost
> anything.

Oh, that's a surprise. I thought it was more or less the successor of
apple-java-dev, i.e. where one discusses issues/problems/questions
specific to the Mac port of the JDK/JRE and Java development on the
Mac in general.

>
> Please report JavaFX bugs at: https://javafx-jira.kenai.com/

Submitted as RT-37372
>
> AWT/Swing/JDK bugs can be reported at: http://bugreport.java.com/bugreport/
> (or http://bugs.sun.com/ )
>
> If you wish to participate in the development of the technologies (e.g. you
> want to contribute a patch for JavaFX or JDK platform), then you're welcome
> to post your suggestions on the appropriate development mailing lists
> (openjfx-dev@, awt-dev@, swing-dev@, etc.)
>

I've been subscribed to the two lists for a while now and my
impression is, it is also a place where people running into problems
with the platform's limitations exchange their experience which has
been very valuable especially when dealing with a rather new platform
but I guess I need to move to the OTN community for this.

Thanks and best regards,

Robert