This patch fixes bug 24925 by not inserting text into a text component
that is either disabled or uneditable.
Also, when a key is typed, instead of calling insertString, we should be
calling replaceSelection. Fixed.
2005-11-21 Anthony Balkissoon <[EMAIL PROTECTED]>
Fixes bug #24925
* javax/swing/text/DefaultEditorKit.java:
(DefaultKeyTypedAction.actionPeformed): Call replaceSelection here
instead of insertString and only do so if the text component is both
enabled and editable.
--Tony
Index: javax/swing/text/DefaultEditorKit.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultEditorKit.java,v
retrieving revision 1.23
diff -u -r1.23 DefaultEditorKit.java
--- javax/swing/text/DefaultEditorKit.java 19 Oct 2005 14:57:30 -0000 1.23
+++ javax/swing/text/DefaultEditorKit.java 21 Nov 2005 16:05:34 -0000
@@ -216,19 +216,9 @@
return;
JTextComponent t = getTextComponent(event);
- if (t != null)
- {
- try
- {
- t.getDocument().insertString(t.getCaret().getDot(),
- event.getActionCommand(), null);
- }
- catch (BadLocationException be)
- {
- // FIXME: we're not authorized to throw this.. swallow it?
- }
- }
- }
+ if (t != null && t.isEnabled() && t.isEditable())
+ t.replaceSelection(event.getActionCommand());
+ }
}
/**
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches