Java 中的图像滑块 - Swing [英] Image slider in Java - Swing

查看:32
本文介绍了Java 中的图像滑块 - Swing的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建这样的东西 http://flowplayer.org/tools/demos/scrollable/index.html 但在 Java Swing 中.我不需要所有这些效果,只需要滚动缩略图.使用工具栏和 ImageIcons,然后单击某些 JPanel 上的加载图像是一种好方法.这有什么常见的做法吗?

I want to create something like this http://flowplayer.org/tools/demos/scrollable/index.html but in 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. Is there any common practice for this?

推荐答案

使用带有 GridLayout 的 JPanel,每个图像都包含一个 JLabel.然后您可以将面板添加到滚动窗格.您可以关闭滚动条,使其不可见.

Use a JPanel with a GridLayout containing a JLabel for each image. Then you can add the panel to a scrollpane. You can turn off the scrollbars so they are not visible.

然后您可以使用Action Map Action<中描述的技术/a> 创建按钮来进行滚动.

You can then use the technique described in Action Map Action to create buttons to do the scrolling.

这篇关于Java 中的图像滑块 - Swing的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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