Run Java-applets directly ( without html page )

前端 未结 7 1220
一向
一向 2021-01-05 15:58

I have a problem.

How i can run my java-applet directly without embedded in my web page?

I know appletViewr can execute applet without a browser but I need

7条回答
  •  孤城傲影
    2021-01-05 16:34

    Use below code with your code, where AppletClass is your Applet class.

    AppletClass appletClass = new AppletClass ();
    
    JFrame frame = new JFrame();
    frame.setLayout(new GridLayout(1, 1));
    frame.add(appletClass );
    
    // Set frame size and other properties
    ...
    
    // Call applet methods
    appletClass .init();
    appletClass .start();
    
    frame.setVisible(true);
    

    More customizations can be done as required.

提交回复
热议问题