File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes HTML to Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "HTML to Applet" Watch "HTML to Applet" New topic
Author

HTML to Applet

Revati Pathak
Greenhorn

Joined: Feb 19, 2001
Posts: 26
hi,
i have a html file including applet tag.in addition to that i have a a button on the same HTML page. i have a textfield in my applet. now, on click of the button in the i want to set the value of the textField in the applet.
is it possible?
can any one help me for the same?

regards,
Revati
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
This question would be great for the HTML/JavaScript forum. This is how you do it:
1) The function and class that you want to access must be declared public.
2) The Applet [b]must[b] finish loading before it can be accessed.
3) In your HTML, provide a name for the Applet by using the name attribute of the <APPLET> tag.
4) Access your applet's methods using the applet object of JavaScript.
For example, if I have an applet with a public function called setTextboxText(String s), I can access that function as follows:

That should do it for you. HTH
[This message has been edited by Bodie Minster (edited March 08, 2001).]
Revati Pathak
Greenhorn

Joined: Feb 19, 2001
Posts: 26
hi friend,
i have already tried this but i am not vable to access the members of applet using the name of the Applet tag.
is there any other way to do it?
thanks for your reply.
regards,
Revati


That should do it for you. HTH
[This message has been edited by Bodie Minster (edited March 08, 2001).][/b]<HR></BLOCKQUOTE>
[This message has been edited by Revati Pathak (edited March 09, 2001).]
[ July 21, 2002: Message edited by: Marilyn de Queiroz ]
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
That's the only way that I know of. What browser are you using? Netscape didn't add this feature until Navigator3 and IE didn't support it until IE4. You might try using the for in construct to print out the elements in the document collection. You would do that like this:

You might also try embedding the text field, button, and applet in a <FORM>.
[This message has been edited by Bodie Minster (edited March 09, 2001).]
Revati Pathak
Greenhorn

Joined: Feb 19, 2001
Posts: 26
Thanks a lot for ur ans. To worked!!! can u please ans this query.
I want to set the value of a textfield in the html form to a variable obtained from the applet. This should happen on the click event of a button in the applet.In short i want to refer to a textfield in html(that contains the applet) page from the applet
Originally posted by Bodie Minster:
[B]This question would be great for the HTML/JavaScript forum. This is how you do it:
1) The function and class that you want to access must be declared public.
2) The Applet [b]must[b] finish loading before it can be accessed.
3) In your HTML, provide a name for the Applet by using the name attribute of the <APPLET> tag.
4) Access your applet's methods using the applet object of JavaScript.
For example, if I have an applet with a public function called setTextboxText(String s), I can access that function as follows:

That should do it for you. HTH
[This message has been edited by Bodie Minster (edited March 08, 2001).][/B]

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTML to Applet
 
Similar Threads
Doubt with the communication of applet with page in jsp
gridbaglayout
Please help me for Applet Communications!
Applet to Applet communication
CALLING RAUKAUTAM SANDEEP,ANGELA