简体   繁体   English

从java应用程序到applet?

[英]From java application to applet?

I never worked with applets and have the following questions: 我从未使用applet并且有以下问题:

  • can an existing Java Desktop App be ported to an Applet by just providing a different interface? 可以通过提供不同的界面将现有的Java桌面应用程序移植到Applet吗? Can I reuse everything that's behind the GUI (services, injections, databases)? 我可以重用GUI背后的所有内容(服务,注入,数据库)吗?

  • is the same possible for Java EE applications? Java EE应用程序是否可以相同? Just provide a different UI and reuse the rest of the code? 只需提供不同的UI并重用其余代码?

Basicly you just have to embed the JFrame, or whatever you used before, in an Class,which is extending an Applet. 基本上,你只需要将JFrame或之前使用的任何东西嵌入到一个扩展Applet的类中。 No you can´t use everything, there are some security restrictions for Applets(acces to the filesystem for example) until they are getting signed. 不,你不能使用所有东西,Applets(例如访问文件系统)有一些安全限制,直到它们被签名。

The UI, etc. for the most part is 'reusable', but the applet is also subject to stricter Sandboxing; UI等大部分都是“可重用的”,但applet也受到更严格的沙盒攻击; the applet is limited to only the permissions that the user allows and/or additions to the JVM settings on the user machine. applet仅限于用户允许的权限和/或用户计算机上JVM设置的添加。 (There are also restrictions on port access for applets for things like database connections - and possible firewall considerations. (对于诸如数据库连接之类的小程序的端口访问也有限制 - 以及可能的防火墙考虑因素。

So, the answer is a "yes, but there is still a lot of work. Get to know what kind of work that would be based on your user base. 所以,答案是“是的,但仍有很多工作。了解哪些工作将基于您的用户群。

Basically when you are making applets you can't use frames or a menu. 基本上,当你制作applet时,你不能使用框架或菜单。 You should use panels and work on them. 你应该使用面板并对它们进行处理。 Most of things after that are simple and same. 之后的大部分事情都很简单而且相同。

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

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