Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Obtaining Values from an Applet in Web Page

 
Craig Chariton
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is possible to have an applet return a value to an HTML document? I want to have an applet slider return a value that may be stored in a form field.
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is an interesting question and I probably would have been able to answer it with confidence about 2.5 years ago. Sorry! But from what I remember, I doubt it. But don't take my word for it! Maybe in Java 2?
I did applets first (who didn't when Java was new!?)
I remember my "slider" applet which is still in:
http://www.geocities.com/tony-alicea/SineTest.html
It's there for those students that would like to see the difference between double buffering and single (in the Java AWT Graphics context). The complete source code is available, BTW.
However, I think that with the speed of todays PC it will not be as noticeable. I wrote the applet on a 133 MHz Pentium. But Java books still mention today the double buffering technique. It's part of Graphics 101 in Java
 
Gary McClelland
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You asked:
Is it possible to have an applet return a value to an HTML document? I want to have an applet slider return a value that may be stored in a form field.
I don't know about getting a slider value back to the HTML form. However, it is relatively easy to do a form POST or GET from within the applet. The usual HTML form elements have counterparts in Java. So I just put the whole form in an applet (ask whatever text and checkbox questions I need) and then get slider and similar kinds of data that are difficult if not impossible to get from the usual HTML form. For an example, see
http://samiam.colorado.edu/~mcclella/graphs/tbar.html
It is for an experiment on statistical graphics but you'll get the idea even if you don't know much about statistics. After all the pages, the POST is made to a cgi script back on the server. There is good material elsewhere on JavaRanch on how to do this.
[This message has been edited by Gary McClelland (edited January 04, 2001).]
[This message has been edited by Gary McClelland (edited January 04, 2001).]
 
Gary McClelland
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony added a note about double buffering:
However, I think that with the speed of todays PC it [flickering] will not be as noticeable. I wrote the applet on a 133 MHz Pentium. But Java books still mention today the double buffering technique. It's part of Graphics 101 in Java
single buffered applets still flicker even with faster computers. I could never understand why double buffering wasn't just a part of the AWT. Double buffering IS done by default in swing components.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic