获取 Applet 未初始化错误 [英] Getting Applet not initialized error
问题描述
我的程序一切正常吗??
当我运行它时,出现一个屏幕,但它说 Applet 未初始化
import java.applet.Applet;导入 java.awt.*;导入 javax.swing.*;公共类 JobseekerLogin 扩展框架 {公共无效创建框架(){Frame frame = new Frame("Java Swing 中的框架");frame.setSize(400, 400);frame.setVisible(true);Label lb = new Label("用户名");添加(东",磅);add("West",new TextArea(""));Label lb1 = new Label("密码");添加(东",磅1);add("West",new TextArea(""));}public static void main(String []args){JobseekerLogin obj = new JobseekerLogin();obj.CreateFrame();}}
这个类不是作为小程序启动的,因为它不扩展 JApplet
或 Applet
.>
即使修复了此问题,小程序客户端中也不会出现任何内容.小程序不调用 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 initialized
import 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 未初始化错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!