How to convert a Swing Application to an Applet?

前端 未结 2 964
眼角桃花
眼角桃花 2021-01-19 17:57

I created a desktop application with Swing Application Framework, now how can I convert it to an applet? The main class extends SingleFrameApplication.

EDITED: This

相关标签:
2条回答
  • 2021-01-19 18:45

    Simplest thing is just to make a new outer class inheriting from JApplet, and instantiate the actual frame inside it.

    Update

    Found a tutorial online that could help.

    0 讨论(0)
  • 2021-01-19 18:48

    The quick and dirty way:

    Drop extends SingleFrameApplication. Add extends JApplet.

    replace the constructor with public void init() leaving the body as is.

    Create an HTML page to hold it. and give it a whirl.

    There will likely be some scoping issues, but you should be able to fix those fairly easily.

    0 讨论(0)
提交回复
热议问题