简体   繁体   English

Java 中的图像滑块 - Swing

[英]Image slider in Java - Swing

I want to create something like this http://flowplayer.org/tools/demos/scrollable/index.html but in Java Swing.我想创建这样的东西http://flowplayer.org/tools/demos/scrollable/index.html但在 Java Swing 中。 I don't need all those effects, just scrolling of thumbnail images.我不需要所有这些效果,只需要滚动缩略图。 Is good approach to use toolbar and ImageIcons, and then on click load image on some JPanel.使用工具栏和 ImageIcons,然后单击某些 JPanel 上的加载图像是一种好方法。 Is there any common practice for this?这有什么常见的做法吗?

Use a JPanel with a GridLayout containing a JLabel for each image.将 JPanel 与包含每个图像的 JLabel 的 GridLayout 一起使用。 Then you can add the panel to a scrollpane.然后您可以将面板添加到滚动窗格。 You can turn off the scrollbars so they are not visible.您可以关闭滚动条,使其不可见。

You can then use the technique described in Action Map Action to create buttons to do the scrolling.然后,您可以使用Action Map Action 中描述的技术来创建按钮来进行滚动。

Check out Kirill Grouchnikov's Trident animation library , in particular Project Onyx , which looks like it might do what you need.查看 Kirill Grouchnikov 的Trident 动画库,特别是Project Onyx ,它看起来可以满足您的需求。

(Edit: It's probably not an out-of-the-box solution, but the library itself looks nice and you could probably adapt some of the example application to suit your needs). (编辑:它可能不是开箱即用的解决方案,但库本身看起来不错,您可能可以调整一些示例应用程序以满足您的需求)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM