From 9effee056497f499c3edea0163a7fb9bd4dbd2fa Mon Sep 17 00:00:00 2001 From: dchandler Date: Sat, 5 Jul 2003 02:30:00 +0000 Subject: [PATCH] If you opened a file from the recently opened files list and very quickly mouse-clicked on the new Jskad window, you could cause an infinite regression of requestFocus() operations because the menu would try to get focus back. I grab focus from the menu now. --- source/org/thdl/tib/input/Jskad.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/org/thdl/tib/input/Jskad.java b/source/org/thdl/tib/input/Jskad.java index 83389ed..af506d6 100644 --- a/source/org/thdl/tib/input/Jskad.java +++ b/source/org/thdl/tib/input/Jskad.java @@ -65,7 +65,7 @@ import org.thdl.util.ThdlLazyException; public class Jskad extends JPanel implements DocumentListener { /** Sets the focus to the DuffPane if possible. */ private void focusToDuffPane() { - if (null != dp) dp.requestFocus(); + if (null != dp && !dp.hasFocus()) dp.grabFocus(); } /** the name of the property a developer should set to see @@ -769,7 +769,11 @@ public class Jskad extends JPanel implements DocumentListener { // program and whenever Jskad gets the focus, on // the DuffPane. public void windowActivated (WindowEvent e) { - focusToDuffPane(); + SwingUtilities.invokeLater(new Runnable() { + public void run() { + focusToDuffPane(); + } + }); } public void windowClosing (WindowEvent e) { if (!hasChanged || hasChanged && checkSave(JOptionPane.YES_NO_CANCEL_OPTION)) {