Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8291468

macOS: Option+Up/Down Arrow don't traverse to beginning/end of line in JTextArea

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 20
    • client-libs
    • None
    • behavioral
    • low
    • New support of Option+Up, Option+Down key combinations
    • Java API
    • SE

      Summary

      Add support for handling Option+Up or Option+Down key combination on macOS in JTextArea

      Problem

      Pressing Option+Up or Option+Down key combination in JTextArea is not handled on macOS

      Solution

      Added support of Option+Up and Option+Down key action in Swing's Default EditorKit class. This requires defining new action names in the public API of DefaultEditorKit.

      Specification

      javax.swing.text.DefaultEditorKit

      +    /**
      +     * Name of the {@code Action} for moving the caret
      +     * to the beginning of the current line or up to the
      +     * beginning of the previous line if the caret is
      +     * already at the beginning of the line.
      +     * @see #getActions
      +     */
      +    public static final String beginLineUpAction = "caret-begin-line-and-up";
      +
      +    /**
      +     * Name of the {@code Action} for moving the caret
      +     * to the end of the current line or down to the
      +     * end of the next line if the caret is already
      +     * at the end of the line.
      +     * @see #getActions
      +     */
      +    public static final String endLineDownAction = "caret-end-line-and-down";
      +

            psadhukhan Prasanta Sadhukhan
            webbuggrp Webbug Group
            Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: