我可以让最小化的 Java 应用程序对放在其上的文件做出反应吗(在 Windows 上)?
我能否让最小化的 Java 应用程序对拖放到其上的文件做出反应(在 Windows 上),以便用户可以将文件拖到工具栏上的图标上,这将导致我的应用程序重新打开并处理拖放到其上的文件。
我使用 Java 6
Can I get my minimized Java app to react to files being dropped on it (on Windows) so that a user can drag files onto the icon on the toolbar and that will cause my application to reopen and process the the files that were dropped on it.
Im using Java 6
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这对于纯 Java 来说是不可能的。 Java 为您提供了对框架(窗口)的一定程度的控制,但它没有为您提供工具栏的 API(我假设您的意思是与您在开始栏中创建的框架相对应的栏?)。您可以为框架内的某些内容(例如组件(例如 JPanel))创建一个放置目标,这样,如果您将内容拖到该目标上,您将收到 dnd 事件,但没有您有权访问的组件映射到开始栏或您的Frame 的条目在其中,因此没有任何内容可以添加 DropTarget。
This isn't possible with pure Java. Java gives you some level of control over the Frame (the window) but it doesn't give you an API to the toolbar (I assume you mean the bar which corresponds to the Frame you create in the start bar?). You can create a drop target for something inside your frame like a component (e.g. a JPanel) so that if you drag stuff onto that you will receive dnd events but there is no component that you have access to which maps to the start bar or your Frame's entry in it so there is nothing to add the DropTarget to.