java - Is it ever appropriate to have a main method in an applet? -


I am trying to wrap my head around the rules of use of applet. I know that there is no main method in an applet (instead of using init () ), but every code sample given by my professor is an applet with a main method, as below In the given code.

My understanding was that there is no good idea to keep the main method in the applet for security reasons, is that right? When (if ever) should I use a main method in an applet?

In addition to this, my professors are using the applet, as embedded in a PowerPoint presentation, after which they can run smoothly during their presentation. If the applet inti () was used in instead of main , is it still possible to run an applet, which Was embedded in a PowerPoint presentation? I want to ask this because I can not see any reason why it should not use a main method in an applet, unless it is necessary to run an applet properly, when it is built in PowerPoint presentation .

  // EventDispatcherThreadDemo .Java import javax.swing. *; Public Segment Event Dispatcher enhances Trademo Japplet (Public Event Dispatch Traded Demo) (Add New Jlab ("Hi, This An Event Dispatch Walks With Thread"))} Public Static Zero Main (String [] Args) {SwingUtilities .invokeLater (new Rannabal () (public non-zero) {Jeffrey Frame = New Gefram ("Event Dispatch Thread Demos"); Frame.ed (New Event DisplaysTradiedDMO); Frame SetSize (200, 200); Frame.Set Default close operation (JFRAM.EXIT_ON_CLOSE); Frame.SetLeitingRelitalTo (empty); Frame.Serviceable (True);}})}}  

PS About this applet Trying to know more, do nothing with homework.

main There is no special meaning for applet in the method.

In your professor it is included in a GeFrame with some lines to fire the class Security has, so it "will be able to run from the command line with the Java Fobod" command. It is being launched PowerPoint as "Apletuvr Fubar" command against the run, which is another program. It is not giving the full applet to the environment, but the performance programs can be so simple, it does not make any difference.

Instead of just rendering it with a big HTML page, you decided to do this in applets, I do not know.


Comments