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 等组件?


- C++ 和 Java 进程之间的共享内存 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01