All is fixed.
2005-12-21 Lillian Angel <[EMAIL PROTECTED]>
* javax/swing/UIDefaults.java
(createValue): Added check in. Bind might be an instance of
KeyStroke.
* javax/swing/plaf/basic/BasicLookAndFeel.java
(initComponentDefaults): Changed key bindings for
PasswordField, TextArea, TextPane, TextField to be instances of
KeyStroke.
(installKeyBoardActions): Added call to replace textComponent's
top-level action map to parentActionMap. Also, removed unneeded
code.
On Wed, 2005-12-21 at 21:18 +0100, Roman Kennke wrote:
> > > + "TextArea.focusInputMap", new UIDefaults.LazyInputMap(new
> > > Object[] {
> > > + "UP", "caret-up",
> > > + "DOWN", "caret-down",
> > > + "PAGE_UP", "page-up",
> > > + "PAGE_DOWN", "page-down",
> > > + "ENTER", "insert-break",
> > > + "TAB", "insert-tab",
> > > + "LEFT", "caret-backward",
> > > + "RIGHT", "caret-forward",
> > > + "BACK_SPACE", "delete-previous",
> > > + "ctrl X", "cut-to-clipboard",
> > > + "ctrl C", "copy-to-clipboard",
> > > + "ctrl V", "paste-from-clipboard",
> > > + "shift LEFT", "selection-backward",
> > > + "shift RIGHT", "selection-forward",
> > > + "HOME", "caret-begin-line",
> > > + "END", "caret-end-line",
> > > + "DELETE", "delete-next"
> > > + }),
> > >
> > > Why not put in all the bindings at once. I pasted the bindings (for
> > > JTextField) from JDK1.5 here:
> > > http://pastebin.com/473135
> >
> > I added them all in.
>
> You could use KeyStroke instances instead of e.g. "ctrl X", this is more
> efficient and safer IMO. You said that KeyStroke.getKeyStroke(String)
> doesn't get the modifiers right?
>
> > > + for (int i = 0; i < keys.length; i++)
> > > + {
> > > + String act = (String) focusInputMap.get((KeyStroke) keys[i]);
> > > + Action[] actions = textComponent.getActions();
> > > + for (int j = 0; j < actions.length; j++)
> > > + {
> > > + Action currAction = actions[j];
> > > + if (currAction != null
> > > + && (currAction.getValue(Action.NAME).equals(act)))
> > > + parentActionMap.put(act, new
> > > ActionListenerProxy(currAction, act));
> > > + }
> > > +
> > > + parentInputMap.put(KeyStroke.getKeyStroke(((KeyStroke)
> > > keys[i]).getKeyCode(),
> > > +
> > > convertModifiers(((KeyStroke) keys[i]).getModifiers())),
> > > + act);
> > > + parentInputMap.put(KeyStroke.getKeyStroke(((KeyStroke)
> > > keys[i]).getKeyCode(),
> > > + ((KeyStroke)
> > > keys[i]).getModifiers()),
> > > + act);
> > > + }
> > >
> > > Replace this with the one loop like pasted above. I suppose you are
> > > doing all this work to load the inputMap from the UI Object[]? Then you
> > > might want to use LookAndFeel.loadKeyBindings(). That takes an Object[]
> > > and loads the key bindings into an InputMap.
> >
> > I made this loop more efficent by far. I attempted to use the
> > loadKeyBindings, but I realized its not possible. I need to pass the
> > entire array of strings from the Text*.focusInputMap. But if I use the
> > UIManager to get the focusInputMap, an instance of InputMapUIResource is
> > returned (not an array). This InputMap contains half as many entries as
> > those in the array of strings (the key/value pairs). To get the values
> > of the input map, keys() is called and this returns an array of all the
> > KeyStrokes- not the strings. Therefore, in this case loadKeyBindings is
> > not helpful.
>
> If the UIManager returns an InputMap(UIResource), then you can use that.
> No need to copy around stuff. And yes, no need to use
> LookAndFeel.loadKeyBindings() -- that is probably used by UIManager to
> load the key bindings.
>
> > > parentInputMap.setParent(textComponent.getInputMap(JComponent.WHEN_FOCUSED).getParent());
> > > +
> > > parentActionMap.setParent(textComponent.getActionMap().getParent());
> > > +
> > > textComponent.getInputMap(JComponent.WHEN_FOCUSED).setParent(parentInputMap);
> > > + textComponent.getActionMap().setParent(parentActionMap);
> > >
> > > You don't really want to do this. Instead, simply call
> > > SwingUtilities.replaceUIInputMap() or
> > > SwingUtilities.replaceUIActionMap() to properly install the top-level
> > > Input/ActionMaps.
> >
> > This is setting the parents of the map. I don't see why I should call
> > replaceUI*Map here.
>
>
> This is what SwingUtilities.replaceUIInputMap() does. Normally, for a
> component you have the following InputMaps:
>
> UI InputMap (top-level)
> Component InputMap
> User InputMap (optionally installed by application code)
>
> What you want to do here is replace the toplevel (UI) InputMap with a
> new one. This is what SwingUtilities.replaceUIInputMap does. You should
> really use this to avoid troubles. There is no need to keep the former
> parent of the component input map as parent of the new UI InputMap or
> something. The end result should be a structure with a (shared) UI
> InputMap at the top and an (probably) empty component InputMap as a
> child. The background is that when the component UI input map is
> modified, this won't modify the UI InputMap (which is a shared instance
> between all components of this UI).
>
> /Roman
>
Index: javax/swing/UIDefaults.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/UIDefaults.java,v
retrieving revision 1.25
diff -u -r1.25 UIDefaults.java
--- javax/swing/UIDefaults.java 21 Dec 2005 19:58:32 -0000 1.25
+++ javax/swing/UIDefaults.java 21 Dec 2005 20:59:14 -0000
@@ -99,7 +99,11 @@
InputMapUIResource im = new InputMapUIResource ();
for (int i = 0; 2*i+1 < bind.length; ++i)
{
- im.put (KeyStroke.getKeyStroke ((String) bind[2*i]),
+ Object curr = bind[2*i];
+ if (curr instanceof KeyStroke)
+ im.put((KeyStroke) curr, bind[2*i+1]);
+ else
+ im.put(KeyStroke.getKeyStroke((String) curr),
bind[2*i+1]);
}
return im;
Index: javax/swing/plaf/basic/BasicLookAndFeel.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java,v
retrieving revision 1.73
diff -u -r1.73 BasicLookAndFeel.java
--- javax/swing/plaf/basic/BasicLookAndFeel.java 21 Dec 2005 20:05:48 -0000 1.73
+++ javax/swing/plaf/basic/BasicLookAndFeel.java 21 Dec 2005 20:59:14 -0000
@@ -768,39 +768,39 @@
"PasswordField.inactiveBackground", new ColorUIResource(light),
"PasswordField.inactiveForeground", new ColorUIResource(Color.gray),
"PasswordField.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
- "END", "caret-end-line",
- "shift ctrl O", "toggle-componentOrientation",
- "shift KP_LEFT", "selection-backward",
- "shift RIGHT", "selection-forward",
- "HOME", "caret-begin-line",
- "ctrl V", "paste-from-clipboard",
- "ctrl H", "delete-previous",
- "KP_LEFT", "caret-backward",
- "LEFT", "caret-backward",
- "ctrl X", "cut-to-clipboard",
- "KP_RIGHT", "caret-forward",
- "shift ctrl KP_RIGHT", "selection-end-line",
- "COPY", "copy-to-clipboard",
- "shift HOME", "selection-begin-line",
- "RIGHT", "caret-forward",
- "shift ctrl LEFT", "selection-begin-line",
- "ctrl KP_LEFT", "caret-begin-line",
- "ctrl KP_RIGHT", "caret-end-line",
- "PASTE", "paste-from-clipboard",
- "shift ctrl RIGHT", "selection-end-line",
- "ctrl BACK_SLASH", "unselect",
- "ctrl A", "select-all",
- "shift KP_RIGHT", "selection-forward",
- "CUT", "cut-to-clipboard",
- "ctrl LEFT", "caret-begin-line",
- "BACK_SPACE", "delete-previous",
- "shift ctrl KP_LEFT", "selection-begin-line",
- "ctrl C", "copy-to-clipboard",
- "shift END", "selection-end-line",
- "ctrl RIGHT", "caret-end-line",
- "DELETE", "delete-next",
- "ENTER", "notify-field-accept",
- "shift LEFT", "selection-backward"
+ KeyStroke.getKeyStroke("END"), "caret-end-line",
+ KeyStroke.getKeyStroke("shift ctrl O"), "toggle-componentOrientation",
+ KeyStroke.getKeyStroke("shift KP_LEFT"), "selection-backward",
+ KeyStroke.getKeyStroke("shift RIGHT"), "selection-forward",
+ KeyStroke.getKeyStroke("HOME"), "caret-begin-line",
+ KeyStroke.getKeyStroke("ctrl V"), "paste-from-clipboard",
+ KeyStroke.getKeyStroke("ctrl H"), "delete-previous",
+ KeyStroke.getKeyStroke("KP_LEFT"), "caret-backward",
+ KeyStroke.getKeyStroke("LEFT"), "caret-backward",
+ KeyStroke.getKeyStroke("ctrl X"), "cut-to-clipboard",
+ KeyStroke.getKeyStroke("KP_RIGHT"), "caret-forward",
+ KeyStroke.getKeyStroke("shift ctrl KP_RIGHT"), "selection-end-line",
+ KeyStroke.getKeyStroke("COPY"), "copy-to-clipboard",
+ KeyStroke.getKeyStroke("shift HOME"), "selection-begin-line",
+ KeyStroke.getKeyStroke("RIGHT"), "caret-forward",
+ KeyStroke.getKeyStroke("shift ctrl LEFT"), "selection-begin-line",
+ KeyStroke.getKeyStroke("ctrl KP_LEFT"), "caret-begin-line",
+ KeyStroke.getKeyStroke("ctrl KP_RIGHT"), "caret-end-line",
+ KeyStroke.getKeyStroke("PASTE"), "paste-from-clipboard",
+ KeyStroke.getKeyStroke("shift ctrl RIGHT"), "selection-end-line",
+ KeyStroke.getKeyStroke("ctrl BACK_SLASH"), "unselect",
+ KeyStroke.getKeyStroke("ctrl A"), "select-all",
+ KeyStroke.getKeyStroke("shift KP_RIGHT"), "selection-forward",
+ KeyStroke.getKeyStroke("CUT"), "cut-to-clipboard",
+ KeyStroke.getKeyStroke("ctrl LEFT"), "caret-begin-line",
+ KeyStroke.getKeyStroke("BACK_SPACE"), "delete-previous",
+ KeyStroke.getKeyStroke("shift ctrl KP_LEFT"), "selection-begin-line",
+ KeyStroke.getKeyStroke("ctrl C"), "copy-to-clipboard",
+ KeyStroke.getKeyStroke("shift END"), "selection-end-line",
+ KeyStroke.getKeyStroke("ctrl RIGHT"), "caret-end-line",
+ KeyStroke.getKeyStroke("DELETE"), "delete-next",
+ KeyStroke.getKeyStroke("ENTER"), "notify-field-accept",
+ KeyStroke.getKeyStroke("shift LEFT"), "selection-backward"
}),
"PasswordField.margin", new InsetsUIResource(0, 0, 0, 0),
"PasswordField.selectionBackground", new ColorUIResource(Color.black),
@@ -1090,61 +1090,61 @@
"TextArea.foreground", new ColorUIResource(Color.black),
"TextArea.inactiveForeground", new ColorUIResource(Color.gray),
"TextArea.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
- "shift UP", "selection-up",
- "ctrl RIGHT", "caret-next-word",
- "shift ctrl LEFT", "selection-previous-word",
- "shift KP_UP", "selection-up",
- "DOWN", "caret-down",
- "shift ctrl T", "previous-link-action",
- "ctrl LEFT", "caret-previous-word",
- "CUT", "cut-to-clipboard",
- "END", "caret-end-line",
- "shift PAGE_UP", "selection-page-up",
- "KP_UP", "caret-up",
- "DELETE", "delete-next",
- "ctrl HOME", "caret-begin",
- "shift LEFT", "selection-backward",
- "ctrl END", "caret-end",
- "BACK_SPACE", "delete-previous",
- "shift ctrl RIGHT", "selection-next-word",
- "LEFT", "caret-backward",
- "KP_LEFT", "caret-backward",
- "shift KP_RIGHT", "selection-forward",
- "ctrl SPACE", "activate-link-action",
- "ctrl H", "delete-previous",
- "ctrl BACK_SLASH", "unselect",
- "ENTER", "insert-break",
- "shift HOME", "selection-begin-line",
- "RIGHT", "caret-forward",
- "shift ctrl PAGE_UP", "selection-page-left",
- "shift DOWN", "selection-down",
- "PAGE_DOWN", "page-down",
- "shift KP_LEFT", "selection-backward",
- "shift ctrl O", "toggle-componentOrientation",
- "ctrl X", "cut-to-clipboard",
- "shift ctrl PAGE_DOWN", "selection-page-right",
- "ctrl C", "copy-to-clipboard",
- "ctrl KP_RIGHT", "caret-next-word",
- "shift END", "selection-end-line",
- "ctrl KP_LEFT", "caret-previous-word",
- "HOME", "caret-begin-line",
- "ctrl V", "paste-from-clipboard",
- "KP_DOWN", "caret-down",
- "ctrl A", "select-all",
- "shift RIGHT", "selection-forward",
- "shift ctrl END", "selection-end",
- "COPY", "copy-to-clipboard",
- "shift ctrl KP_LEFT", "selection-previous-word",
- "ctrl T", "next-link-action",
- "shift KP_DOWN", "selection-down",
- "TAB", "insert-tab",
- "UP", "caret-up",
- "shift ctrl HOME", "selection-begin",
- "shift PAGE_DOWN", "selection-page-down",
- "KP_RIGHT", "caret-forward",
- "shift ctrl KP_RIGHT", "selection-next-word",
- "PAGE_UP", "page-up",
- "PASTE", "paste-from-clipboard"
+ KeyStroke.getKeyStroke("shift UP"), "selection-up",
+ KeyStroke.getKeyStroke("ctrl RIGHT"), "caret-next-word",
+ KeyStroke.getKeyStroke("shift ctrl LEFT"), "selection-previous-word",
+ KeyStroke.getKeyStroke("shift KP_UP"), "selection-up",
+ KeyStroke.getKeyStroke("DOWN"), "caret-down",
+ KeyStroke.getKeyStroke("shift ctrl T"), "previous-link-action",
+ KeyStroke.getKeyStroke("ctrl LEFT"), "caret-previous-word",
+ KeyStroke.getKeyStroke("CUT"), "cut-to-clipboard",
+ KeyStroke.getKeyStroke("END"), "caret-end-line",
+ KeyStroke.getKeyStroke("shift PAGE_UP"), "selection-page-up",
+ KeyStroke.getKeyStroke("KP_UP"), "caret-up",
+ KeyStroke.getKeyStroke("DELETE"), "delete-next",
+ KeyStroke.getKeyStroke("ctrl HOME"), "caret-begin",
+ KeyStroke.getKeyStroke("shift LEFT"), "selection-backward",
+ KeyStroke.getKeyStroke("ctrl END"), "caret-end",
+ KeyStroke.getKeyStroke("BACK_SPACE"), "delete-previous",
+ KeyStroke.getKeyStroke("shift ctrl RIGHT"), "selection-next-word",
+ KeyStroke.getKeyStroke("LEFT"), "caret-backward",
+ KeyStroke.getKeyStroke("KP_LEFT"), "caret-backward",
+ KeyStroke.getKeyStroke("shift KP_RIGHT"), "selection-forward",
+ KeyStroke.getKeyStroke("ctrl SPACE"), "activate-link-action",
+ KeyStroke.getKeyStroke("ctrl H"), "delete-previous",
+ KeyStroke.getKeyStroke("ctrl BACK_SLASH"), "unselect",
+ KeyStroke.getKeyStroke("ENTER"), "insert-break",
+ KeyStroke.getKeyStroke("shift HOME"), "selection-begin-line",
+ KeyStroke.getKeyStroke("RIGHT"), "caret-forward",
+ KeyStroke.getKeyStroke("shift ctrl PAGE_UP"), "selection-page-left",
+ KeyStroke.getKeyStroke("shift DOWN"), "selection-down",
+ KeyStroke.getKeyStroke("PAGE_DOWN"), "page-down",
+ KeyStroke.getKeyStroke("shift KP_LEFT"), "selection-backward",
+ KeyStroke.getKeyStroke("shift ctrl O"), "toggle-componentOrientation",
+ KeyStroke.getKeyStroke("ctrl X"), "cut-to-clipboard",
+ KeyStroke.getKeyStroke("shift ctrl PAGE_DOWN"), "selection-page-right",
+ KeyStroke.getKeyStroke("ctrl C"), "copy-to-clipboard",
+ KeyStroke.getKeyStroke("ctrl KP_RIGHT"), "caret-next-word",
+ KeyStroke.getKeyStroke("shift END"), "selection-end-line",
+ KeyStroke.getKeyStroke("ctrl KP_LEFT"), "caret-previous-word",
+ KeyStroke.getKeyStroke("HOME"), "caret-begin-line",
+ KeyStroke.getKeyStroke("ctrl V"), "paste-from-clipboard",
+ KeyStroke.getKeyStroke("KP_DOWN"), "caret-down",
+ KeyStroke.getKeyStroke("ctrl A"), "select-all",
+ KeyStroke.getKeyStroke("shift RIGHT"), "selection-forward",
+ KeyStroke.getKeyStroke("shift ctrl END"), "selection-end",
+ KeyStroke.getKeyStroke("COPY"), "copy-to-clipboard",
+ KeyStroke.getKeyStroke("shift ctrl KP_LEFT"), "selection-previous-word",
+ KeyStroke.getKeyStroke("ctrl T"), "next-link-action",
+ KeyStroke.getKeyStroke("shift KP_DOWN"), "selection-down",
+ KeyStroke.getKeyStroke("TAB"), "insert-tab",
+ KeyStroke.getKeyStroke("UP"), "caret-up",
+ KeyStroke.getKeyStroke("shift ctrl HOME"), "selection-begin",
+ KeyStroke.getKeyStroke("shift PAGE_DOWN"), "selection-page-down",
+ KeyStroke.getKeyStroke("KP_RIGHT"), "caret-forward",
+ KeyStroke.getKeyStroke("shift ctrl KP_RIGHT"), "selection-next-word",
+ KeyStroke.getKeyStroke("PAGE_UP"), "page-up",
+ KeyStroke.getKeyStroke("PASTE"), "paste-from-clipboard"
}),
"TextArea.margin", new InsetsUIResource(0, 0, 0, 0),
"TextArea.selectionBackground", new ColorUIResource(Color.black),
@@ -1162,39 +1162,39 @@
"TextField.light", new ColorUIResource(highLight),
"TextField.highlight", new ColorUIResource(light),
"TextField.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
- "ENTER", "notify-field-accept",
- "LEFT", "caret-backward",
- "RIGHT", "caret-forward",
- "BACK_SPACE", "delete-previous",
- "ctrl X", "cut-to-clipboard",
- "ctrl C", "copy-to-clipboard",
- "ctrl V", "paste-from-clipboard",
- "shift LEFT", "selection-backward",
- "shift RIGHT", "selection-forward",
- "HOME", "caret-begin-line",
- "END", "caret-end-line",
- "DELETE", "delete-next",
- "shift ctrl O", "toggle-componentOrientation",
- "shift KP_LEFT", "selection-backward",
- "ctrl H", "delete-previous",
- "KP_LEFT", "caret-backward",
- "KP_RIGHT", "caret-forward",
- "shift ctrl KP_RIGHT", "selection-next-word",
- "COPY", "copy-to-clipboard",
- "shift HOME", "selection-begin-line",
- "shift ctrl LEFT", "selection-previous-word",
- "ctrl KP_LEFT", "caret-previous-word",
- "ctrl KP_RIGHT", "caret-next-word",
- "PASTE", "paste-from-clipboard",
- "shift ctrl RIGHT", "selection-next-word",
- "ctrl BACK_SLASH", "unselect",
- "ctrl A", "select-all",
- "shift KP_RIGHT", "selection-forward",
- "CUT", "cut-to-clipboard",
- "ctrl LEFT", "caret-previous-word",
- "shift ctrl KP_LEFT", "selection-previous-word",
- "shift END", "selection-end-line",
- "ctrl RIGHT", "caret-next-word"
+ KeyStroke.getKeyStroke("ENTER"), "notify-field-accept",
+ KeyStroke.getKeyStroke("LEFT"), "caret-backward",
+ KeyStroke.getKeyStroke("RIGHT"), "caret-forward",
+ KeyStroke.getKeyStroke("BACK_SPACE"), "delete-previous",
+ KeyStroke.getKeyStroke("ctrl X"), "cut-to-clipboard",
+ KeyStroke.getKeyStroke("ctrl C"), "copy-to-clipboard",
+ KeyStroke.getKeyStroke("ctrl V"), "paste-from-clipboard",
+ KeyStroke.getKeyStroke("shift LEFT"), "selection-backward",
+ KeyStroke.getKeyStroke("shift RIGHT"), "selection-forward",
+ KeyStroke.getKeyStroke("HOME"), "caret-begin-line",
+ KeyStroke.getKeyStroke("END"), "caret-end-line",
+ KeyStroke.getKeyStroke("DELETE"), "delete-next",
+ KeyStroke.getKeyStroke("shift ctrl O"), "toggle-componentOrientation",
+ KeyStroke.getKeyStroke("shift KP_LEFT"), "selection-backward",
+ KeyStroke.getKeyStroke("ctrl H"), "delete-previous",
+ KeyStroke.getKeyStroke("KP_LEFT"), "caret-backward",
+ KeyStroke.getKeyStroke("KP_RIGHT"), "caret-forward",
+ KeyStroke.getKeyStroke("shift ctrl KP_RIGHT"), "selection-next-word",
+ KeyStroke.getKeyStroke("COPY"), "copy-to-clipboard",
+ KeyStroke.getKeyStroke("shift HOME"), "selection-begin-line",
+ KeyStroke.getKeyStroke("shift ctrl LEFT"), "selection-previous-word",
+ KeyStroke.getKeyStroke("ctrl KP_LEFT"), "caret-previous-word",
+ KeyStroke.getKeyStroke("ctrl KP_RIGHT"), "caret-next-word",
+ KeyStroke.getKeyStroke("PASTE"), "paste-from-clipboard",
+ KeyStroke.getKeyStroke("shift ctrl RIGHT"), "selection-next-word",
+ KeyStroke.getKeyStroke("ctrl BACK_SLASH"), "unselect",
+ KeyStroke.getKeyStroke("ctrl A"), "select-all",
+ KeyStroke.getKeyStroke("shift KP_RIGHT"), "selection-forward",
+ KeyStroke.getKeyStroke("CUT"), "cut-to-clipboard",
+ KeyStroke.getKeyStroke("ctrl LEFT"), "caret-previous-word",
+ KeyStroke.getKeyStroke("shift ctrl KP_LEFT"), "selection-previous-word",
+ KeyStroke.getKeyStroke("shift END"), "selection-end-line",
+ KeyStroke.getKeyStroke("ctrl RIGHT"), "caret-next-word"
}),
"TextField.margin", new InsetsUIResource(0, 0, 0, 0),
"TextField.selectionBackground", new ColorUIResource(Color.black),
@@ -1207,61 +1207,61 @@
"TextPane.foreground", new ColorUIResource(Color.black),
"TextPane.inactiveForeground", new ColorUIResource(Color.gray),
"TextPane.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
- "shift UP", "selection-up",
- "ctrl RIGHT", "caret-next-word",
- "shift ctrl LEFT", "selection-previous-word",
- "shift KP_UP", "selection-up",
- "DOWN", "caret-down",
- "shift ctrl T", "previous-link-action",
- "ctrl LEFT", "caret-previous-word",
- "CUT", "cut-to-clipboard",
- "END", "caret-end-line",
- "shift PAGE_UP", "selection-page-up",
- "KP_UP", "caret-up",
- "DELETE", "delete-next",
- "ctrl HOME", "caret-begin",
- "shift LEFT", "selection-backward",
- "ctrl END", "caret-end",
- "BACK_SPACE", "delete-previous",
- "shift ctrl RIGHT", "selection-next-word",
- "LEFT", "caret-backward",
- "KP_LEFT", "caret-backward",
- "shift KP_RIGHT", "selection-forward",
- "ctrl SPACE", "activate-link-action",
- "ctrl H", "delete-previous",
- "ctrl BACK_SLASH", "unselect",
- "ENTER", "insert-break",
- "shift HOME", "selection-begin-line",
- "RIGHT", "caret-forward",
- "shift ctrl PAGE_UP", "selection-page-left",
- "shift DOWN", "selection-down",
- "PAGE_DOWN", "page-down",
- "shift KP_LEFT", "selection-backward",
- "shift ctrl O", "toggle-componentOrientation",
- "ctrl X", "cut-to-clipboard",
- "shift ctrl PAGE_DOWN", "selection-page-right",
- "ctrl C", "copy-to-clipboard",
- "ctrl KP_RIGHT", "caret-next-word",
- "shift END", "selection-end-line",
- "ctrl KP_LEFT", "caret-previous-word",
- "HOME", "caret-begin-line",
- "ctrl V", "paste-from-clipboard",
- "KP_DOWN", "caret-down",
- "ctrl A", "select-all",
- "shift RIGHT", "selection-forward",
- "shift ctrl END", "selection-end",
- "COPY", "copy-to-clipboard",
- "shift ctrl KP_LEFT", "selection-previous-word",
- "ctrl T", "next-link-action",
- "shift KP_DOWN", "selection-down",
- "TAB", "insert-tab",
- "UP", "caret-up",
- "shift ctrl HOME", "selection-begin",
- "shift PAGE_DOWN", "selection-page-down",
- "KP_RIGHT", "caret-forward",
- "shift ctrl KP_RIGHT", "selection-next-word",
- "PAGE_UP", "page-up",
- "PASTE", "paste-from-clipboard"
+ KeyStroke.getKeyStroke("shift UP"), "selection-up",
+ KeyStroke.getKeyStroke("ctrl RIGHT"), "caret-next-word",
+ KeyStroke.getKeyStroke("shift ctrl LEFT"), "selection-previous-word",
+ KeyStroke.getKeyStroke("shift KP_UP"), "selection-up",
+ KeyStroke.getKeyStroke("DOWN"), "caret-down",
+ KeyStroke.getKeyStroke("shift ctrl T"), "previous-link-action",
+ KeyStroke.getKeyStroke("ctrl LEFT"), "caret-previous-word",
+ KeyStroke.getKeyStroke("CUT"), "cut-to-clipboard",
+ KeyStroke.getKeyStroke("END"), "caret-end-line",
+ KeyStroke.getKeyStroke("shift PAGE_UP"), "selection-page-up",
+ KeyStroke.getKeyStroke("KP_UP"), "caret-up",
+ KeyStroke.getKeyStroke("DELETE"), "delete-next",
+ KeyStroke.getKeyStroke("ctrl HOME"), "caret-begin",
+ KeyStroke.getKeyStroke("shift LEFT"), "selection-backward",
+ KeyStroke.getKeyStroke("ctrl END"), "caret-end",
+ KeyStroke.getKeyStroke("BACK_SPACE"), "delete-previous",
+ KeyStroke.getKeyStroke("shift ctrl RIGHT"), "selection-next-word",
+ KeyStroke.getKeyStroke("LEFT"), "caret-backward",
+ KeyStroke.getKeyStroke("KP_LEFT"), "caret-backward",
+ KeyStroke.getKeyStroke("shift KP_RIGHT"), "selection-forward",
+ KeyStroke.getKeyStroke("ctrl SPACE"), "activate-link-action",
+ KeyStroke.getKeyStroke("ctrl H"), "delete-previous",
+ KeyStroke.getKeyStroke("ctrl BACK_SLASH"), "unselect",
+ KeyStroke.getKeyStroke("ENTER"), "insert-break",
+ KeyStroke.getKeyStroke("shift HOME"), "selection-begin-line",
+ KeyStroke.getKeyStroke("RIGHT"), "caret-forward",
+ KeyStroke.getKeyStroke("shift ctrl PAGE_UP"), "selection-page-left",
+ KeyStroke.getKeyStroke("shift DOWN"), "selection-down",
+ KeyStroke.getKeyStroke("PAGE_DOWN"), "page-down",
+ KeyStroke.getKeyStroke("shift KP_LEFT"), "selection-backward",
+ KeyStroke.getKeyStroke("shift ctrl O"), "toggle-componentOrientation",
+ KeyStroke.getKeyStroke("ctrl X"), "cut-to-clipboard",
+ KeyStroke.getKeyStroke("shift ctrl PAGE_DOWN"), "selection-page-right",
+ KeyStroke.getKeyStroke("ctrl C"), "copy-to-clipboard",
+ KeyStroke.getKeyStroke("ctrl KP_RIGHT"), "caret-next-word",
+ KeyStroke.getKeyStroke("shift END"), "selection-end-line",
+ KeyStroke.getKeyStroke("ctrl KP_LEFT"), "caret-previous-word",
+ KeyStroke.getKeyStroke("HOME"), "caret-begin-line",
+ KeyStroke.getKeyStroke("ctrl V"), "paste-from-clipboard",
+ KeyStroke.getKeyStroke("KP_DOWN"), "caret-down",
+ KeyStroke.getKeyStroke("ctrl A"), "select-all",
+ KeyStroke.getKeyStroke("shift RIGHT"), "selection-forward",
+ KeyStroke.getKeyStroke("shift ctrl END"), "selection-end",
+ KeyStroke.getKeyStroke("COPY"), "copy-to-clipboard",
+ KeyStroke.getKeyStroke("shift ctrl KP_LEFT"), "selection-previous-word",
+ KeyStroke.getKeyStroke("ctrl T"), "next-link-action",
+ KeyStroke.getKeyStroke("shift KP_DOWN"), "selection-down",
+ KeyStroke.getKeyStroke("TAB"), "insert-tab",
+ KeyStroke.getKeyStroke("UP"), "caret-up",
+ KeyStroke.getKeyStroke("shift ctrl HOME"), "selection-begin",
+ KeyStroke.getKeyStroke("shift PAGE_DOWN"), "selection-page-down",
+ KeyStroke.getKeyStroke("KP_RIGHT"), "caret-forward",
+ KeyStroke.getKeyStroke("shift ctrl KP_RIGHT"), "selection-next-word",
+ KeyStroke.getKeyStroke("PAGE_UP"), "page-up",
+ KeyStroke.getKeyStroke("PASTE"), "paste-from-clipboard"
}),
"TextPane.margin", new InsetsUIResource(3, 3, 3, 3),
"TextPane.selectionBackground", new ColorUIResource(Color.black),
Index: javax/swing/plaf/basic/BasicTextUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTextUI.java,v
retrieving revision 1.59
diff -u -r1.59 BasicTextUI.java
--- javax/swing/plaf/basic/BasicTextUI.java 21 Dec 2005 19:58:14 -0000 1.59
+++ javax/swing/plaf/basic/BasicTextUI.java 21 Dec 2005 20:59:14 -0000
@@ -655,9 +655,7 @@
SwingUtilities.replaceUIActionMap(textComponent, createActionMap());
InputMap focusInputMap = (InputMap) UIManager.get(getPropertyPrefix() + ".focusInputMap");
- InputMapUIResource parentInputMap = new InputMapUIResource();
ActionMap parentActionMap = new ActionMapUIResource();
- KeyStroke[] keys = focusInputMap.allKeys();
Action[] actions = textComponent.getActions();
for (int j = 0; j < actions.length; j++)
@@ -666,16 +664,7 @@
parentActionMap.put(currAction.getValue(Action.NAME), currAction);
}
- for (int i = 0; i < keys.length; i++)
- {
- String act = (String) focusInputMap.get((KeyStroke) keys[i]);
- parentInputMap.put(KeyStroke.getKeyStroke(act),act);
- }
-
- parentInputMap.setParent(textComponent.getInputMap(JComponent.WHEN_FOCUSED).getParent());
- parentActionMap.setParent(textComponent.getActionMap().getParent());
- textComponent.getInputMap(JComponent.WHEN_FOCUSED).setParent(parentInputMap);
- textComponent.getActionMap().setParent(parentActionMap);
+ SwingUtilities.replaceUIActionMap(textComponent, parentActionMap);
}
/**
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches