在 Mac 应用程序中嵌入 Java (.jar) 文件

发布于 2024-11-28 17:01:58 字数 338 浏览 1 评论 0原文

我需要在我的主 NSWindow 中运行一个 .jar 文件,我该怎么做?

我一直在查看Apple的 "JavaFrameEmbedding" 示例,并且似乎是能够在没有任何 Java 异常的情况下运行它(以前我有异常),但是我看不到小程序。他们使用 JavaFrameView,它是 JavaFrameEmbedding 框架的一部分,尽管我根本找不到任何关于此的文档。这是使用Lion(我也尝试过Snow Leopard,但没有成功)。

I need to have a .jar file run within my main NSWindow, how can I do this?

I have been looking at Apple's example for "JavaFrameEmbedding", and seem to be able to run it without any Java exceptions (previously I had exceptions), however I cannot see the applet. They use the JavaFrameView which is part of the JavaFrameEmbedding framework, although I can't find any documentation about this at all. This is using Lion (I have also tried on Snow Leopard without success).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

少女净妖师 2024-12-05 17:01:58

下载这只小狗并深入研究它。

如果您想在 java 中创建 NSWindow 并让程序从那里运行,请尝试以下操作:

import com.apple.cocoa.application.*;
import com.apple.cocoa.foundation.*;

public class Test {

    public static void main (String [] args) {

        NSApplication nsapp = NSApplication.sharedApplication();
        NSRect rect = new NSRect(500, 500, 500, 500);

        NSWindow.MiniaturizableWindowMask;;
        NSWindow window = new NSWindow(rect, style, NSWindow.Buffered,
false);
        window.makeKeyAndOrderFront(window);
        nsapp.run();

    }

}

Download this puppy and dig through it.

If you want to make the NSWindow in java and have the program run from there try something like this:

import com.apple.cocoa.application.*;
import com.apple.cocoa.foundation.*;

public class Test {

    public static void main (String [] args) {

        NSApplication nsapp = NSApplication.sharedApplication();
        NSRect rect = new NSRect(500, 500, 500, 500);

        NSWindow.MiniaturizableWindowMask;;
        NSWindow window = new NSWindow(rect, style, NSWindow.Buffered,
false);
        window.makeKeyAndOrderFront(window);
        nsapp.run();

    }

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文