简体   繁体   English

Java将JFrame附加到正在运行的应用程序窗口吗?

[英]Java attach JFrame to a running application window?

How can I attach a JFrame in the top right to another applications open window and stay with it while resizing? 如何在右上角将JFrame附加到另一个应用程序打开的窗口,并在调整大小时保持不变? Is it possible? 可能吗?

Here is a diagram of what i would like to accomplish: 这是我要完成的工作的图表:

在此处输入图片说明

Thanks for the help! 谢谢您的帮助! If this is not possible, are there alternatives ? 如果这不可能, 是否有其他选择

Ways to get window size/location and set my own jframe accordingly? 如何获取窗口大小/位置并相应地设置自己的jframe?

You are asking Java to modify an already running non-Java program, and for these types of problems, Java is not the best tool. 您要让Java修改已经运行的非Java程序,对于这些类型的问题,Java并不是最好的工具。 Please understand that one of Java's main strengths is its ability to run compiled code unchanged on multiple platforms. 请理解,Java的主要优势之一是它能够在多个平台上不变地运行编译后的代码。 With this strength comes a weakness: of necessity, Java must be as OS agnostic as possible, and because of this, it is not a good tool when code needs to get cozy with the OS. 这种优势带来了一个弱点:必然,Java必须尽可能地与OS无关,因此,当代码需要与OS融为一体时,它不是一个好的工具。

Alternatives: just about any other language that can allow easy OS calls. 替代方案:几乎所有其他可以轻松进行OS调用的语言。

Don't get me wrong, you can do some similar stuff with Java, but it requires that you jump through hoops that just aren't needed when using other tools. 别误会,您可以使用Java做类似的事情,但这需要您跳过使用其他工具时不需要的箍。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM