UI defaults: get rid of Aqua InputMaps on macOS

This commit is contained in:
Karl Tauber
2020-02-24 20:44:14 +01:00
parent d3752573e7
commit 958dfa8ae9
3 changed files with 386 additions and 151 deletions

View File

@@ -31,11 +31,12 @@ import static javax.swing.text.DefaultEditorKit.*;
*/ */
class FlatInputMaps class FlatInputMaps
{ {
static void initInputMaps( UIDefaults defaults, UIDefaults baseDefaults ) { static void initInputMaps( UIDefaults defaults ) {
if( !SystemInfo.IS_MAC )
initBasicInputMaps( defaults ); initBasicInputMaps( defaults );
else initTextComponentInputMaps( defaults );
initMacInputMaps( defaults, baseDefaults );
if( SystemInfo.IS_MAC )
initMacInputMaps( defaults );
} }
private static void initBasicInputMaps( UIDefaults defaults ) { private static void initBasicInputMaps( UIDefaults defaults ) {
@@ -52,12 +53,13 @@ class FlatInputMaps
"KP_UP", "selectPrevious", "KP_UP", "selectPrevious",
"KP_DOWN", "selectNext", "KP_DOWN", "selectNext",
"alt UP", "togglePopup", mac( "alt UP", null ), "togglePopup",
"alt DOWN", "togglePopup", mac( "alt DOWN", null ), "togglePopup",
"alt KP_UP", "togglePopup", mac( "alt KP_UP", null ), "togglePopup",
"alt KP_DOWN", "togglePopup" mac( "alt KP_DOWN", null ), "togglePopup"
); );
if( !SystemInfo.IS_MAC ) {
modifyInputMap( defaults, "FileChooser.ancestorInputMap", modifyInputMap( defaults, "FileChooser.ancestorInputMap",
"F2", "editFileName", "F2", "editFileName",
"BACK_SPACE", "Go Up" "BACK_SPACE", "Go Up"
@@ -72,7 +74,10 @@ class FlatInputMaps
"ADD", "expand", "ADD", "expand",
"SUBTRACT", "collapse" "SUBTRACT", "collapse"
); );
}
}
private static void initTextComponentInputMaps( UIDefaults defaults ) {
Object[] commonTextComponentBindings = { Object[] commonTextComponentBindings = {
// move caret one character (without selecting text) // move caret one character (without selecting text)
"LEFT", backwardAction, "LEFT", backwardAction,
@@ -87,28 +92,28 @@ class FlatInputMaps
"shift KP_RIGHT", selectionForwardAction, "shift KP_RIGHT", selectionForwardAction,
// move caret to word (without selecting text) // move caret to word (without selecting text)
"ctrl LEFT", previousWordAction, mac( "ctrl LEFT", "alt LEFT" ), previousWordAction,
"ctrl RIGHT", nextWordAction, mac( "ctrl RIGHT", "alt RIGHT" ), nextWordAction,
"ctrl KP_LEFT", previousWordAction, mac( "ctrl KP_LEFT", "alt KP_LEFT" ), previousWordAction,
"ctrl KP_RIGHT", nextWordAction, mac( "ctrl KP_RIGHT", "alt KP_RIGHT" ), nextWordAction,
// move caret to word and select text // move caret to word and select text
"ctrl shift LEFT", selectionPreviousWordAction, mac( "ctrl shift LEFT", "shift alt LEFT" ), selectionPreviousWordAction,
"ctrl shift RIGHT", selectionNextWordAction, mac( "ctrl shift RIGHT", "shift alt RIGHT" ), selectionNextWordAction,
"ctrl shift KP_LEFT", selectionPreviousWordAction, mac( "ctrl shift KP_LEFT", "shift alt KP_LEFT" ), selectionPreviousWordAction,
"ctrl shift KP_RIGHT", selectionNextWordAction, mac( "ctrl shift KP_RIGHT", "shift alt KP_RIGHT" ), selectionNextWordAction,
// move caret to line begin/end (without selecting text) // move caret to line begin/end (without selecting text)
"HOME", beginLineAction, mac( "HOME", "meta LEFT" ), beginLineAction,
"END", endLineAction, mac( "END", "meta RIGHT" ), endLineAction,
// move caret to line begin/end and select text // move caret to line begin/end and select text
"shift HOME", selectionBeginLineAction, mac( "shift HOME", "shift meta LEFT" ), selectionBeginLineAction,
"shift END", selectionEndLineAction, mac( "shift END", "shift meta RIGHT" ), selectionEndLineAction,
// select all/none // select all/none
"ctrl A", selectAllAction, mac( "ctrl A", "meta A" ), selectAllAction,
"ctrl BACK_SLASH", "unselect", // DefaultEditorKit.unselectAction mac( "ctrl BACK_SLASH", "meta BACK_SLASH" ), "unselect", // DefaultEditorKit.unselectAction
// delete previous/next character // delete previous/next character
"BACK_SPACE", deletePrevCharAction, "BACK_SPACE", deletePrevCharAction,
@@ -117,28 +122,89 @@ class FlatInputMaps
"DELETE", deleteNextCharAction, "DELETE", deleteNextCharAction,
// delete previous/next word // delete previous/next word
"ctrl BACK_SPACE", deletePrevWordAction, mac( "ctrl BACK_SPACE", "alt BACK_SPACE" ), deletePrevWordAction,
"ctrl DELETE", deleteNextWordAction, mac( "ctrl DELETE", "alt DELETE" ), deleteNextWordAction,
// clipboard // clipboard
"ctrl X", cutAction, mac( "ctrl X", "meta X" ), cutAction,
"ctrl C", copyAction, mac( "ctrl C", "meta C" ), copyAction,
"ctrl V", pasteAction, mac( "ctrl V", "meta V" ), pasteAction,
"CUT", cutAction, "CUT", cutAction,
"COPY", copyAction, "COPY", copyAction,
"PASTE", pasteAction, "PASTE", pasteAction,
"shift DELETE", cutAction, mac( "shift DELETE", null ), cutAction,
"control INSERT", copyAction, mac( "control INSERT", null ), copyAction,
"shift INSERT", pasteAction, mac( "shift INSERT", null ), pasteAction,
// misc // misc
"control shift O", "toggle-componentOrientation", // DefaultEditorKit.toggleComponentOrientation "control shift O", "toggle-componentOrientation", // DefaultEditorKit.toggleComponentOrientation
}; };
Object[] macCommonTextComponentBindings = SystemInfo.IS_MAC ? new Object[] {
// move caret one character (without selecting text)
"ctrl B", backwardAction,
"ctrl F", forwardAction,
// move caret to document begin/end (without selecting text)
"HOME", beginAction,
"END", endAction,
"meta UP", beginAction,
"meta DOWN", endAction,
"meta KP_UP", beginAction,
"meta KP_DOWN", endAction,
"ctrl P", beginAction,
"ctrl N", endAction,
"ctrl V", endAction,
// move caret to line begin/end (without selecting text)
"meta KP_LEFT", beginLineAction,
"meta KP_RIGHT", endLineAction,
"ctrl A", beginLineAction,
"ctrl E", endLineAction,
// move caret to document begin/end (without selecting text)
"shift meta UP", selectionBeginAction,
"shift meta DOWN", selectionEndAction,
"shift meta KP_UP", selectionBeginAction,
"shift meta KP_DOWN", selectionEndAction,
"shift HOME", selectionBeginAction,
"shift END", selectionEndAction,
// move caret to line begin/end and select text
"shift meta KP_LEFT", selectionBeginLineAction,
"shift meta KP_RIGHT", selectionEndLineAction,
"shift UP", selectionBeginLineAction,
"shift DOWN", selectionEndLineAction,
"shift KP_UP", selectionBeginLineAction,
"shift KP_DOWN", selectionEndLineAction,
// move caret one page (without selecting text)
"PAGE_UP", pageUpAction,
"PAGE_DOWN", pageDownAction,
// move caret one page and select text
"shift PAGE_UP", "selection-page-up", // DefaultEditorKit.selectionPageUpAction
"shift PAGE_DOWN", "selection-page-down", // DefaultEditorKit.selectionPageDownAction
"shift meta PAGE_UP", "selection-page-left", // DefaultEditorKit.selectionPageLeftAction
"shift meta PAGE_DOWN", "selection-page-right", // DefaultEditorKit.selectionPageRightAction
// delete previous/next word
"ctrl W", deletePrevWordAction,
"ctrl D", deleteNextCharAction,
} : null;
Object[] singleLineTextComponentBindings = { Object[] singleLineTextComponentBindings = {
"ENTER", JTextField.notifyAction, "ENTER", JTextField.notifyAction,
}; };
Object[] macSingleLineTextComponentBindings = SystemInfo.IS_MAC ? new Object[] {
// move caret to line begin/end (without selecting text)
"UP", beginLineAction,
"DOWN", endLineAction,
"KP_UP", beginLineAction,
"KP_DOWN", endLineAction,
} : null;
Object[] formattedTextComponentBindings = { Object[] formattedTextComponentBindings = {
// reset // reset
"ESCAPE", "reset-field-edit", "ESCAPE", "reset-field-edit",
@@ -152,20 +218,20 @@ class FlatInputMaps
Object[] passwordTextComponentBindings = { Object[] passwordTextComponentBindings = {
// move caret to line begin/end (without selecting text) // move caret to line begin/end (without selecting text)
"ctrl LEFT", beginLineAction, mac( "ctrl LEFT", "alt LEFT" ), beginLineAction,
"ctrl RIGHT", endLineAction, mac( "ctrl RIGHT", "alt RIGHT" ), endLineAction,
"ctrl KP_LEFT", beginLineAction, mac( "ctrl KP_LEFT", "alt KP_LEFT" ), beginLineAction,
"ctrl KP_RIGHT", endLineAction, mac( "ctrl KP_RIGHT", "alt KP_RIGHT" ), endLineAction,
// move caret to line begin/end and select text // move caret to line begin/end and select text
"ctrl shift LEFT", selectionBeginLineAction, mac( "ctrl shift LEFT", "shift alt LEFT" ), selectionBeginLineAction,
"ctrl shift RIGHT", selectionEndLineAction, mac( "ctrl shift RIGHT", "shift alt RIGHT" ), selectionEndLineAction,
"ctrl shift KP_LEFT", selectionBeginLineAction, mac( "ctrl shift KP_LEFT", "shift alt KP_LEFT" ), selectionBeginLineAction,
"ctrl shift KP_RIGHT", selectionEndLineAction, mac( "ctrl shift KP_RIGHT", "shift alt KP_RIGHT" ), selectionEndLineAction,
// delete previous/next word // delete previous/next word
"ctrl BACK_SPACE", null, mac( "ctrl BACK_SPACE", "alt BACK_SPACE" ), null,
"ctrl DELETE", null, mac( "ctrl DELETE", "alt DELETE" ), null,
}; };
Object[] multiLineTextComponentBindings = { Object[] multiLineTextComponentBindings = {
@@ -188,92 +254,201 @@ class FlatInputMaps
// move caret one page and select text // move caret one page and select text
"shift PAGE_UP", "selection-page-up", // DefaultEditorKit.selectionPageUpAction "shift PAGE_UP", "selection-page-up", // DefaultEditorKit.selectionPageUpAction
"shift PAGE_DOWN", "selection-page-down", // DefaultEditorKit.selectionPageDownAction "shift PAGE_DOWN", "selection-page-down", // DefaultEditorKit.selectionPageDownAction
"ctrl shift PAGE_UP", "selection-page-left", // DefaultEditorKit.selectionPageLeftAction mac( "ctrl shift PAGE_UP", "shift meta PAGE_UP" ), "selection-page-left", // DefaultEditorKit.selectionPageLeftAction
"ctrl shift PAGE_DOWN", "selection-page-right", // DefaultEditorKit.selectionPageRightAction mac( "ctrl shift PAGE_DOWN", "shift meta PAGE_DOWN" ), "selection-page-right", // DefaultEditorKit.selectionPageRightAction
// move caret to document begin/end (without selecting text) // move caret to document begin/end (without selecting text)
"ctrl HOME", beginAction, mac( "ctrl HOME", "meta UP" ), beginAction,
"ctrl END", endAction, mac( "ctrl END", "meta DOWN" ), endAction,
// move caret to document begin/end and select text // move caret to document begin/end and select text
"ctrl shift HOME", selectionBeginAction, mac( "ctrl shift HOME", "shift meta UP" ), selectionBeginAction,
"ctrl shift END", selectionEndAction, mac( "ctrl shift END", "shift meta DOWN" ), selectionEndAction,
// misc // misc
"ENTER", insertBreakAction, "ENTER", insertBreakAction,
"TAB", insertTabAction, "TAB", insertTabAction,
// links // links
"ctrl T", "next-link-action", mac( "ctrl T", "meta T" ), "next-link-action",
"ctrl shift T", "previous-link-action", mac( "ctrl shift T", "shift meta T" ), "previous-link-action",
"ctrl SPACE", "activate-link-action", mac( "ctrl SPACE", "meta SPACE" ), "activate-link-action",
}; };
Object[] macMultiLineTextComponentBindings = SystemInfo.IS_MAC ? new Object[] {
// move caret one line (without selecting text)
"ctrl N", downAction,
"ctrl P", upAction,
// move caret to beginning/end of paragraph and select text
"shift alt UP", selectionBeginParagraphAction,
"shift alt DOWN", selectionEndParagraphAction,
"shift alt KP_UP", selectionBeginParagraphAction,
"shift alt KP_DOWN", selectionEndParagraphAction,
// move caret one page (without selecting text)
"ctrl V", pageDownAction,
} : null;
defaults.put( "TextField.focusInputMap", new LazyInputMapEx( defaults.put( "TextField.focusInputMap", new LazyInputMapEx(
commonTextComponentBindings, commonTextComponentBindings,
singleLineTextComponentBindings macCommonTextComponentBindings,
singleLineTextComponentBindings,
macSingleLineTextComponentBindings
) ); ) );
defaults.put( "FormattedTextField.focusInputMap", new LazyInputMapEx( defaults.put( "FormattedTextField.focusInputMap", new LazyInputMapEx(
commonTextComponentBindings, commonTextComponentBindings,
macCommonTextComponentBindings,
singleLineTextComponentBindings, singleLineTextComponentBindings,
macSingleLineTextComponentBindings,
formattedTextComponentBindings formattedTextComponentBindings
) ); ) );
defaults.put( "PasswordField.focusInputMap", new LazyInputMapEx( defaults.put( "PasswordField.focusInputMap", new LazyInputMapEx(
commonTextComponentBindings, commonTextComponentBindings,
macCommonTextComponentBindings,
singleLineTextComponentBindings, singleLineTextComponentBindings,
macSingleLineTextComponentBindings,
passwordTextComponentBindings passwordTextComponentBindings
) ); ) );
Object multiLineInputMap = new LazyInputMapEx( Object multiLineInputMap = new LazyInputMapEx(
commonTextComponentBindings, commonTextComponentBindings,
multiLineTextComponentBindings macCommonTextComponentBindings,
multiLineTextComponentBindings,
macMultiLineTextComponentBindings
); );
defaults.put( "TextArea.focusInputMap", multiLineInputMap ); defaults.put( "TextArea.focusInputMap", multiLineInputMap );
defaults.put( "TextPane.focusInputMap", multiLineInputMap ); defaults.put( "TextPane.focusInputMap", multiLineInputMap );
defaults.put( "EditorPane.focusInputMap", multiLineInputMap ); defaults.put( "EditorPane.focusInputMap", multiLineInputMap );
} }
private static void initMacInputMaps( UIDefaults defaults, UIDefaults baseDefaults ) { private static void initMacInputMaps( UIDefaults defaults ) {
// copy Aqua LaF input maps // list
copyInputMaps( baseDefaults, defaults, modifyInputMap( defaults, "List.focusInputMap",
"Button.focusInputMap", "meta A", "selectAll",
"EditorPane.focusInputMap", "meta C", "copy",
"FormattedTextField.focusInputMap", "meta V", "paste",
"List.focusInputMap", "meta X", "cut",
"PasswordField.focusInputMap",
"ScrollBar.focusInputMap.RightToLeft",
"ScrollBar.focusInputMap",
"ScrollPane.ancestorInputMap.RightToLeft",
"ScrollPane.ancestorInputMap",
"Table.ancestorInputMap.RightToLeft",
"Table.ancestorInputMap",
"TextArea.focusInputMap",
"TextField.focusInputMap",
"TextPane.focusInputMap",
"Tree.focusInputMap" );
"ctrl A", null,
"ctrl BACK_SLASH", null,
"ctrl C", null,
"ctrl DOWN", null,
"ctrl END", null,
"ctrl HOME", null,
"ctrl INSERT", null,
"ctrl KP_DOWN", null,
"ctrl KP_LEFT", null,
"ctrl KP_RIGHT", null,
"ctrl KP_UP", null,
"ctrl LEFT", null,
"ctrl PAGE_DOWN", null,
"ctrl PAGE_UP", null,
"ctrl RIGHT", null,
"ctrl SLASH", null,
"ctrl SPACE", null,
"ctrl UP", null,
"ctrl V", null,
"ctrl X", null,
"PAGE_DOWN", null,
"PAGE_UP", null,
"SPACE", null,
"shift ctrl DOWN", null,
"shift ctrl END", null,
"shift ctrl HOME", null,
"shift ctrl KP_DOWN", null,
"shift ctrl KP_LEFT", null,
"shift ctrl KP_RIGHT", null,
"shift ctrl KP_UP", null,
"shift ctrl LEFT", null,
"shift ctrl PAGE_DOWN", null,
"shift ctrl PAGE_UP", null,
"shift ctrl RIGHT", null,
"shift ctrl SPACE", null,
"shift ctrl UP", null,
"shift DELETE", null,
"shift INSERT", null,
"shift SPACE", null
);
// AquaLookAndFeel (the base for UI defaults on macOS) uses special // scrollbar
// action keys (e.g. "aquaExpandNode") for some macOS specific behaviour. copyInputMap( defaults, "ScrollBar.ancestorInputMap", "ScrollBar.focusInputMap" );
// Those action keys are not available in FlatLaf, which makes it copyInputMap( defaults, "ScrollBar.ancestorInputMap.RightToLeft", "ScrollBar.focusInputMap.RightToLeft" );
// necessary to make some modifications.
// combobox // scrollpane
defaults.put( "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap( new Object[] { modifyInputMap( defaults, "ScrollPane.ancestorInputMap",
"SPACE", "spacePopup", "END", "scrollEnd",
"ENTER", "enterPressed", "HOME", "scrollHome",
"ESCAPE", "hidePopup",
"HOME", "homePassThrough", "ctrl END", null,
"END", "endPassThrough", "ctrl HOME", null,
"PAGE_UP", "pageUpPassThrough", "ctrl PAGE_DOWN", null,
"PAGE_DOWN", "pageDownPassThrough", "ctrl PAGE_UP", null
);
modifyInputMap( defaults, "ScrollPane.ancestorInputMap.RightToLeft",
"ctrl PAGE_DOWN", null,
"ctrl PAGE_UP", null
);
"UP", "selectPrevious", // table
"DOWN", "selectNext", modifyInputMap( defaults, "Table.ancestorInputMap",
"KP_UP", "selectPrevious", "alt TAB", "focusHeader",
"KP_DOWN", "selectNext", "shift alt TAB", "focusHeader",
} ) ); "meta A", "selectAll",
"meta C", "copy",
"meta V", "paste",
"meta X", "cut",
"ctrl A", null,
"ctrl BACK_SLASH", null,
"ctrl C", null,
"ctrl DOWN", null,
"ctrl END", null,
"ctrl HOME", null,
"ctrl INSERT", null,
"ctrl KP_DOWN", null,
"ctrl KP_LEFT", null,
"ctrl KP_RIGHT", null,
"ctrl KP_UP", null,
"ctrl LEFT", null,
"ctrl PAGE_DOWN", null,
"ctrl PAGE_UP", null,
"ctrl RIGHT", null,
"ctrl SLASH", null,
"ctrl SPACE", null,
"ctrl UP", null,
"ctrl V", null,
"ctrl X", null,
"F2", null,
"F8", null,
"SPACE", null,
"shift ctrl DOWN", null,
"shift ctrl END", null,
"shift ctrl HOME", null,
"shift ctrl KP_DOWN", null,
"shift ctrl KP_LEFT", null,
"shift ctrl KP_RIGHT", null,
"shift ctrl KP_UP", null,
"shift ctrl LEFT", null,
"shift ctrl PAGE_DOWN", null,
"shift ctrl PAGE_UP", null,
"shift ctrl RIGHT", null,
"shift ctrl SPACE", null,
"shift ctrl UP", null,
"shift DELETE", null,
"shift INSERT", null,
"shift SPACE", null
);
modifyInputMap( defaults, "Table.ancestorInputMap.RightToLeft",
"ctrl KP_LEFT", null,
"ctrl KP_RIGHT", null,
"ctrl LEFT", null,
"ctrl RIGHT", null,
"shift ctrl KP_LEFT", null,
"shift ctrl KP_RIGHT", null,
"shift ctrl LEFT", null,
"shift ctrl RIGHT", null
);
// tree node expanding/collapsing // tree node expanding/collapsing
modifyInputMap( defaults, "Tree.focusInputMap", modifyInputMap( defaults, "Tree.focusInputMap",
@@ -282,6 +457,11 @@ class FlatInputMaps
"KP_LEFT", "selectParent", "KP_LEFT", "selectParent",
"KP_RIGHT", "selectChild", "KP_RIGHT", "selectChild",
"meta A", "selectAll",
"meta C", "copy",
"meta V", "paste",
"meta X", "cut",
"ctrl LEFT", null, "ctrl LEFT", null,
"ctrl RIGHT", null, "ctrl RIGHT", null,
"ctrl KP_LEFT", null, "ctrl KP_LEFT", null,
@@ -290,7 +470,51 @@ class FlatInputMaps
"shift LEFT", null, "shift LEFT", null,
"shift RIGHT", null, "shift RIGHT", null,
"shift KP_LEFT", null, "shift KP_LEFT", null,
"shift KP_RIGHT", null "shift KP_RIGHT", null,
"alt LEFT", null,
"alt RIGHT", null,
"alt KP_LEFT", null,
"alt KP_RIGHT", null,
"ctrl A", null,
"ctrl BACK_SLASH", null,
"ctrl C", null,
"ctrl DOWN", null,
"ctrl END", null,
"ctrl HOME", null,
"ctrl INSERT", null,
"ctrl KP_DOWN", null,
"ctrl KP_UP", null,
"ctrl PAGE_DOWN", null,
"ctrl PAGE_UP", null,
"ctrl SLASH", null,
"ctrl SPACE", null,
"ctrl UP", null,
"ctrl V", null,
"ctrl X", null,
"END", null,
"F2", null,
"HOME", null,
"PAGE_DOWN", null,
"PAGE_UP", null,
"SPACE", null,
"shift ctrl DOWN", null,
"shift ctrl END", null,
"shift ctrl HOME", null,
"shift ctrl KP_DOWN", null,
"shift ctrl KP_UP", null,
"shift ctrl PAGE_DOWN", null,
"shift ctrl PAGE_UP", null,
"shift ctrl SPACE", null,
"shift ctrl UP", null,
"shift DELETE", null,
"shift END", null,
"shift HOME", null,
"shift INSERT", null,
"shift PAGE_DOWN", null,
"shift PAGE_UP", null,
"shift SPACE", null
); );
defaults.put( "Tree.focusInputMap.RightToLeft", new UIDefaults.LazyInputMap( new Object[] { defaults.put( "Tree.focusInputMap.RightToLeft", new UIDefaults.LazyInputMap( new Object[] {
"LEFT", "selectChild", "LEFT", "selectChild",
@@ -300,10 +524,11 @@ class FlatInputMaps
} ) ); } ) );
} }
private static void copyInputMaps( UIDefaults src, UIDefaults dest, String... keys ) { private static void copyInputMap( UIDefaults defaults, String srcKey, String destKey ) {
// Note: not using `src.get(key)` here because this would resolve the lazy value // Note: not using `defaults.get(key)` here because this would resolve the lazy value
for( String key : keys ) Object inputMap = defaults.remove( srcKey );
dest.put( key, src.remove( key ) ); defaults.put( srcKey, inputMap );
defaults.put( destKey, inputMap );
} }
private static void modifyInputMap( UIDefaults defaults, String key, Object... bindings ) { private static void modifyInputMap( UIDefaults defaults, String key, Object... bindings ) {
@@ -311,6 +536,10 @@ class FlatInputMaps
defaults.put( key, new LazyModifyInputMap( defaults.remove( key ), bindings ) ); defaults.put( key, new LazyModifyInputMap( defaults.remove( key ), bindings ) );
} }
private static <T> T mac( T value, T macValue ) {
return SystemInfo.IS_MAC ? macValue : value;
}
//---- class LazyInputMapEx ----------------------------------------------- //---- class LazyInputMapEx -----------------------------------------------
/** /**

View File

@@ -226,8 +226,6 @@ public abstract class FlatLaf
@Override @Override
public UIDefaults getDefaults() { public UIDefaults getDefaults() {
createAquaLaf();
UIDefaults defaults = super.getDefaults(); UIDefaults defaults = super.getDefaults();
// add Metal resource bundle, which is required for FlatFileChooserUI // add Metal resource bundle, which is required for FlatFileChooserUI
@@ -261,7 +259,7 @@ public abstract class FlatLaf
initFonts( defaults ); initFonts( defaults );
initIconColors( defaults, isDark() ); initIconColors( defaults, isDark() );
FlatInputMaps.initInputMaps( defaults, (aquaLaf != null) ? aquaLaf.getDefaults() : null ); FlatInputMaps.initInputMaps( defaults );
// load defaults from properties // load defaults from properties
List<Class<?>> lafClassesForDefaultsLoading = getLafClassesForDefaultsLoading(); List<Class<?>> lafClassesForDefaultsLoading = getLafClassesForDefaultsLoading();

View File

@@ -71,7 +71,7 @@ Desktop.ancestorInputMap [lazy] 29 javax.swing.plaf.InputMapUIResource
#---- EditorPane ---- #---- EditorPane ----
EditorPane.focusInputMap [lazy] 82 javax.swing.plaf.InputMapUIResource [UI] EditorPane.focusInputMap [lazy] 83 javax.swing.plaf.InputMapUIResource [UI]
alt BACK_SPACE delete-previous-word alt BACK_SPACE delete-previous-word
alt DELETE delete-next-word alt DELETE delete-next-word
alt KP_LEFT caret-previous-word alt KP_LEFT caret-previous-word
@@ -86,7 +86,7 @@ EditorPane.focusInputMap [lazy] 82 javax.swing.plaf.InputMapUIResource
ctrl H delete-previous ctrl H delete-previous
ctrl N caret-down ctrl N caret-down
ctrl P caret-up ctrl P caret-up
ctrl V aqua-page-down ctrl V page-down
ctrl W delete-previous-word ctrl W delete-previous-word
meta A select-all meta A select-all
meta BACK_SLASH unselect meta BACK_SLASH unselect
@@ -107,21 +107,21 @@ EditorPane.focusInputMap [lazy] 82 javax.swing.plaf.InputMapUIResource
COPY copy-to-clipboard COPY copy-to-clipboard
CUT cut-to-clipboard CUT cut-to-clipboard
DELETE delete-next DELETE delete-next
DOWN aqua-move-down DOWN caret-down
END caret-end END caret-end
ENTER insert-break ENTER insert-break
HOME caret-begin HOME caret-begin
KP_DOWN aqua-move-down KP_DOWN caret-down
KP_LEFT caret-backward KP_LEFT caret-backward
KP_RIGHT caret-forward KP_RIGHT caret-forward
KP_UP aqua-move-up KP_UP caret-up
LEFT caret-backward LEFT caret-backward
PAGE_DOWN aqua-page-down PAGE_DOWN page-down
PAGE_UP aqua-page-up PAGE_UP page-up
PASTE paste-from-clipboard PASTE paste-from-clipboard
RIGHT caret-forward RIGHT caret-forward
TAB insert-tab TAB insert-tab
UP aqua-move-up UP caret-up
shift alt DOWN selection-end-paragraph shift alt DOWN selection-end-paragraph
shift alt KP_DOWN selection-end-paragraph shift alt KP_DOWN selection-end-paragraph
shift alt KP_LEFT selection-previous-word shift alt KP_LEFT selection-previous-word
@@ -142,6 +142,7 @@ EditorPane.focusInputMap [lazy] 82 javax.swing.plaf.InputMapUIResource
shift meta RIGHT selection-end-line shift meta RIGHT selection-end-line
shift meta T previous-link-action shift meta T previous-link-action
shift meta UP selection-begin shift meta UP selection-begin
shift BACK_SPACE delete-previous
shift DOWN selection-down shift DOWN selection-down
shift END selection-end shift END selection-end
shift HOME selection-begin shift HOME selection-begin
@@ -165,7 +166,7 @@ FileChooser.ancestorInputMap [lazy] 2 javax.swing.plaf.InputMapUIResource [
#---- FormattedTextField ---- #---- FormattedTextField ----
FormattedTextField.focusInputMap [lazy] 75 javax.swing.plaf.InputMapUIResource [UI] FormattedTextField.focusInputMap [lazy] 76 javax.swing.plaf.InputMapUIResource [UI]
alt BACK_SPACE delete-previous-word alt BACK_SPACE delete-previous-word
alt DELETE delete-next-word alt DELETE delete-next-word
alt KP_LEFT caret-previous-word alt KP_LEFT caret-previous-word
@@ -209,8 +210,8 @@ FormattedTextField.focusInputMap [lazy] 75 javax.swing.plaf.InputMapUIResourc
KP_RIGHT caret-forward KP_RIGHT caret-forward
KP_UP increment KP_UP increment
LEFT caret-backward LEFT caret-backward
PAGE_DOWN aqua-page-down PAGE_DOWN page-down
PAGE_UP aqua-page-up PAGE_UP page-up
PASTE paste-from-clipboard PASTE paste-from-clipboard
RIGHT caret-forward RIGHT caret-forward
UP increment UP increment
@@ -229,6 +230,7 @@ FormattedTextField.focusInputMap [lazy] 75 javax.swing.plaf.InputMapUIResourc
shift meta PAGE_UP selection-page-left shift meta PAGE_UP selection-page-left
shift meta RIGHT selection-end-line shift meta RIGHT selection-end-line
shift meta UP selection-begin shift meta UP selection-begin
shift BACK_SPACE delete-previous
shift DOWN selection-end-line shift DOWN selection-end-line
shift END selection-end shift END selection-end
shift HOME selection-begin shift HOME selection-begin
@@ -270,8 +272,8 @@ List.focusInputMap [lazy] 29 javax.swing.plaf.InputMapUIResource
COPY copy COPY copy
CUT cut CUT cut
DOWN selectNextRow DOWN selectNextRow
END aquaEnd END selectLastRow
HOME aquaHome HOME selectFirstRow
KP_DOWN selectNextRow KP_DOWN selectNextRow
KP_LEFT selectPreviousColumn KP_LEFT selectPreviousColumn
KP_RIGHT selectNextColumn KP_RIGHT selectNextColumn
@@ -296,9 +298,11 @@ List.focusInputMap [lazy] 29 javax.swing.plaf.InputMapUIResource
#---- PasswordField ---- #---- PasswordField ----
PasswordField.focusInputMap [lazy] 66 javax.swing.plaf.InputMapUIResource [UI] PasswordField.focusInputMap [lazy] 73 javax.swing.plaf.InputMapUIResource [UI]
alt BACK_SPACE delete-previous-word alt KP_LEFT caret-begin-line
alt DELETE delete-next-word alt KP_RIGHT caret-end-line
alt LEFT caret-begin-line
alt RIGHT caret-end-line
ctrl A caret-begin-line ctrl A caret-begin-line
ctrl B caret-backward ctrl B caret-backward
ctrl D delete-next ctrl D delete-next
@@ -335,11 +339,15 @@ PasswordField.focusInputMap [lazy] 66 javax.swing.plaf.InputMapUIResource
KP_RIGHT caret-forward KP_RIGHT caret-forward
KP_UP caret-begin-line KP_UP caret-begin-line
LEFT caret-backward LEFT caret-backward
PAGE_DOWN aqua-page-down PAGE_DOWN page-down
PAGE_UP aqua-page-up PAGE_UP page-up
PASTE paste-from-clipboard PASTE paste-from-clipboard
RIGHT caret-forward RIGHT caret-forward
UP caret-begin-line UP caret-begin-line
shift alt KP_LEFT selection-begin-line
shift alt KP_RIGHT selection-end-line
shift alt LEFT selection-begin-line
shift alt RIGHT selection-end-line
shift ctrl O toggle-componentOrientation shift ctrl O toggle-componentOrientation
shift meta DOWN selection-end shift meta DOWN selection-end
shift meta KP_DOWN selection-end shift meta KP_DOWN selection-end
@@ -351,6 +359,7 @@ PasswordField.focusInputMap [lazy] 66 javax.swing.plaf.InputMapUIResource
shift meta PAGE_UP selection-page-left shift meta PAGE_UP selection-page-left
shift meta RIGHT selection-end-line shift meta RIGHT selection-end-line
shift meta UP selection-begin shift meta UP selection-begin
shift BACK_SPACE delete-previous
shift DOWN selection-end-line shift DOWN selection-end-line
shift END selection-end shift END selection-end
shift HOME selection-begin shift HOME selection-begin
@@ -622,7 +631,7 @@ TableHeader.ancestorInputMap [lazy] 14 javax.swing.plaf.InputMapUIResource
#---- TextArea ---- #---- TextArea ----
TextArea.focusInputMap [lazy] 82 javax.swing.plaf.InputMapUIResource [UI] TextArea.focusInputMap [lazy] 83 javax.swing.plaf.InputMapUIResource [UI]
alt BACK_SPACE delete-previous-word alt BACK_SPACE delete-previous-word
alt DELETE delete-next-word alt DELETE delete-next-word
alt KP_LEFT caret-previous-word alt KP_LEFT caret-previous-word
@@ -637,7 +646,7 @@ TextArea.focusInputMap [lazy] 82 javax.swing.plaf.InputMapUIResource
ctrl H delete-previous ctrl H delete-previous
ctrl N caret-down ctrl N caret-down
ctrl P caret-up ctrl P caret-up
ctrl V aqua-page-down ctrl V page-down
ctrl W delete-previous-word ctrl W delete-previous-word
meta A select-all meta A select-all
meta BACK_SLASH unselect meta BACK_SLASH unselect
@@ -658,21 +667,21 @@ TextArea.focusInputMap [lazy] 82 javax.swing.plaf.InputMapUIResource
COPY copy-to-clipboard COPY copy-to-clipboard
CUT cut-to-clipboard CUT cut-to-clipboard
DELETE delete-next DELETE delete-next
DOWN aqua-move-down DOWN caret-down
END caret-end END caret-end
ENTER insert-break ENTER insert-break
HOME caret-begin HOME caret-begin
KP_DOWN aqua-move-down KP_DOWN caret-down
KP_LEFT caret-backward KP_LEFT caret-backward
KP_RIGHT caret-forward KP_RIGHT caret-forward
KP_UP aqua-move-up KP_UP caret-up
LEFT caret-backward LEFT caret-backward
PAGE_DOWN aqua-page-down PAGE_DOWN page-down
PAGE_UP aqua-page-up PAGE_UP page-up
PASTE paste-from-clipboard PASTE paste-from-clipboard
RIGHT caret-forward RIGHT caret-forward
TAB insert-tab TAB insert-tab
UP aqua-move-up UP caret-up
shift alt DOWN selection-end-paragraph shift alt DOWN selection-end-paragraph
shift alt KP_DOWN selection-end-paragraph shift alt KP_DOWN selection-end-paragraph
shift alt KP_LEFT selection-previous-word shift alt KP_LEFT selection-previous-word
@@ -693,6 +702,7 @@ TextArea.focusInputMap [lazy] 82 javax.swing.plaf.InputMapUIResource
shift meta RIGHT selection-end-line shift meta RIGHT selection-end-line
shift meta T previous-link-action shift meta T previous-link-action
shift meta UP selection-begin shift meta UP selection-begin
shift BACK_SPACE delete-previous
shift DOWN selection-down shift DOWN selection-down
shift END selection-end shift END selection-end
shift HOME selection-begin shift HOME selection-begin
@@ -709,7 +719,7 @@ TextArea.focusInputMap [lazy] 82 javax.swing.plaf.InputMapUIResource
#---- TextField ---- #---- TextField ----
TextField.focusInputMap [lazy] 74 javax.swing.plaf.InputMapUIResource [UI] TextField.focusInputMap [lazy] 75 javax.swing.plaf.InputMapUIResource [UI]
alt BACK_SPACE delete-previous-word alt BACK_SPACE delete-previous-word
alt DELETE delete-next-word alt DELETE delete-next-word
alt KP_LEFT caret-previous-word alt KP_LEFT caret-previous-word
@@ -752,8 +762,8 @@ TextField.focusInputMap [lazy] 74 javax.swing.plaf.InputMapUIResource
KP_RIGHT caret-forward KP_RIGHT caret-forward
KP_UP caret-begin-line KP_UP caret-begin-line
LEFT caret-backward LEFT caret-backward
PAGE_DOWN aqua-page-down PAGE_DOWN page-down
PAGE_UP aqua-page-up PAGE_UP page-up
PASTE paste-from-clipboard PASTE paste-from-clipboard
RIGHT caret-forward RIGHT caret-forward
UP caret-begin-line UP caret-begin-line
@@ -772,6 +782,7 @@ TextField.focusInputMap [lazy] 74 javax.swing.plaf.InputMapUIResource
shift meta PAGE_UP selection-page-left shift meta PAGE_UP selection-page-left
shift meta RIGHT selection-end-line shift meta RIGHT selection-end-line
shift meta UP selection-begin shift meta UP selection-begin
shift BACK_SPACE delete-previous
shift DOWN selection-end-line shift DOWN selection-end-line
shift END selection-end shift END selection-end
shift HOME selection-begin shift HOME selection-begin
@@ -788,7 +799,7 @@ TextField.focusInputMap [lazy] 74 javax.swing.plaf.InputMapUIResource
#---- TextPane ---- #---- TextPane ----
TextPane.focusInputMap [lazy] 82 javax.swing.plaf.InputMapUIResource [UI] TextPane.focusInputMap [lazy] 83 javax.swing.plaf.InputMapUIResource [UI]
alt BACK_SPACE delete-previous-word alt BACK_SPACE delete-previous-word
alt DELETE delete-next-word alt DELETE delete-next-word
alt KP_LEFT caret-previous-word alt KP_LEFT caret-previous-word
@@ -803,7 +814,7 @@ TextPane.focusInputMap [lazy] 82 javax.swing.plaf.InputMapUIResource
ctrl H delete-previous ctrl H delete-previous
ctrl N caret-down ctrl N caret-down
ctrl P caret-up ctrl P caret-up
ctrl V aqua-page-down ctrl V page-down
ctrl W delete-previous-word ctrl W delete-previous-word
meta A select-all meta A select-all
meta BACK_SLASH unselect meta BACK_SLASH unselect
@@ -824,21 +835,21 @@ TextPane.focusInputMap [lazy] 82 javax.swing.plaf.InputMapUIResource
COPY copy-to-clipboard COPY copy-to-clipboard
CUT cut-to-clipboard CUT cut-to-clipboard
DELETE delete-next DELETE delete-next
DOWN aqua-move-down DOWN caret-down
END caret-end END caret-end
ENTER insert-break ENTER insert-break
HOME caret-begin HOME caret-begin
KP_DOWN aqua-move-down KP_DOWN caret-down
KP_LEFT caret-backward KP_LEFT caret-backward
KP_RIGHT caret-forward KP_RIGHT caret-forward
KP_UP aqua-move-up KP_UP caret-up
LEFT caret-backward LEFT caret-backward
PAGE_DOWN aqua-page-down PAGE_DOWN page-down
PAGE_UP aqua-page-up PAGE_UP page-up
PASTE paste-from-clipboard PASTE paste-from-clipboard
RIGHT caret-forward RIGHT caret-forward
TAB insert-tab TAB insert-tab
UP aqua-move-up UP caret-up
shift alt DOWN selection-end-paragraph shift alt DOWN selection-end-paragraph
shift alt KP_DOWN selection-end-paragraph shift alt KP_DOWN selection-end-paragraph
shift alt KP_LEFT selection-previous-word shift alt KP_LEFT selection-previous-word
@@ -859,6 +870,7 @@ TextPane.focusInputMap [lazy] 82 javax.swing.plaf.InputMapUIResource
shift meta RIGHT selection-end-line shift meta RIGHT selection-end-line
shift meta T previous-link-action shift meta T previous-link-action
shift meta UP selection-begin shift meta UP selection-begin
shift BACK_SPACE delete-previous
shift DOWN selection-down shift DOWN selection-down
shift END selection-end shift END selection-end
shift HOME selection-begin shift HOME selection-begin
@@ -902,11 +914,7 @@ Tree.focusInputMap.RightToLeft [lazy] 4 javax.swing.plaf.InputMapUIResource [
KP_RIGHT selectParent KP_RIGHT selectParent
LEFT selectChild LEFT selectChild
RIGHT selectParent RIGHT selectParent
Tree.focusInputMap [lazy] 23 javax.swing.plaf.InputMapUIResource [UI] Tree.focusInputMap [lazy] 19 javax.swing.plaf.InputMapUIResource [UI]
alt KP_LEFT aquaFullyCollapseNode
alt KP_RIGHT aquaFullyExpandNode
alt LEFT aquaFullyCollapseNode
alt RIGHT aquaFullyExpandNode
meta A selectAll meta A selectAll
meta C copy meta C copy
meta V paste meta V paste