From 0777cc7591671b9b5b1216a21e88ca5868c9cfaa Mon Sep 17 00:00:00 2001 From: Mike Thomas Date: Tue, 13 Mar 2007 18:20:16 +0000 Subject: [PATCH] JComboBoxes shouldn't have their focus stolen either, you can type into those to set the value. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@168 ed5b42cb-e716-0410-a449-f6a68f950b19 --- src/java/com/threerings/util/KeyDispatcher.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/java/com/threerings/util/KeyDispatcher.java b/src/java/com/threerings/util/KeyDispatcher.java index e4285447..413cd587 100644 --- a/src/java/com/threerings/util/KeyDispatcher.java +++ b/src/java/com/threerings/util/KeyDispatcher.java @@ -35,6 +35,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; +import javax.swing.JComboBox; import javax.swing.JRootPane; import javax.swing.JTable; import javax.swing.event.AncestorEvent; @@ -156,7 +157,7 @@ public class KeyDispatcher // if the key was typed on a non-text component or one // that wasn't editable... if (isChatCharacter(e.getKeyChar()) && - !isTypableTarget(target)) { + !isTypeableTarget(target)) { // focus our grabby component, and redirect this // key event there _curChatGrabber.requestFocusInWindow(); @@ -196,13 +197,14 @@ public class KeyDispatcher * into, and thus we shouldn't steal focus away from it if the user * starts typing. */ - protected boolean isTypableTarget (Component target) + protected boolean isTypeableTarget (Component target) { return target.isShowing() && (((target instanceof JTextComponent) && - ((JTextComponent) target).isEditable()) || - (target instanceof JTable) || - (target instanceof JRootPane)); + ((JTextComponent) target).isEditable()) || + (target instanceof JComboBox) || + (target instanceof JTable) || + (target instanceof JRootPane)); } /**