-
Bug
-
Resolution: Unresolved
-
P4
-
8u77
-
x86
-
os_x
FULL PRODUCT VERSION :
version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
OS X 10.10.5
Darwin Liams-MacBook-Pro.local 14.5.0 Darwin Kernel Version 14.5.0: Mon Jan 11 18:48:35 PST 2016; root:xnu-2782.50.2~1/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
When my jar's MANIFEST.MF uses a splash screen, eg:
SplashScreen-Image: META-INF/icons/tux.png
The following does not work:
menuBar.setUseSystemMenuBar(true);
Leaving the menu bar on the application window, rather than at the top of the screen as it should do.
If the splash screen is not used, the menu appear at the top of the screen using the system menu bar as expected.
The splash screen does not automatcially go away as it should do either, it has to be closed programatically:
final SplashScreen splash = SplashScreen.getSplashScreen();
if (splash != null)
{
splash.close();
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Clone or copy this simple app - needs to be run on OS X.
https://github.com/liamsharp/splash-screen-image-bug
git clone git@github.com:liamsharp/splash-screen-image-bug.git
cd splash-screen-image-bug/
java -jar target/splash-screen-image-bug-1.0-SNAPSHOT.jar
If you edit the pom to remove the splash screen on line 41 the system menu bar will be used for the menu.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I was expecting the system menu bar to be used for the menu.
ACTUAL -
The menu bar was placed on the main application window.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
You do really need a few bits to make this happen, it can't be shown with a simple bit of source code as you need to build a jar file containing an image, and class file and a MANIFEST.MF.
Here's the code for the java file:
package com.stackoverflow;
import java.awt.SplashScreen;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class DemoApp extends Application
{
@Override
public void start(
final Stage stage)
{
stage.setTitle("Demo App");
Scene scene = new Scene(new VBox(), 400, 350);
scene.setFill(Color.OLDLACE);
MenuBar menuBar = new MenuBar();
Menu menuFile = new Menu("File");
menuBar.getMenus().addAll(menuFile);
menuBar.setUseSystemMenuBar(true);
((VBox) scene.getRoot()).getChildren().addAll(menuBar);
stage.setScene(scene);
stage.show();
}
private static void closeSplashScreen()
{
final SplashScreen splash = SplashScreen.getSplashScreen();
if (splash != null)
{
splash.close();
}
}
public static void main( String[] args )
{
closeSplashScreen();
launch(args);
}
}
The pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.liamsharp</groupId>
<artifactId>splash-screen-image-bug</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>splash-screen-image-bug</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>javafx</groupId>
<artifactId>jfxrt8</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${jre8.home}/lib/ext/jfxrt.jar</systemPath>
</dependency>
</dependencies>
<properties>
<jre8.home>/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre</jre8.home>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<index>false</index>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries>
<SplashScreen-Image>META-INF/icons/tux.png</SplashScreen-Image>
<Main-Class>com.stackoverflow.DemoApp</Main-Class>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
and you'll also need an image.
Cloning my repository is probably the easiest!
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Haven't found any. So we've had to make the mac version of our app not use a splash screen.
version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
OS X 10.10.5
Darwin Liams-MacBook-Pro.local 14.5.0 Darwin Kernel Version 14.5.0: Mon Jan 11 18:48:35 PST 2016; root:xnu-2782.50.2~1/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
When my jar's MANIFEST.MF uses a splash screen, eg:
SplashScreen-Image: META-INF/icons/tux.png
The following does not work:
menuBar.setUseSystemMenuBar(true);
Leaving the menu bar on the application window, rather than at the top of the screen as it should do.
If the splash screen is not used, the menu appear at the top of the screen using the system menu bar as expected.
The splash screen does not automatcially go away as it should do either, it has to be closed programatically:
final SplashScreen splash = SplashScreen.getSplashScreen();
if (splash != null)
{
splash.close();
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Clone or copy this simple app - needs to be run on OS X.
https://github.com/liamsharp/splash-screen-image-bug
git clone git@github.com:liamsharp/splash-screen-image-bug.git
cd splash-screen-image-bug/
java -jar target/splash-screen-image-bug-1.0-SNAPSHOT.jar
If you edit the pom to remove the splash screen on line 41 the system menu bar will be used for the menu.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I was expecting the system menu bar to be used for the menu.
ACTUAL -
The menu bar was placed on the main application window.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
You do really need a few bits to make this happen, it can't be shown with a simple bit of source code as you need to build a jar file containing an image, and class file and a MANIFEST.MF.
Here's the code for the java file:
package com.stackoverflow;
import java.awt.SplashScreen;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class DemoApp extends Application
{
@Override
public void start(
final Stage stage)
{
stage.setTitle("Demo App");
Scene scene = new Scene(new VBox(), 400, 350);
scene.setFill(Color.OLDLACE);
MenuBar menuBar = new MenuBar();
Menu menuFile = new Menu("File");
menuBar.getMenus().addAll(menuFile);
menuBar.setUseSystemMenuBar(true);
((VBox) scene.getRoot()).getChildren().addAll(menuBar);
stage.setScene(scene);
stage.show();
}
private static void closeSplashScreen()
{
final SplashScreen splash = SplashScreen.getSplashScreen();
if (splash != null)
{
splash.close();
}
}
public static void main( String[] args )
{
closeSplashScreen();
launch(args);
}
}
The pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.liamsharp</groupId>
<artifactId>splash-screen-image-bug</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>splash-screen-image-bug</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>javafx</groupId>
<artifactId>jfxrt8</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${jre8.home}/lib/ext/jfxrt.jar</systemPath>
</dependency>
</dependencies>
<properties>
<jre8.home>/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre</jre8.home>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<index>false</index>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries>
<SplashScreen-Image>META-INF/icons/tux.png</SplashScreen-Image>
<Main-Class>com.stackoverflow.DemoApp</Main-Class>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
and you'll also need an image.
Cloning my repository is probably the easiest!
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Haven't found any. So we've had to make the mac version of our app not use a splash screen.