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.
This commit is contained in:
parent
51679c158b
commit
9effee0564
1 changed files with 6 additions and 2 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Reference in a new issue