rapastranac opened a new issue, #6792:
URL: https://github.com/apache/netbeans/issues/6792

   ### Apache NetBeans version
   
   Apache NetBeans 19
   
   ### What happened
   
   I have a NetBeans module that includes a JFrame. This JFrame is capable of 
being minimized, maximized, and resized like any other non-modal window. When 
focusing on a widget within the JFrame instance that doesn't consume a key 
event, the event bypasses the frame and is subsequently captured by the 
NetBeans main window, provided that the pressed keys are registered in the 
keymap.
   
   For example, if you're in the text area of a file and press the "Delete" 
key, the next character at the caret's position will be removed. Similarly, if 
the focus is on a file node in the project view, the file will undergo the 
remove action.
   
   Expected behaviour: The key event should not be passed to the parent unless 
explicitly programmed for it.
   
   ### How to reproduce
   
   Attached is a minimal reproducible example 
[moduletest.zip](https://github.com/apache/netbeans/files/13551985/moduletest.zip),
 NetBeans module, that creates an action just below the File menu. This just 
spawns a frame with multiple widgets that don't do anything, among the widgets, 
there is also a JTextField. 
   
   1. Open any file with some text and position the caret in the middle of a 
word
   2. Trigger the `Spawn Second Frame` action
   3. The `SpawnableFrame` will pop up with the focus on the `JButton`
   4. Press the key "Delete".
      - You will notice the text in the file of the main window gets edited.
   5. Press "Ctrl + Z"
      - You will notice how the `undo` action also takes effect. 
   
   For reference, please also find attached a minimal maven project 
([minimalmavenproject.zip](https://github.com/apache/netbeans/files/13551999/minimalmavenproject.zip))
 only using swing and registering the `Delete` action in the keybindings that 
mimic the same behaviour. In this example, the issue does no occur.
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   Windows 11
   
   ### JDK
   
   19.0.2
   
   ### Apache NetBeans packaging
   
   Apache NetBeans binary zip
   
   ### Anything else
   
   Note:
   This behaviour does not occur if the previously selected (focused) widget in 
the SpawnableFrame is a widget that typically consumes the key event, such as 
the JTextField. Therefore, performing the following steps will not lead to the 
issue:
   
   Repeating the same three steps mentioned earlier:
   4. Set the focus on the JTextField.
   5. Move the focus to the JButton or any of the other widgets.
   6. Press the Delete key again.
      - You will observe that the key event no longer bypasses the 
SpawnableFrame.
   
   
   ### Are you willing to submit a pull request?
   
   No


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to