|
|
@ -83,8 +83,7 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void installDefaults() { |
|
|
|
protected void installDefaults() { |
|
|
|
super.installDefaults(); |
|
|
|
super.installDefaults(); |
|
|
|
editor.putClientProperty(KEY_ROUNDED_SELECTION, |
|
|
|
editor.putClientProperty(KEY_ROUNDED_SELECTION, UIManager.getBoolean("TextComponent.roundedSelection")); |
|
|
|
UIManager.getBoolean("TextComponent.roundedSelection")); |
|
|
|
|
|
|
|
disabledColor = UIManager.getColor(getPropertyPrefix() + ".disabledBackground"); |
|
|
|
disabledColor = UIManager.getColor(getPropertyPrefix() + ".disabledBackground"); |
|
|
|
inactiveColor = UIManager.getColor(getPropertyPrefix() + ".inactiveBackground"); |
|
|
|
inactiveColor = UIManager.getColor(getPropertyPrefix() + ".inactiveBackground"); |
|
|
|
} |
|
|
|
} |
|
|
@ -237,9 +236,7 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi |
|
|
|
protected InputMap getInputMap() { |
|
|
|
protected InputMap getInputMap() { |
|
|
|
InputMap map = new InputMapUIResource(); |
|
|
|
InputMap map = new InputMapUIResource(); |
|
|
|
|
|
|
|
|
|
|
|
InputMap shared = |
|
|
|
InputMap shared = (InputMap) DefaultLookup.get(editor, this, getPropertyPrefix() + ".focusInputMap"); |
|
|
|
(InputMap) DefaultLookup.get(editor, this, |
|
|
|
|
|
|
|
getPropertyPrefix() + ".focusInputMap"); |
|
|
|
|
|
|
|
if (shared != null) { |
|
|
|
if (shared != null) { |
|
|
|
map.setParent(shared); |
|
|
|
map.setParent(shared); |
|
|
|
} |
|
|
|
} |
|
|
@ -270,8 +267,7 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi |
|
|
|
if (getEditorKit(editor) instanceof DefaultEditorKit) { |
|
|
|
if (getEditorKit(editor) instanceof DefaultEditorKit) { |
|
|
|
if (map != null) { |
|
|
|
if (map != null) { |
|
|
|
Object obj = map.get(DefaultEditorKit.insertBreakAction); |
|
|
|
Object obj = map.get(DefaultEditorKit.insertBreakAction); |
|
|
|
if (obj != null |
|
|
|
if (obj instanceof DefaultEditorKit.InsertBreakAction) { |
|
|
|
&& obj instanceof DefaultEditorKit.InsertBreakAction) { |
|
|
|
|
|
|
|
Action action = new TextActionWrapper((TextAction) obj); |
|
|
|
Action action = new TextActionWrapper((TextAction) obj); |
|
|
|
componentMap.put(action.getValue(Action.NAME), action); |
|
|
|
componentMap.put(action.getValue(Action.NAME), action); |
|
|
|
} |
|
|
|
} |
|
|
@ -307,8 +303,7 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi |
|
|
|
km.clear(); |
|
|
|
km.clear(); |
|
|
|
if (accelerator != '\0') { |
|
|
|
if (accelerator != '\0') { |
|
|
|
km.put(KeyStroke.getKeyStroke(accelerator, getFocusAcceleratorKeyMask()), "requestFocus"); |
|
|
|
km.put(KeyStroke.getKeyStroke(accelerator, getFocusAcceleratorKeyMask()), "requestFocus"); |
|
|
|
km.put(KeyStroke.getKeyStroke(accelerator, |
|
|
|
km.put(KeyStroke.getKeyStroke(accelerator, DarkSwingUtil.setAltGraphMask(getFocusAcceleratorKeyMask())), |
|
|
|
DarkSwingUtil.setAltGraphMask(getFocusAcceleratorKeyMask())), |
|
|
|
|
|
|
|
"requestFocus"); |
|
|
|
"requestFocus"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -326,12 +321,9 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi |
|
|
|
for (Action a : actions) { |
|
|
|
for (Action a : actions) { |
|
|
|
map.put(a.getValue(Action.NAME), a); |
|
|
|
map.put(a.getValue(Action.NAME), a); |
|
|
|
} |
|
|
|
} |
|
|
|
map.put(TransferHandler.getCutAction().getValue(Action.NAME), |
|
|
|
map.put(TransferHandler.getCutAction().getValue(Action.NAME), TransferHandler.getCutAction()); |
|
|
|
TransferHandler.getCutAction()); |
|
|
|
map.put(TransferHandler.getCopyAction().getValue(Action.NAME), TransferHandler.getCopyAction()); |
|
|
|
map.put(TransferHandler.getCopyAction().getValue(Action.NAME), |
|
|
|
map.put(TransferHandler.getPasteAction().getValue(Action.NAME), TransferHandler.getPasteAction()); |
|
|
|
TransferHandler.getCopyAction()); |
|
|
|
|
|
|
|
map.put(TransferHandler.getPasteAction().getValue(Action.NAME), |
|
|
|
|
|
|
|
TransferHandler.getPasteAction()); |
|
|
|
|
|
|
|
return map; |
|
|
|
return map; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -357,14 +349,10 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
EditorKit editorKit = getEditorKit(editor); |
|
|
|
EditorKit editorKit = getEditorKit(editor); |
|
|
|
if (editorKit instanceof DefaultEditorKit) { |
|
|
|
if (editorKit instanceof DefaultEditorKit) { |
|
|
|
Set<AWTKeyStroke> storedForwardTraversalKeys = |
|
|
|
Set<AWTKeyStroke> storedForwardTraversalKeys = editor.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS); |
|
|
|
editor.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS); |
|
|
|
Set<AWTKeyStroke> storedBackwardTraversalKeys = editor.getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS); |
|
|
|
Set<AWTKeyStroke> storedBackwardTraversalKeys = |
|
|
|
Set<AWTKeyStroke> forwardTraversalKeys = new HashSet<>(storedForwardTraversalKeys); |
|
|
|
editor.getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS); |
|
|
|
Set<AWTKeyStroke> backwardTraversalKeys = new HashSet<>(storedBackwardTraversalKeys); |
|
|
|
Set<AWTKeyStroke> forwardTraversalKeys = |
|
|
|
|
|
|
|
new HashSet<>(storedForwardTraversalKeys); |
|
|
|
|
|
|
|
Set<AWTKeyStroke> backwardTraversalKeys = |
|
|
|
|
|
|
|
new HashSet<>(storedBackwardTraversalKeys); |
|
|
|
|
|
|
|
if (editor.isEditable()) { |
|
|
|
if (editor.isEditable()) { |
|
|
|
forwardTraversalKeys.remove(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0)); |
|
|
|
forwardTraversalKeys.remove(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0)); |
|
|
|
backwardTraversalKeys.remove(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK)); |
|
|
|
backwardTraversalKeys.remove(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK)); |
|
|
|