Is it possible to have quot;movablequot;/quot;draggablequot; components like JButtons, JTextFields in a JFrame?(是否有可能具有“可移动/“可拖动?JFrame 中的 JButton、JTextField 等组件?)
问题描述
基本上,我计划在 JFrame 上放置一些按钮、文本字段、标签等,并且我希望用户可以使用鼠标在该 JFrame 上移动不同的组件.
Basically I plan to place some buttons, textfields, labels, etc. on a JFrame and I would like to make it possible that a user can move the different components around on that JFrame with the mouse.
我已经看到了 MouseListeners、子类化 JComponent 代码、DropSource/DropTarget 实现等的各种方式,但我不确定哪种是推荐"方式(我不需要支持不同之间的拖放"框架/应用程序,这是大多数示例似乎所做的).
I have seen various ways with MouseListeners, subclassed JComponent code, DropSource/DropTarget implementations and so on, but I'm unsure which is the "recommended" way (I don't need to support "drag and drop" between different Frames/Applications which is what most examples seem to do).
推荐答案
Component Mover 可以为您做到这一点.
The Component Mover can do this for you.
这篇关于是否有可能具有“可移动"/“可拖动"?JFrame 中的 JButton、JTextField 等组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:是否有可能具有“可移动"/“可拖动"?JFrame 中的 JButton、JTextField 等组件?
基础教程推荐
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
