mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
FlatInputMaps: use static import for DefaultEditorKit and changed order of keys
(nothing else changed)
This commit is contained in:
@@ -23,8 +23,8 @@ import javax.swing.LookAndFeel;
|
|||||||
import javax.swing.UIDefaults;
|
import javax.swing.UIDefaults;
|
||||||
import javax.swing.UIDefaults.LazyValue;
|
import javax.swing.UIDefaults.LazyValue;
|
||||||
import javax.swing.plaf.InputMapUIResource;
|
import javax.swing.plaf.InputMapUIResource;
|
||||||
import javax.swing.text.DefaultEditorKit;
|
|
||||||
import com.formdev.flatlaf.util.SystemInfo;
|
import com.formdev.flatlaf.util.SystemInfo;
|
||||||
|
import static javax.swing.text.DefaultEditorKit.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Karl Tauber
|
* @author Karl Tauber
|
||||||
@@ -45,17 +45,17 @@ class FlatInputMaps
|
|||||||
} ) );
|
} ) );
|
||||||
|
|
||||||
modifyInputMap( defaults, "ComboBox.ancestorInputMap",
|
modifyInputMap( defaults, "ComboBox.ancestorInputMap",
|
||||||
|
"SPACE", "spacePopup",
|
||||||
|
|
||||||
"UP", "selectPrevious",
|
"UP", "selectPrevious",
|
||||||
"KP_UP", "selectPrevious",
|
|
||||||
"DOWN", "selectNext",
|
"DOWN", "selectNext",
|
||||||
|
"KP_UP", "selectPrevious",
|
||||||
"KP_DOWN", "selectNext",
|
"KP_DOWN", "selectNext",
|
||||||
|
|
||||||
"alt UP", "togglePopup",
|
"alt UP", "togglePopup",
|
||||||
"alt KP_UP", "togglePopup",
|
|
||||||
"alt DOWN", "togglePopup",
|
"alt DOWN", "togglePopup",
|
||||||
"alt KP_DOWN", "togglePopup",
|
"alt KP_UP", "togglePopup",
|
||||||
|
"alt KP_DOWN", "togglePopup"
|
||||||
"SPACE", "spacePopup"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
modifyInputMap( defaults, "FileChooser.ancestorInputMap",
|
modifyInputMap( defaults, "FileChooser.ancestorInputMap",
|
||||||
@@ -75,61 +75,61 @@ class FlatInputMaps
|
|||||||
|
|
||||||
Object[] commonTextComponentBindings = {
|
Object[] commonTextComponentBindings = {
|
||||||
// move caret one character (without selecting text)
|
// move caret one character (without selecting text)
|
||||||
"LEFT", DefaultEditorKit.backwardAction,
|
"LEFT", backwardAction,
|
||||||
"KP_LEFT", DefaultEditorKit.backwardAction,
|
"RIGHT", forwardAction,
|
||||||
"RIGHT", DefaultEditorKit.forwardAction,
|
"KP_LEFT", backwardAction,
|
||||||
"KP_RIGHT", DefaultEditorKit.forwardAction,
|
"KP_RIGHT", forwardAction,
|
||||||
|
|
||||||
// move caret one character and select text
|
// move caret one character and select text
|
||||||
"shift LEFT", DefaultEditorKit.selectionBackwardAction,
|
"shift LEFT", selectionBackwardAction,
|
||||||
"shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
|
"shift RIGHT", selectionForwardAction,
|
||||||
"shift RIGHT", DefaultEditorKit.selectionForwardAction,
|
"shift KP_LEFT", selectionBackwardAction,
|
||||||
"shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
|
"shift KP_RIGHT", selectionForwardAction,
|
||||||
|
|
||||||
// move caret to word (without selecting text)
|
// move caret to word (without selecting text)
|
||||||
"ctrl LEFT", DefaultEditorKit.previousWordAction,
|
"ctrl LEFT", previousWordAction,
|
||||||
"ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
|
"ctrl RIGHT", nextWordAction,
|
||||||
"ctrl RIGHT", DefaultEditorKit.nextWordAction,
|
"ctrl KP_LEFT", previousWordAction,
|
||||||
"ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
|
"ctrl KP_RIGHT", nextWordAction,
|
||||||
|
|
||||||
// move caret to word and select text
|
// move caret to word and select text
|
||||||
"ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
|
"ctrl shift LEFT", selectionPreviousWordAction,
|
||||||
"ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
|
"ctrl shift RIGHT", selectionNextWordAction,
|
||||||
"ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
|
"ctrl shift KP_LEFT", selectionPreviousWordAction,
|
||||||
"ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
|
"ctrl shift KP_RIGHT", selectionNextWordAction,
|
||||||
|
|
||||||
// move caret to line begin/end (without selecting text)
|
// move caret to line begin/end (without selecting text)
|
||||||
"HOME", DefaultEditorKit.beginLineAction,
|
"HOME", beginLineAction,
|
||||||
"END", DefaultEditorKit.endLineAction,
|
"END", endLineAction,
|
||||||
|
|
||||||
// move caret to line begin/end and select text
|
// move caret to line begin/end and select text
|
||||||
"shift HOME", DefaultEditorKit.selectionBeginLineAction,
|
"shift HOME", selectionBeginLineAction,
|
||||||
"shift END", DefaultEditorKit.selectionEndLineAction,
|
"shift END", selectionEndLineAction,
|
||||||
|
|
||||||
// select all/none
|
// select all/none
|
||||||
"ctrl A", DefaultEditorKit.selectAllAction,
|
"ctrl A", selectAllAction,
|
||||||
"ctrl BACK_SLASH", "unselect", // DefaultEditorKit.unselectAction
|
"ctrl BACK_SLASH", "unselect", // DefaultEditorKit.unselectAction
|
||||||
|
|
||||||
// delete previous/next character
|
// delete previous/next character
|
||||||
"BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
|
"BACK_SPACE", deletePrevCharAction,
|
||||||
"shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
|
"shift BACK_SPACE", deletePrevCharAction,
|
||||||
"ctrl H", DefaultEditorKit.deletePrevCharAction,
|
"ctrl H", deletePrevCharAction,
|
||||||
"DELETE", DefaultEditorKit.deleteNextCharAction,
|
"DELETE", deleteNextCharAction,
|
||||||
|
|
||||||
// delete previous/next word
|
// delete previous/next word
|
||||||
"ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction,
|
"ctrl BACK_SPACE", deletePrevWordAction,
|
||||||
"ctrl DELETE", DefaultEditorKit.deleteNextWordAction,
|
"ctrl DELETE", deleteNextWordAction,
|
||||||
|
|
||||||
// clipboard
|
// clipboard
|
||||||
"ctrl X", DefaultEditorKit.cutAction,
|
"ctrl X", cutAction,
|
||||||
"ctrl C", DefaultEditorKit.copyAction,
|
"ctrl C", copyAction,
|
||||||
"ctrl V", DefaultEditorKit.pasteAction,
|
"ctrl V", pasteAction,
|
||||||
"CUT", DefaultEditorKit.cutAction,
|
"CUT", cutAction,
|
||||||
"COPY", DefaultEditorKit.copyAction,
|
"COPY", copyAction,
|
||||||
"PASTE", DefaultEditorKit.pasteAction,
|
"PASTE", pasteAction,
|
||||||
"shift DELETE", DefaultEditorKit.cutAction,
|
"shift DELETE", cutAction,
|
||||||
"control INSERT", DefaultEditorKit.copyAction,
|
"control INSERT", copyAction,
|
||||||
"shift INSERT", DefaultEditorKit.pasteAction,
|
"shift INSERT", pasteAction,
|
||||||
|
|
||||||
// misc
|
// misc
|
||||||
"control shift O", "toggle-componentOrientation", // DefaultEditorKit.toggleComponentOrientation
|
"control shift O", "toggle-componentOrientation", // DefaultEditorKit.toggleComponentOrientation
|
||||||
@@ -145,23 +145,23 @@ class FlatInputMaps
|
|||||||
|
|
||||||
// increment/decrement
|
// increment/decrement
|
||||||
"UP", "increment",
|
"UP", "increment",
|
||||||
"KP_UP", "increment",
|
|
||||||
"DOWN", "decrement",
|
"DOWN", "decrement",
|
||||||
|
"KP_UP", "increment",
|
||||||
"KP_DOWN", "decrement",
|
"KP_DOWN", "decrement",
|
||||||
};
|
};
|
||||||
|
|
||||||
Object[] passwordTextComponentBindings = {
|
Object[] passwordTextComponentBindings = {
|
||||||
// move caret to line begin/end (without selecting text)
|
// move caret to line begin/end (without selecting text)
|
||||||
"ctrl LEFT", DefaultEditorKit.beginLineAction,
|
"ctrl LEFT", beginLineAction,
|
||||||
"ctrl KP_LEFT", DefaultEditorKit.beginLineAction,
|
"ctrl RIGHT", endLineAction,
|
||||||
"ctrl RIGHT", DefaultEditorKit.endLineAction,
|
"ctrl KP_LEFT", beginLineAction,
|
||||||
"ctrl KP_RIGHT", DefaultEditorKit.endLineAction,
|
"ctrl KP_RIGHT", endLineAction,
|
||||||
|
|
||||||
// move caret to line begin/end and select text
|
// move caret to line begin/end and select text
|
||||||
"ctrl shift LEFT", DefaultEditorKit.selectionBeginLineAction,
|
"ctrl shift LEFT", selectionBeginLineAction,
|
||||||
"ctrl shift KP_LEFT", DefaultEditorKit.selectionBeginLineAction,
|
"ctrl shift RIGHT", selectionEndLineAction,
|
||||||
"ctrl shift RIGHT", DefaultEditorKit.selectionEndLineAction,
|
"ctrl shift KP_LEFT", selectionBeginLineAction,
|
||||||
"ctrl shift KP_RIGHT", DefaultEditorKit.selectionEndLineAction,
|
"ctrl shift KP_RIGHT", selectionEndLineAction,
|
||||||
|
|
||||||
// delete previous/next word
|
// delete previous/next word
|
||||||
"ctrl BACK_SPACE", null,
|
"ctrl BACK_SPACE", null,
|
||||||
@@ -170,38 +170,38 @@ class FlatInputMaps
|
|||||||
|
|
||||||
Object[] multiLineTextComponentBindings = {
|
Object[] multiLineTextComponentBindings = {
|
||||||
// move caret one line (without selecting text)
|
// move caret one line (without selecting text)
|
||||||
"UP", DefaultEditorKit.upAction,
|
"UP", upAction,
|
||||||
"KP_UP", DefaultEditorKit.upAction,
|
"DOWN", downAction,
|
||||||
"DOWN", DefaultEditorKit.downAction,
|
"KP_UP", upAction,
|
||||||
"KP_DOWN", DefaultEditorKit.downAction,
|
"KP_DOWN", downAction,
|
||||||
|
|
||||||
// move caret one line and select text
|
// move caret one line and select text
|
||||||
"shift UP", DefaultEditorKit.selectionUpAction,
|
"shift UP", selectionUpAction,
|
||||||
"shift KP_UP", DefaultEditorKit.selectionUpAction,
|
"shift DOWN", selectionDownAction,
|
||||||
"shift DOWN", DefaultEditorKit.selectionDownAction,
|
"shift KP_UP", selectionUpAction,
|
||||||
"shift KP_DOWN", DefaultEditorKit.selectionDownAction,
|
"shift KP_DOWN", selectionDownAction,
|
||||||
|
|
||||||
// move caret one page (without selecting text)
|
// move caret one page (without selecting text)
|
||||||
"PAGE_UP", DefaultEditorKit.pageUpAction,
|
"PAGE_UP", pageUpAction,
|
||||||
"PAGE_DOWN", DefaultEditorKit.pageDownAction,
|
"PAGE_DOWN", pageDownAction,
|
||||||
|
|
||||||
// move caret one page and select text
|
// move caret one page and select text
|
||||||
"shift PAGE_UP", "selection-page-up",
|
"shift PAGE_UP", "selection-page-up", // DefaultEditorKit.selectionPageUpAction
|
||||||
"shift PAGE_DOWN", "selection-page-down",
|
"shift PAGE_DOWN", "selection-page-down", // DefaultEditorKit.selectionPageDownAction
|
||||||
"ctrl shift PAGE_UP", "selection-page-left",
|
"ctrl shift PAGE_UP", "selection-page-left", // DefaultEditorKit.selectionPageLeftAction
|
||||||
"ctrl shift PAGE_DOWN", "selection-page-right",
|
"ctrl shift 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", DefaultEditorKit.beginAction,
|
"ctrl HOME", beginAction,
|
||||||
"ctrl END", DefaultEditorKit.endAction,
|
"ctrl END", endAction,
|
||||||
|
|
||||||
// move caret to document begin/end and select text
|
// move caret to document begin/end and select text
|
||||||
"ctrl shift HOME", DefaultEditorKit.selectionBeginAction,
|
"ctrl shift HOME", selectionBeginAction,
|
||||||
"ctrl shift END", DefaultEditorKit.selectionEndAction,
|
"ctrl shift END", selectionEndAction,
|
||||||
|
|
||||||
// misc
|
// misc
|
||||||
"ENTER", DefaultEditorKit.insertBreakAction,
|
"ENTER", insertBreakAction,
|
||||||
"TAB", DefaultEditorKit.insertTabAction,
|
"TAB", insertTabAction,
|
||||||
|
|
||||||
// links
|
// links
|
||||||
"ctrl T", "next-link-action",
|
"ctrl T", "next-link-action",
|
||||||
@@ -260,39 +260,43 @@ class FlatInputMaps
|
|||||||
|
|
||||||
// combobox
|
// combobox
|
||||||
defaults.put( "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap( new Object[] {
|
defaults.put( "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap( new Object[] {
|
||||||
"ESCAPE", "hidePopup",
|
|
||||||
"PAGE_UP", "pageUpPassThrough",
|
|
||||||
"PAGE_DOWN", "pageDownPassThrough",
|
|
||||||
"HOME", "homePassThrough",
|
|
||||||
"END", "endPassThrough",
|
|
||||||
"DOWN", "selectNext",
|
|
||||||
"KP_DOWN", "selectNext",
|
|
||||||
"SPACE", "spacePopup",
|
"SPACE", "spacePopup",
|
||||||
"ENTER", "enterPressed",
|
"ENTER", "enterPressed",
|
||||||
|
"ESCAPE", "hidePopup",
|
||||||
|
|
||||||
|
"HOME", "homePassThrough",
|
||||||
|
"END", "endPassThrough",
|
||||||
|
"PAGE_UP", "pageUpPassThrough",
|
||||||
|
"PAGE_DOWN", "pageDownPassThrough",
|
||||||
|
|
||||||
"UP", "selectPrevious",
|
"UP", "selectPrevious",
|
||||||
"KP_UP", "selectPrevious"
|
"DOWN", "selectNext",
|
||||||
|
"KP_UP", "selectPrevious",
|
||||||
|
"KP_DOWN", "selectNext",
|
||||||
} ) );
|
} ) );
|
||||||
|
|
||||||
// tree node expanding/collapsing
|
// tree node expanding/collapsing
|
||||||
modifyInputMap( defaults, "Tree.focusInputMap",
|
modifyInputMap( defaults, "Tree.focusInputMap",
|
||||||
"RIGHT", "selectChild",
|
|
||||||
"KP_RIGHT", "selectChild",
|
|
||||||
"LEFT", "selectParent",
|
"LEFT", "selectParent",
|
||||||
|
"RIGHT", "selectChild",
|
||||||
"KP_LEFT", "selectParent",
|
"KP_LEFT", "selectParent",
|
||||||
"shift RIGHT", null,
|
"KP_RIGHT", "selectChild",
|
||||||
"shift KP_RIGHT", null,
|
|
||||||
"shift LEFT", null,
|
|
||||||
"shift KP_LEFT", null,
|
|
||||||
"ctrl LEFT", null,
|
"ctrl LEFT", null,
|
||||||
"ctrl KP_LEFT", null,
|
|
||||||
"ctrl RIGHT", null,
|
"ctrl RIGHT", null,
|
||||||
"ctrl KP_RIGHT", null
|
"ctrl KP_LEFT", null,
|
||||||
|
"ctrl KP_RIGHT", null,
|
||||||
|
|
||||||
|
"shift LEFT", null,
|
||||||
|
"shift RIGHT", null,
|
||||||
|
"shift KP_LEFT", null,
|
||||||
|
"shift KP_RIGHT", null
|
||||||
);
|
);
|
||||||
defaults.put( "Tree.focusInputMap.RightToLeft", new UIDefaults.LazyInputMap( new Object[] {
|
defaults.put( "Tree.focusInputMap.RightToLeft", new UIDefaults.LazyInputMap( new Object[] {
|
||||||
"RIGHT", "selectParent",
|
|
||||||
"KP_RIGHT", "selectParent",
|
|
||||||
"LEFT", "selectChild",
|
"LEFT", "selectChild",
|
||||||
"KP_LEFT", "selectChild"
|
"RIGHT", "selectParent",
|
||||||
|
"KP_LEFT", "selectChild",
|
||||||
|
"KP_RIGHT", "selectParent"
|
||||||
} ) );
|
} ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user