即使修复了此问题,小程序客户端中也不会出现任何内容.小程序不调用 main 方法,而是调用 init.也不要为小程序组件创建新的 Frame - 将它们添加到小程序容器本身.不要使用旧的重量级 AWT,而是使用轻量级的 Swing.另请参阅 Java Web Start 进行部署.is everything is right in my programme?? When i run it the a screen appears but it says that Applet is not initializedimport java.applet.Applet;import java.awt.*;import javax.swing.*;public class JobseekerLogin extends Frame {public void CreateFrame(){Frame frame = new Frame("Frame in Java Swing");frame.setSize(400, 400);frame.setVisible(true);Label lb = new Label("Username");add("East",lb);add("West",new TextArea(""));Label lb1 = new Label("Password");add("East",lb1);add("West",new TextArea(""));}public static void main(String []args){ JobseekerLogin obj = new JobseekerLogin(); obj.CreateFrame();} } 解决方案 This class is not launching as an applet as it does not extend JApplet or Applet.Even when this is fixed, nothing will appear in the applet client. Applets do not call the main method but rather init. Also don't create a new Frame for applet components - add them to the applet container itself.Rather than using the old heavyweight AWT, use lightweight Swing. Also look at Java Web Start for deployment. 这篇关于获取 Applet 未初始化错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
05-28 14:43
查看更多