-
Bug
-
Resolution: Unresolved
-
P3
-
jfx11, 8, 9, 10
-
x86_64
-
linux_ubuntu
ADDITIONAL SYSTEM INFORMATION :
Ubuntu 16.4 LTS
java -version
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
A DESCRIPTION OF THE PROBLEM :
stage.getIcons().add(icon); works if no scene is added to the application. If a scene is added to an application, the stage.getIcons().add(icon); no longer shows the icon and instead displays the default icon.
REGRESSION : Last worked in version 10.0.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Save the example code below in a file called IconBug.java. Compile (javac IconBug.java) and run (java IconBug).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Step 1: Running the code as is, the icon appears in the Ubuntu Launcher and the pop up remains blank as expected.
Step 2: Uncomment Section 2. Recompile and rerun. Expectation is the image should show up in both the Launcher and in the pop up window.
ACTUAL -
Step 2: The image should show up in the pop up window but the icon is the "default" icon, not the image defined in the url.
---------- BEGIN SOURCE ----------
/*
Section 1 works as expected if section 2 remains commented out.
If section 2 is uncommented, section 1 no longer works (and it should).
To reproduce:
Step 1:
Compile and run this code as is:
javac IconBug.java
java IconBug
The icon appears and the pop up remains blank as expected.
Step 2:
Uncomment Section 2
Recompile and rerun this code:
javac IconBug.java
java IconBug
The icon no longer appears as an icon (which it should).
The default "icon" appears instead.
The image appears in the pop up as expected.
----
According to:
https://docs.oracle.com/javase/10/docs/api/javafx/stage/Stage.html#getIcons()
public final ObservableList<Image> getIcons()
Gets the icon images to be used in the window decorations
and when minimized. The images should be different sizes of
the same image and the best size will be chosen, eg. 16x16, 32,32.
Returns: An observable list of icons of this window
*/
public class IconBug extends javafx.application.Application {
@Override
public void start(javafx.stage.Stage stage) throws Exception {
String url = "https://d1nhio0ox7pgb.cloudfront.net/_img/v_collection_png/32x32/shadow/ok.png";
// section 1
javafx.scene.image.Image icon = new javafx.scene.image.Image(url);
stage.getIcons().add(icon);
/*
// section 2
javafx.scene.image.Image image = new javafx.scene.image.Image(url);
javafx.scene.image.ImageView imageView =
new javafx.scene.image.ImageView();
imageView.setImage(image);
javafx.scene.Group group = new javafx.scene.Group();
group.getChildren().add(imageView);
javafx.scene.Scene scene = new javafx.scene.Scene(group);
stage.setScene(scene);
*/
stage.setWidth(100);
stage.setHeight(100);
stage.show();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround yet.
FREQUENCY : always
Ubuntu 16.4 LTS
java -version
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
A DESCRIPTION OF THE PROBLEM :
stage.getIcons().add(icon); works if no scene is added to the application. If a scene is added to an application, the stage.getIcons().add(icon); no longer shows the icon and instead displays the default icon.
REGRESSION : Last worked in version 10.0.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Save the example code below in a file called IconBug.java. Compile (javac IconBug.java) and run (java IconBug).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Step 1: Running the code as is, the icon appears in the Ubuntu Launcher and the pop up remains blank as expected.
Step 2: Uncomment Section 2. Recompile and rerun. Expectation is the image should show up in both the Launcher and in the pop up window.
ACTUAL -
Step 2: The image should show up in the pop up window but the icon is the "default" icon, not the image defined in the url.
---------- BEGIN SOURCE ----------
/*
Section 1 works as expected if section 2 remains commented out.
If section 2 is uncommented, section 1 no longer works (and it should).
To reproduce:
Step 1:
Compile and run this code as is:
javac IconBug.java
java IconBug
The icon appears and the pop up remains blank as expected.
Step 2:
Uncomment Section 2
Recompile and rerun this code:
javac IconBug.java
java IconBug
The icon no longer appears as an icon (which it should).
The default "icon" appears instead.
The image appears in the pop up as expected.
----
According to:
https://docs.oracle.com/javase/10/docs/api/javafx/stage/Stage.html#getIcons()
public final ObservableList<Image> getIcons()
Gets the icon images to be used in the window decorations
and when minimized. The images should be different sizes of
the same image and the best size will be chosen, eg. 16x16, 32,32.
Returns: An observable list of icons of this window
*/
public class IconBug extends javafx.application.Application {
@Override
public void start(javafx.stage.Stage stage) throws Exception {
String url = "https://d1nhio0ox7pgb.cloudfront.net/_img/v_collection_png/32x32/shadow/ok.png";
// section 1
javafx.scene.image.Image icon = new javafx.scene.image.Image(url);
stage.getIcons().add(icon);
/*
// section 2
javafx.scene.image.Image image = new javafx.scene.image.Image(url);
javafx.scene.image.ImageView imageView =
new javafx.scene.image.ImageView();
imageView.setImage(image);
javafx.scene.Group group = new javafx.scene.Group();
group.getChildren().add(imageView);
javafx.scene.Scene scene = new javafx.scene.Scene(group);
stage.setScene(scene);
*/
stage.setWidth(100);
stage.setHeight(100);
stage.show();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround yet.
FREQUENCY : always
- relates to
-
JDK-8299860 [macos] Inconsistent color of icon between stage window and within scene
- Open