JDK-8192787 : Tabs should be able to have Mnemonics
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: 10
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2017-11-30
  • Updated: 2018-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Description
A DESCRIPTION OF THE REQUEST :
Tabs aren't Labeleds and so they don't have mnemonics

However giving them a Mnemonic, would be a worth-while addition.

If Tab can't extend Labeled, can it have similar mnemonic methods anyway?



JUSTIFICATION :
Being able to switch to *specific* tabs using mnemonics would make for a more-efficient UX.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
One should be able to switch to a specific tab using a Mnemonic.
ACTUAL -
One can only traverse tabs in linear order, using CTRL + TAB

---------- BEGIN SOURCE ----------
        Tab firstTab = new Tab("_First");
        Tab secondTab = new Tab("_Second");
        Tab thirdTab = new Tab("_Third");

        TabPane tabPane = new TabPane(firstTab, secondTab, thirdTab);
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
I tried to .lookup Tab's label 

    firstTab.lookup(".label");

and add a Mnemonic directly to the label,

    label.setMnemonicParsing(true);
    label.setText("_First");

but this does not work because Tab's `.lookup()` method is package private and only looks up things in the Tab's content.


Comments
This should be doable - but may not be straight forward. Points to be noted are - 1) Tab class is not a control. 2) The new behavior on 'Alt' key press need to take into account - we will end up having mnemonics on tabs as well as controls(like buttons) on tab-content that is currently visible. Need to carefully prioritize based on focus.
01-12-2017

This is a enhancement request for adding mnemonic directly on a Tab.
30-11-2017