I've written my share of applets but I've never really done very much in the
way of interacting with an applet via the HTML on the page containing the
applet. I'm hoping someone can suggest a way to accomplish what I want to
do.
I'm helping a friend who needs a Java applet for his website. He wants to
display a page containing a paragraph or two of English. Some of the words
in the paragraphs will be ones that people may not know how to pronounce so
he wants visitors to the page to be able to click on the word and have an
applet play a sound file that illustrates the proper pronunciation. So, if
the paragraph was "One of the most visited spots in London is the Leicester
Square, which is located some distance from Beaulieu Wood.", the person
clicking on "Leicester" would hear the applet say "Lester" and the person
clicking on "Beaulieu" would hear the applet say "Bewley".
I've already got code that will play the a sound file so I don't need help
with that. However, I'm not sure how to organize things so that I can have a
single occurrence of the applet on the page and make a click on a given word
in the paragraph invoke the playing of the proper audio file in the applet.
I realize that it would be simpler to make a separate instance of the applet
for each word that needs to be pronounced and I'm willing to do that if it
becomes necessary but I'm hoping someone can suggest an elegant way for the
applet to simply play the sound corresponding to the word clicked.
Any ideas how I can do what I want to do?

Signature
Rhino
zero - 29 Jan 2006 14:57 GMT
> I've written my share of applets but I've never really done very much
> in the way of interacting with an applet via the HTML on the page
[quoted text clipped - 7 lines]
> the word and have an applet play a sound file that illustrates the
> proper pronunciation.
<snip>
> Any ideas how I can do what I want to do?
I would suggest you don't use an applet at all, but instead use raw html,
or maybe JavaScript. Make the words that are clickable links to a sound
file (or JavaScript code that plays a sound file). I think it would be
easier to code, easier to understand for the users, and a hell of a lot
easier to maintain.
Roedy Green - 29 Jan 2006 15:25 GMT
> would suggest you don't use an applet at all, but instead use raw html,
>or maybe JavaScript. Make the words that are clickable links to a sound
>file (or JavaScript code that plays a sound file). I think it would be
>easier to code, easier to understand for the users, and a hell of a lot
>easier to maintain.
see http://mindprod.com/esperanto/esounds.html
for a example of that technique.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Roedy Green - 29 Jan 2006 15:16 GMT
On Sun, 29 Jan 2006 09:06:58 -0500, "Rhino"
<no.offline.contact.please@nospam.com> wrote, quoted or indirectly
quoted someone who said :
>I'm helping a friend who needs a Java applet for his website. He wants to
>display a page containing a paragraph or two of English. Some of the words
[quoted text clipped - 5 lines]
>clicking on "Leicester" would hear the applet say "Lester" and the person
>clicking on "Beaulieu" would hear the applet say "Bewley".
the easy way to do that is with an applet that displays the word. When
you click it, it pronounces it. that would work fine if there are
just a few words per page to deal with. You might want to use static
html macros to generate the <applet tags. That is how I do CurrCon to
display variable currencies on a page. You change the country and
instantly the whole pages converts to that currency. The applets
inform each other of any changes they detect.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Roedy Green - 29 Jan 2006 15:24 GMT
On Sun, 29 Jan 2006 09:06:58 -0500, "Rhino"
<no.offline.contact.please@nospam.com> wrote, quoted or indirectly
quoted someone who said :
>I'm helping a friend who needs a Java applet for his website. He wants to
>display a page containing a paragraph or two of English. Some of the words
[quoted text clipped - 5 lines]
>clicking on "Leicester" would hear the applet say "Lester" and the person
>clicking on "Beaulieu" would hear the applet say "Bewley".
The hard way to do this is with DOM/LiveConnect/JavaScript
See http://mindprod.com/jgloss/dom.html
http://mindprod.com/jgloss/javascript.html
http://mindprod.com/jgloss/liveconnect.html
and chase links.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.