USEPA / emf

Emissions Modeling Framework (EMF)
6 stars 3 forks source link

no focus in Status Window after refresh #57

Open cseppan opened 3 years ago

cseppan commented 3 years ago

After refreshing the Status window, no component has focus, so keyboard navigation doesn't work. Selecting the Status window from the Window menu, or using the shortcut (Ctrl+Shift+S) restores focus.

cseppan commented 3 years ago

The SwingWorker object that handles the refresh in a separate thread disables all the components in the window then enables everything after the refresh is finished. This process ends up with no component having focus. To fix this, have a component explicitly request focus after all the components are re-enabled.

Commit 8e748d26c57b275584c7d95b6e97da7aa370724b adds refreshButton.requestFocusInWindow() at the end of the refresh process.

cseppan commented 3 years ago

Focus change shouldn't happen on automatic refreshes, only when the user clicks the Refresh button

cseppan commented 3 years ago

Commit fb2b477029a9fbb570d8478c20b61f04d7f62d60 updates the code to only request focus on the Refresh button when the Status window is currently selected.

cseppan commented 3 years ago

If the Status window has focus and you have a menu open when the automatic refresh happens, focus goes back to the Status window and you can't move around or close the menu anymore.