public static @NotNull Map<KeyStroke, ActionListener> keyboardActions(@NotNull JScrollPane target) {
    if (ScreenReader.isActive()) {
      // With screen readers, we want the default keyboard behavior inside
      // the document text editor, i.e. the caret moves with cursor keys, etc.
      return Collections.emptyMap();
    }
    Map<KeyStroke, ActionListener> result = new HashMap<>(10);
    result.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), e -> {
      JScrollBar scrollBar = target.getVerticalScrollBar();
      int value = scrollBar.getValue() - scrollBar.getUnitIncrement(-1);
      value = Math.max(value, 0);
      scrollBar.setValue(value);
    });
    result.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), e -> {
      JScrollBar scrollBar = target.getVerticalScrollBar();
      int value = scrollBar.getValue() + scrollBar.getUnitIncrement(+1);
      value = Math.min(value, scrollBar.getMaximum());
      scrollBar.setValue(value);
    });
    result.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), e -> {
      JScrollBar scrollBar = target.getHorizontalScrollBar();
      int value = scrollBar.getValue() - scrollBar.getUnitIncrement(-1);
      value = Math.max(value, 0);
      scrollBar.setValue(value);
    });
    result.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), e -> {
      JScrollBar scrollBar = target.getHorizontalScrollBar();
      int value = scrollBar.getValue() + scrollBar.getUnitIncrement(+1);
      value = Math.min(value, scrollBar.getMaximum());
      scrollBar.setValue(value);
    });
    result.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), e -> {
      JScrollBar scrollBar = target.getVerticalScrollBar();
      int value = scrollBar.getValue() - scrollBar.getBlockIncrement(-1);
      value = Math.max(value, 0);
      scrollBar.setValue(value);
    });
    result.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), e -> {
      JScrollBar scrollBar = target.getVerticalScrollBar();
      int value = scrollBar.getValue() + scrollBar.getBlockIncrement(+1);
      value = Math.min(value, scrollBar.getMaximum());
      scrollBar.setValue(value);
    });
    result.put(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0), e -> {
      JScrollBar scrollBar = target.getHorizontalScrollBar();
      scrollBar.setValue(0);
    });
    result.put(KeyStroke.getKeyStroke(KeyEvent.VK_END, 0), e -> {
      JScrollBar scrollBar = target.getHorizontalScrollBar();
      scrollBar.setValue(scrollBar.getMaximum());
    });
    result.put(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, InputEvent.CTRL_MASK), e -> {
      JScrollBar scrollBar = target.getVerticalScrollBar();
      scrollBar.setValue(0);
    });
    result.put(KeyStroke.getKeyStroke(KeyEvent.VK_END, InputEvent.CTRL_MASK), e -> {
      JScrollBar scrollBar = target.getVerticalScrollBar();
      scrollBar.setValue(scrollBar.getMaximum());
    });
    return result;
  }
public static @NotNull Map<KeyStroke, ActionListener> keyboardActions(@NotNull JScrollPane target)