将垂直滚动添加到JPopupMenu? [英] Adding vertical scroll to a JPopupMenu?

查看:157
本文介绍了将垂直滚动添加到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.

推荐答案

可能是这个
http://www.javabeginner.com/java-swing/java-scrollable-popup-menu

这篇关于将垂直滚动添加到JPopupMenu?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆