• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

How code that is commented work?

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
look the code
import java.applet.*;
import java.awt.*;
public class MyApplet extends Applet{
// all the required methods implemented
}
/*
<applet code="MyApplet" width=400 height = 500>
</applet>

*/

compile command : javac MyApplet.java
execute command : appletviewer MyApplet.java

if the commented code present then window of size 400*500 sit on the desktop otherwise no window is seen
how this commented code is working please explain
thanks in advance

 
Ranch Hand
Posts: 448
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You commented the code just for demonstrating right? as there is no such kind of comments in HTML.

If you remove the commented code from HTML page then the applet is not embedded into your web page...
 
Mr Anil Kumar Pandey
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sir how we are able to use classname.java for execution purpose
 
Sunny Bhandari
Ranch Hand
Posts: 448
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
pandey sahib,

ask questions without any hesitation and write question more clearly....
 
Mr Anil Kumar Pandey
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sunny Bhandari wrote:pandey sahib,

ask questions without any hesitation and write question more clearly....



how appletviewer Abc.java command works in the case of an Applet
for execution purpose
 
author
Posts: 23923
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mr Anil Kumar Pandey wrote:how appletviewer Abc.java command works in the case of an Applet
for execution purpose



If I had to speculate, I say it's a bug, or it should be... Applet tags are part of HTMLs, so I guess we all assumed that appletviewer takes a html file.

If this works (which I didn't test -- taking your word on this), then I say the programmers took a short cut, and simply extracted the Applet tags, without any regard of whether it is a valid html file or not.

Henry
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Personally I think this is an great thing -- very convenient for little one-off demos. It's not so much that the appletviewer implementers took a shortcut -- it's that browsers in general are obliged to accept grievously malformed HTML. I am sure the same thing would work in Firefox, although you might have to rename the file to *.html .
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is quite handy - saves you from having to keep an extra HTML file just for the APPLET tag: AppletViewer ignores any HTML that is not relevant to launching an applet.
reply
    Bookmark Topic Watch Topic
  • New Topic