[英]Embedding a JFrame in an Applet
I have found an open source application that creates a JFrame to display some content. 我发现一个开源应用程序创建了一个JFrame来显示一些内容。 I would like to "embed" this JFrame into an applet, so everything that is displayed in the Jframe will be displayed in the applet - is this possible?
我想将此JFrame “嵌入”到applet中,因此Jframe中显示的所有内容都将显示在applet中-这可能吗?
Thanks for your help! 谢谢你的帮助!
..open source application that creates a JFrame..
..创建JFrame的开源应用程序。
Since the source is available, take whatever they do in the frame, and do that instead in an applet (with some slight variants & gotchas). 由于源可用,因此请在框架中执行所有操作,然后在applet中进行操作(有一些细微的变体和陷阱)。
Some typical problems with using the frame content in an applet are that: 在小程序中使用框架内容的一些典型问题是:
EXIT_ON_CLOSE
as an exit behavior for the frame. EXIT_ON_CLOSE
用作框架的退出行为。 It is not permitted (or necessary) for a sand-boxed applet to end the VM. System.exit(int)
. System.exit(int)
。 Points 3 & 4 are less applicable/relevant if the frame was designed to be launched using web start. 如果框架是使用Web Start启动的,则第3点和第4点不太适用/不重要。 And since I mention webstart..
因为我提到了webstart。
Note that it is generally easier to 'convert' a frame to be launched using Java Web Start than it is either to create and deploy an applet, or to convert a frame to an applet. 请注意,“转换”要使用Java Web Start启动的框架通常比创建和部署小程序或将框架转换为小程序要容易。 Unless there is some functionality of an applet that is vital & not available to an application (which is unlikely, given you started with the application), I would recommend launching the app.
除非applet的某些功能对应用程序至关重要且不可用(鉴于您是从该应用程序开始的,所以这不太可能),否则我建议启动该应用程序。 via JWS, rather than doing a conversion.
通过JWS,而不是进行转换。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.