在java中显示图像集的手风琴菜单
我正在做一个 Java 项目,其中包含一些图形内容。我想在手风琴菜单之类的东西下显示一组 BufferedImages。这意味着当我单击一个手风琴菜单根项时,它应该显示该名称下的一组图像,当单击另一个根菜单项时,它应该显示另一组图像。我怎样才能用Java实现这个?有没有办法将 JPanel 添加为 Accordion 菜单叶项?如果有人能提供示例代码,那就非常感激了。
I'm doing a Java project which includes little bit of graphical stuffs. I want to display set of BufferedImages under Accordion menu kind of thing. that means when I click on one Accordion menu root item it should display set of images under that name and when clicking on another root menu item it should show another set of images. How could I implement this with Java?. Is there any way to add JPanel as Accordion menu leaf item? If anyone can provide sample code it is really appreciable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
无法抗拒一些乐趣:事实证明,可以对 JXTaskPaneContainer(在 SwingX 中)进行一些调整,使其表现得类似于手风琴。所需要的只是强制最多扩展其中一个包含的 JXTaskPaneContainer。就像代码片段一样:
Couldn't resist some fun: turns out that it's possible to tweak a JXTaskPaneContainer (in SwingX) a bit to behave similar to an accordion. All that's needed it to force at most one of the contained JXTaskPaneContainers to be expanded. Something like the code snippet:
嗯,稍微谷歌搜索一下,我发现了这个链接。
这可能对你有帮助 -
http:// /code.google.com/p/martin-personal-project/downloads/detail?name=SwingAccordionMenu.zip&can=2&q=
您将获得一个 ZIP 文件,解压并运行 SwingAccordionMenu.jar,你会得到手风琴作为输出,例如 -
Well a little bit of googling and I found this link .
It may be helpful for you -
http://code.google.com/p/martin-personal-project/downloads/detail?name=SwingAccordionMenu.zip&can=2&q=
You will get a ZIP file , unzip and run the SwingAccordionMenu.jar, you will get accordion as output like -