是否可能具有“可移动的”/“可拖动的”组件如JButtons,JTextFields在JFrame中? [英] Is it possible to have "movable"/"draggable" components like JButtons, JTextFields in a JFrame?

查看:211
本文介绍了是否可能具有“可移动的”/“可拖动的”组件如JButtons,JTextFields在JFrame中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上我打算在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).

推荐答案

组件移动器可以为您做到这一点。

The Component Mover can do this for you.

这篇关于是否可能具有“可移动的”/“可拖动的”组件如JButtons,JTextFields在JFrame中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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