将垂直滚动添加到JPopupMenu?

问题描述:

我想添加一种方法来滚动 JPopupMenu 中的菜单项,就像滚动 JComboBox中的项目列表一样/ code>。

I would like to add a way to scroll through menu items in a JPopupMenu, much like scrolling through a list of items in a JComboBox.

假设我有10个菜单项。我想一次只显示5个菜单项,我会在 JPopupMenu 的底部或顶部使用垂直滚动按钮来显示不是的菜单项列出并隐藏我刚才看到的那些。

Let's say I have 10 menu items. I would like to display only 5 menu items at a time, and I would use a vertical scroll button at the bottom or top of the JPopupMenu to show the menu items that are not listed and hide the ones that I just saw.

有可能吗?我正在使用JIDE Software的 JideSplitButton ,点击后会显示 JPopupMenu 。我试图保持我放置 JideSplitButton 的命令栏的外观和感觉,所以我不想用替换它JComboBox 除非我真的需要。

Is it possible? I am using JIDE Software's JideSplitButton, which displays a JPopupMenu when clicked. I am trying to keep the look and feel of the command bar on which I placed the JideSplitButton, so I don't want to replace it with a JComboBox unless I really have to.