-
Bug
-
Resolution: Unresolved
-
P4
-
jfx11, 8
-
x86_64
-
os_x
ADDITIONAL SYSTEM INFORMATION :
MacOS Mojave 10.14.2
A DESCRIPTION OF THE PROBLEM :
In a MacOS JavaFX application that has a MenuBar with one or more menus and MenuBar.setUseSystemMenuBar is set to true:
Run application
Click away so the window hasn't got focus
Drag and drop an item on to the app while it hasn't got focus.
If a window pops up for a few seconds on the main window and the user clicks the main window, when the pop up disappears, the JavaFx menu doesn't appear, even if you click on the main app window. The only way to get the menu back is to click away from the app and click on it again.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
* Run the supplied test app which has a MenuBar with one menuItem, a file menu.
* Click away from the app so it is not the active window.
* Drag any old file on to the app
* A pop up Alert will appear for a few seconds.
* Click on the main app window behind this pop up before it disappears.
* Wait for the pop up to disappear and see that the File menu doesn't reappear.
* The only way to get it to reappear is to click away from the app and then click on it again.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The File menu should appear once the pop up appears after the drag and drop operation.
ACTUAL -
The File menu does not appear
---------- BEGIN SOURCE ----------
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.input.TransferMode;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.stage.Window;
import javafx.util.Duration;
public class DragAndDrop extends Application
{
public static void main(
String[] args)
{
launch(args);
}
@Override
public void start(
Stage primaryStage)
{
primaryStage.setTitle("Hello World!");
VBox root = new VBox();
final Scene scene = new Scene(root, 300, 250);
primaryStage.setScene(scene);
registerDragNDrop(scene);
attachMenu(root);
primaryStage.show();
}
private void attachMenu(
VBox vbox)
{
MenuBar menuBar = new MenuBar();
menuBar.setUseSystemMenuBar(true);
Menu menuFile = new Menu("File");
menuBar.getMenus().addAll(menuFile);
vbox.getChildren().addAll(menuBar);
}
private void showPopUp(
Window parent)
{
Alert alert = new Alert(AlertType.INFORMATION);
alert.initOwner(parent);
alert.show();
Timeline timeline = new Timeline();
timeline.getKeyFrames().add(new KeyFrame(Duration.millis(5000), e -> alert.close()));
timeline.playFromStart();
}
private void registerDragNDrop(
final Scene scene)
{
scene.setOnDragOver(event ->
{
event.acceptTransferModes(TransferMode.COPY_OR_MOVE);
event.consume();
});
scene.setOnDragDropped(event ->
{
showPopUp(scene.getWindow());
event.consume();
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
You need to click away from the application and then back again for the menu to appear again.
FREQUENCY : always
MacOS Mojave 10.14.2
A DESCRIPTION OF THE PROBLEM :
In a MacOS JavaFX application that has a MenuBar with one or more menus and MenuBar.setUseSystemMenuBar is set to true:
Run application
Click away so the window hasn't got focus
Drag and drop an item on to the app while it hasn't got focus.
If a window pops up for a few seconds on the main window and the user clicks the main window, when the pop up disappears, the JavaFx menu doesn't appear, even if you click on the main app window. The only way to get the menu back is to click away from the app and click on it again.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
* Run the supplied test app which has a MenuBar with one menuItem, a file menu.
* Click away from the app so it is not the active window.
* Drag any old file on to the app
* A pop up Alert will appear for a few seconds.
* Click on the main app window behind this pop up before it disappears.
* Wait for the pop up to disappear and see that the File menu doesn't reappear.
* The only way to get it to reappear is to click away from the app and then click on it again.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The File menu should appear once the pop up appears after the drag and drop operation.
ACTUAL -
The File menu does not appear
---------- BEGIN SOURCE ----------
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.input.TransferMode;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.stage.Window;
import javafx.util.Duration;
public class DragAndDrop extends Application
{
public static void main(
String[] args)
{
launch(args);
}
@Override
public void start(
Stage primaryStage)
{
primaryStage.setTitle("Hello World!");
VBox root = new VBox();
final Scene scene = new Scene(root, 300, 250);
primaryStage.setScene(scene);
registerDragNDrop(scene);
attachMenu(root);
primaryStage.show();
}
private void attachMenu(
VBox vbox)
{
MenuBar menuBar = new MenuBar();
menuBar.setUseSystemMenuBar(true);
Menu menuFile = new Menu("File");
menuBar.getMenus().addAll(menuFile);
vbox.getChildren().addAll(menuBar);
}
private void showPopUp(
Window parent)
{
Alert alert = new Alert(AlertType.INFORMATION);
alert.initOwner(parent);
alert.show();
Timeline timeline = new Timeline();
timeline.getKeyFrames().add(new KeyFrame(Duration.millis(5000), e -> alert.close()));
timeline.playFromStart();
}
private void registerDragNDrop(
final Scene scene)
{
scene.setOnDragOver(event ->
{
event.acceptTransferModes(TransferMode.COPY_OR_MOVE);
event.consume();
});
scene.setOnDragDropped(event ->
{
showPopUp(scene.getWindow());
event.consume();
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
You need to click away from the application and then back again for the menu to appear again.
FREQUENCY : always