gpt4 book ai didi

java - 隐藏 JFrame 外部的所有应用程序

转载 作者:行者123 更新时间:2023-11-30 02:41:34 25 4
gpt4 key购买 nike

所以在这种情况下,我有一个简单的 JFrame:

JFrame frame = new JFrame();
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
frame.setSize(screen.width/2, screen.height/2);
frame.setLocation(screen.width / 2 - frame.getSize().width / 2, screen.height / 2 - frame.getSize().height / 2);
frame.setVisible(true);

我的问题是,我是否可以打开任何其他应用程序,甚至使用进程间通信在我的 JFrame 中显示?例如:

打开chrome.exe:

Runtime r = Runtime.getRuntime();
Process p = r.exec("start chrome.exe");

像这样显示:

Example

最佳答案

..is it possible for me to open any other application or even use an inter-process communication to be displayed only inside my JFrame?

没有。无论如何,不​​是在纯 Java 中。为了扩展这一点,我将引用充满鳗鱼的气垫船,他总结得很好。

..you're trying to simulate an OS with the one programming language that is least equipped to do this! Java was built specifically to be as OS and hardware agnostic as possible, meaning that it takes pains to remove itself from both OS and hardware, making it the worst possible choice for this sort of project

关于java - 隐藏 JFrame 外部的所有应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41515280/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com