@Override
		public void menuKeyPressed( MenuKeyEvent e ) {
			// use invokeLater() because menu selection is not yet updated because
			// this listener is invoked before another listener that updates the menu selection
			EventQueue.invokeLater( () -> {
				if( !isDisplayable() )
					return;

				MenuElement[] path = MenuSelectionManager.defaultManager().getSelectedPath();
				if( path.length == 0 )
					return;

				// scroll selected menu item to visible area
				Component c = path[path.length - 1].getComponent();
				JViewport viewport = scrollPane.getViewport();
				Point pt = SwingUtilities.convertPoint( c, 0, 0, viewport );
				viewport.scrollRectToVisible( new Rectangle( pt, c.getSize() ) );

				// update arrow buttons
				boolean upVisible = scrollUpButton.isVisible();
				updateArrowButtons();
				if( !upVisible && scrollUpButton.isVisible() ) {
					// if "up" button becomes visible, make sure that bottom menu item stays visible
					Point viewPosition = viewport.getViewPosition();
					int newY = viewPosition.y + scrollUpButton.getPreferredSize().height;
					viewport.setViewPosition( new Point( viewPosition.x, newY ) );
				}
			} );
		}
Scroll when user presses Up or Down keys.
flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatPopupMenuUI.java