I tried running the Swing demo and I noticed the keyBindings for the
EditorPane also needed to be changed to a focus input map.
2005-12-21 Lillian Angel <[EMAIL PROTECTED]>
* javax/swing/plaf/basic/BasicLookAndFeel.java
(initComponentDefaults): Added focus input map for
EditorPane. Removed keyBindings.
* javax/swing/plaf/basic/BasicTextUI.java
(createKeyMap): Added check to prevent NPE.
Index: javax/swing/plaf/basic/BasicLookAndFeel.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java,v
retrieving revision 1.77
diff -u -r1.77 BasicLookAndFeel.java
--- javax/swing/plaf/basic/BasicLookAndFeel.java 22 Dec 2005 15:36:39 -0000 1.77
+++ javax/swing/plaf/basic/BasicLookAndFeel.java 22 Dec 2005 16:02:09 -0000
@@ -474,20 +474,14 @@
"EditorPane.font", new FontUIResource("Serif", Font.PLAIN, 12),
"EditorPane.foreground", new ColorUIResource(Color.black),
"EditorPane.inactiveForeground", new ColorUIResource(Color.gray),
- "EditorPane.keyBindings", new JTextComponent.KeyBinding[] {
- new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP,
- 0), "caret-up"),
- new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,
- 0), "caret-down"),
- new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP,
- 0), "page-up"),
- new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN,
- 0), "page-down"),
- new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,
- 0), "insert-break"),
- new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,
- 0), "insert-tab")
- },
+ "EditorPane.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
+ KeyStroke.getKeyStroke("UP"), "caret-up",
+ KeyStroke.getKeyStroke("DOWN"), "caret-down",
+ KeyStroke.getKeyStroke("PAGE_UP"), "page-up",
+ KeyStroke.getKeyStroke("PAGE_DOWN"), "page-down",
+ KeyStroke.getKeyStroke("ENTER"), "insert-break",
+ KeyStroke.getKeyStroke("TAB"), "insert-tab"
+ }),
"EditorPane.margin", new InsetsUIResource(3, 3, 3, 3),
"EditorPane.selectionBackground", new ColorUIResource(Color.black),
"EditorPane.selectionForeground", new ColorUIResource(Color.white),
Index: javax/swing/plaf/basic/BasicTextUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTextUI.java,v
retrieving revision 1.61
diff -u -r1.61 BasicTextUI.java
--- javax/swing/plaf/basic/BasicTextUI.java 22 Dec 2005 15:36:39 -0000 1.61
+++ javax/swing/plaf/basic/BasicTextUI.java 22 Dec 2005 16:02:10 -0000
@@ -621,17 +621,21 @@
*/
protected Keymap createKeymap()
{
+ JTextComponent.KeyBinding[] bindings = null;
String prefix = getPropertyPrefix();
InputMapUIResource m = (InputMapUIResource) UIManager.get(prefix + ".focusInputMap");
- KeyStroke[] keys = m.keys();
- int len = keys.length;
- JTextComponent.KeyBinding[] bindings = new JTextComponent.KeyBinding[len];
- for (int i = 0; i < len; i++)
+ if (m != null)
{
- KeyStroke curr = keys[i];
- bindings[i] = new JTextComponent.KeyBinding(curr, (String) m.get(curr));
+ KeyStroke[] keys = m.keys();
+ int len = keys.length;
+ bindings = new JTextComponent.KeyBinding[len];
+ for (int i = 0; i < len; i++)
+ {
+ KeyStroke curr = keys[i];
+ bindings[i] = new JTextComponent.KeyBinding(curr,
+ (String) m.get(curr));
+ }
}
-
if (bindings == null)
{
bindings = new JTextComponent.KeyBinding[0];
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches