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
This commit is contained in:
@@ -35,6 +35,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
import javax.swing.JComboBox;
|
||||||
import javax.swing.JRootPane;
|
import javax.swing.JRootPane;
|
||||||
import javax.swing.JTable;
|
import javax.swing.JTable;
|
||||||
import javax.swing.event.AncestorEvent;
|
import javax.swing.event.AncestorEvent;
|
||||||
@@ -156,7 +157,7 @@ public class KeyDispatcher
|
|||||||
// if the key was typed on a non-text component or one
|
// if the key was typed on a non-text component or one
|
||||||
// that wasn't editable...
|
// that wasn't editable...
|
||||||
if (isChatCharacter(e.getKeyChar()) &&
|
if (isChatCharacter(e.getKeyChar()) &&
|
||||||
!isTypableTarget(target)) {
|
!isTypeableTarget(target)) {
|
||||||
// focus our grabby component, and redirect this
|
// focus our grabby component, and redirect this
|
||||||
// key event there
|
// key event there
|
||||||
_curChatGrabber.requestFocusInWindow();
|
_curChatGrabber.requestFocusInWindow();
|
||||||
@@ -196,13 +197,14 @@ public class KeyDispatcher
|
|||||||
* into, and thus we shouldn't steal focus away from it if the user
|
* into, and thus we shouldn't steal focus away from it if the user
|
||||||
* starts typing.
|
* starts typing.
|
||||||
*/
|
*/
|
||||||
protected boolean isTypableTarget (Component target)
|
protected boolean isTypeableTarget (Component target)
|
||||||
{
|
{
|
||||||
return target.isShowing() &&
|
return target.isShowing() &&
|
||||||
(((target instanceof JTextComponent) &&
|
(((target instanceof JTextComponent) &&
|
||||||
((JTextComponent) target).isEditable()) ||
|
((JTextComponent) target).isEditable()) ||
|
||||||
(target instanceof JTable) ||
|
(target instanceof JComboBox) ||
|
||||||
(target instanceof JRootPane));
|
(target instanceof JTable) ||
|
||||||
|
(target instanceof JRootPane));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user