<Swing Dev> [14] RFR 8225505: ctrl-F1 does not show the tooltip of a menu item (JMenuItems)

Dmitry Markov dmitry.markov at oracle.com
Fri Aug 2 13:07:42 UTC 2019


Hi Sergey,


> On 2 Aug 2019, at 01:12, Sergey Bylokhov <Sergey.Bylokhov at oracle.com> wrote:
> 
> Hi, Dmitry.
> 
> On 01.08.2019 06:26, Dmitry Markov wrote:
>> I agree it is not a good practice to use keyPressed event without corresponding keyReleased. So I added its generation. Please find new version here: http://cr.openjdk.java.net/~dmarkov/8225505/webrev.01/
> 
> It looks like the same effect could be achieved if the Tooltipmanager will listen to MenuKey events(If it registers MenuKeyListener for the JMenuItem). It is called from the MenuSelectionManager.processKeyEvent()->JMenuItem.processKeyEvent()->JMenuItem.processMenuKeyEvent().

Yes, it is possible to get the same result using the approach you mentioned. Unfortunately registration of MenuKeyListener inside ToolTipManager is not enough. Also we need to generate new MenuKeyEvent with proper source (component) to let the tooltip manager know for which menu element tooltip text should be displayed/hidden (similar thing I did in my proposal, see processToolTipKeyEvent() method). 
I am sorry but I do not think we have to implement such solution since generation of new events is still necessary plus implementation of MenuKeyListener is required.

Thanks,
Dmitry 
> 
> 
> -- 
> Best regards, Sergey.



More information about the swing-dev mailing list