Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8264992

FileChooser prevents application interaction

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Linux hostname 5.11.10-arch1-1 #1 SMP PREEMPT Fri, 26 Mar 2021 00:11:29 +0000 x86_64 GNU/Linux (XFCE)

      openjdk version "16" 2021-03-16
      OpenJDK Runtime Environment (build 16+36)
      OpenJDK 64-Bit Server VM (build 16+36, mixed mode, sharing)


      A DESCRIPTION OF THE PROBLEM :
      Upon selecting an existing file from the FileChooser dialog, the user can no longer interact with all application elements. This may be similar to:

      https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8088558


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      0. Create a temporary file (e.g., touch $HOME/test.txt)
      1. Run the application.
      2. Type in some text (e.g., XYZ)
      3. Click File menu
      4. Click Save As menu item
      5. Browse to the directory of the file (e.g., $HOME)
      6. Click test.txt to select it
      7. Click Save button
      8. Click Replace button to confirm replacing
      9. Click File menu

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      (a) File menu opens.
      (b) The caret remains visible.

      ACTUAL -
      (a) The file menu does not open.
      (b) The caret is no longer visible.


      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.event.*;
      import javafx.scene.*;
      import javafx.scene.control.*;
      import javafx.scene.layout.BorderPane;
      import javafx.stage.*;

      public final class MainApp extends Application {
        public static void main( final String[] args ) {
          launch( args );
        }

        @Override
        public void start( final Stage stage ) {
          final var root = new Group();
          final var scene = new Scene( root, 400, 400 );
          final var pane = new BorderPane();
          final var menuBar = new MenuBar();
          final var menu = new Menu( "File" );
          final var file = new MenuItem( "Save As" );
          final var textArea = new TextArea();

          file.setOnAction( e -> new FileChooser().showSaveDialog( scene.getWindow() ) );

          menu.getItems().add( file );
          menuBar.getMenus().add( menu );

          pane.prefHeightProperty().bind( scene.heightProperty() );
          pane.prefWidthProperty().bind( scene.widthProperty() );
          pane.setTop( menuBar );
          pane.setCenter( textArea );
          root.getChildren().add( pane );

          stage.setScene( scene );
          stage.show();
        }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      User must relinquish application focus, then return to the application. (This can be accomplished by clicking outside the application, selecting the system menu, pressing Alt+Tab, etc.)

      FREQUENCY : always


        1. REPLICATE-STEPS.png
          300 kB
          Praveen Narayanaswamy
        2. MainApp.java
          1 kB
          Praveen Narayanaswamy

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: