Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Obtaining Values from an Applet in Web Page

 
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.
 
Desperado
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
 
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.
 
Looky! I'm being abducted by space aliens! Me and this tiny ad!
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!