• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Applet to Javascript communication

 
Ranch Hand
Posts: 128
MS IE Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi:
I would like to know how I can pass data from my applet class to my java script html page. is it possible? i could call a method in my applet from the javascript, but is the reverse possible? Thanks
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Yes, that's possible. The technology you're loooking for is called LiveConnect, and the Applet FAQ has more detail on how it works.
 
Allen Bandela
Ranch Hand
Posts: 128
MS IE Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Dittmer.

I have a problem and I am confused as of how I should go about it.

I have to put up a textfield, a button and a list on my webpage. Should I do that with my applet class, implementing actionlistner interface for the button, or should I do it in java script and pass the text field data to my applet ( by getparameter()) for furthur processing using getparamter(). Which is better?

Being inclined to using an applet, is there a way I can put my text fields at the position I want them on my webpage by using the repaint() method?

Thank you
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure what you're trying to do, or whether a JavaScript/applet hybrid is the best way to go about it - why are you inclined to use an applet?

getParameter has nothing to do with LiveConnect. It picks up parameters from the applet tag, which can't be changed later.

paint/repaint draws in the applet. It can't position elements on the web page itself.
 
Allen Bandela
Ranch Hand
Posts: 128
MS IE Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I'm really trying to do is implement a search engine for my website. (I am not implementing an actual search engine though, only an index of keywords matched to certain parts of my website. )
I want to display a typical search box and a list to display the results. I wanted to do it in an applet, because I don't know about liveconnect and I have to use applet to parse the search keywords. I'm trying to figure out how I can use layout managers, maybe, to display my user interface at a particular position on my webpage.

Like if I wanted my user interface of the applet on the upper right, so as not to disturb the rest of the webpage, can I do it?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can position your applet wherever you want it, but that's an HTML issue. Wrap the applet tag inside a DIV, which you can style and position to your hearts content using CSS. Layout managers control how the various GUI elements of an applet are positioned inside the applet. An applet has no control over where it gets placed on a web page.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic