如何查找是否在 JApplet 中单击了图像? [英] How to find if image is clicked in JApplet?

查看:21
本文介绍了如何查找是否在 JApplet 中单击了图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是支持图片拖拽.如何在 JApplet 中查找图像是否被点击?

It is to support image dragging. How to find if an image is clicked in JApplet?

我相信有一种简单的方法可以做到这一点,但我到处找,似乎都找不到.

I'm sure there is an easy way to do this, but I've looked everywhere and cannot seem to find it.

推荐答案

参见 拖放和数据传输 教程的课程.

如果拖动的目的是更改幻灯片或类似内容中的顺序,请查看 JList.请参阅setDragEnabled(true) &如何使用列表了解更多详情.

If the purpose of the dragging is to change the order in a slideshow or similar, look to a JList. See setDragEnabled(true) & How to Use Lists for more details.

对于显示组件,我建议使用@Hover 建议的 JLabel.JList 默认使用 JLabel 作为渲染组件.

For the display component, I would recommend a JLabel as suggested by @Hover. JList uses a JLabel as the rendering component by default.

这篇关于如何查找是否在 JApplet 中单击了图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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