Browse Source

Fixed NPE when checking action name.

pull/127/head
weisj 5 years ago
parent
commit
ec8cb6e759
  1. 7
      core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableUI.java

7
core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableUI.java

@ -434,9 +434,10 @@ public class DarkTableUI extends DarkTableUIBridge implements FocusListener {
}
if (table == null) return false;
KeyStroke stroke = KeyStroke.getKeyStroke(event.getExtendedKeyCode(), event.getModifiersEx());
String actionName = table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).get(stroke).toString();
String cutActionName = TransferHandler.getCutAction().getValue(Action.NAME).toString();
String copyActionName = TransferHandler.getCopyAction().getValue(Action.NAME).toString();
String actionName = String.valueOf(table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).get(stroke));
if ("null".equals(actionName)) actionName = null;
String cutActionName = String.valueOf(TransferHandler.getCutAction().getValue(Action.NAME));
String copyActionName = String.valueOf(TransferHandler.getCopyAction().getValue(Action.NAME));
return Objects.equals(actionName, copyActionName) || Objects.equals(actionName, cutActionName);
}
return false;

Loading…
Cancel
Save