Win a copy of Pragmatic AI this week in the Artificial Intelligence 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

How to insert java code in Static HTML page ?  RSS feed

 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wile we acess any website, web server renders static web page. On this web page we see advertisement. If we click on that ad window we go to linked page. This gui is, say, applet or swing gui. This gui requires java coding to be inserted in static page. How does an HTML page take java coding. Is there any specific tag defined in HTML ? if not then how is this kind of gui inserted in static HTML page ?

Thanks 4 reply
 
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by jignesh soni:
Wile we acess any website, web server renders static web page. On this web page we see advertisement. If we click on that ad window we go to linked page. This gui is, say, applet or swing gui. This gui requires java coding to be inserted in static page. How does an HTML page take java coding. Is there any specific tag defined in HTML ? if not then how is this kind of gui inserted in static HTML page ?

Thanks 4 reply



Thats what we call as APPLETs in java. which uses <APPLET> tag. Inside that tag you have to provide your class file

Example:


For further study use this link
APPLET LINK
[ December 16, 2007: Message edited by: Balasubramanian Chandrasekaran ]
 
jignesh soni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bala. We can insert applets in HTML page with<APPLET> tag. But can we insert Swing or AWT in <APPLET> tag ?
 
jignesh soni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bala. We can insert applets in HTML page with <APPLET> tag. But can we insert Swing or AWT in <APPLET> tag ? Does <Applet> tag accept Swing or AWT ? If not, how can Swing or AWT be displayed on a web page ?

Thanks
 
Author and ninkuma
Marshal
Posts: 66789
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by jignesh soni:
how can Swing or AWT be displayed on a web page ?


It can't. Applets are your only option.
 
jignesh soni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That means, Swing and AWT are useful for standalone applications only ?
So how much is Swing or AWT is being used now a days ? what kind of applications use Swing or AWT ?
 
jignesh soni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That means, Swing and AWT are useful for standalone applications only ?
So how much is Swing or AWT is being used now a days ? what kind of applications use Swing or AWT ?
 
Rancher
Posts: 42975
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applets consist largely of AWT or Swing code; they use the same GUI components and concepts that standalone applications use. What Bear meant was that you can't use those GUI classes directly in a web page without having an Applet of some kind.
 
jignesh soni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf.
I was going through an example (public class SimpleGUI) using Swing, in Head First Java book. In that example, Applet was never used. So you mean to say that if I want to display that class in web page, then I can extend Applet (public class SimpleGUI extends Applet) and I can use it in web page. Otherwise, I can use it in a standlone application. Right ?
Pls correct, if I my understanding is not right.

Another question, what makes AWT component heavy weight and Swing component light weight ?
Thanks.
 
Ulf Dittmer
Rancher
Posts: 42975
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, extending Applet (if you want to use AWT) or JApplet (if you want to use Swing) is the way to go.
 
jignesh soni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for explanation.
What makes AWT heavy weight component an Swing light weight component
 
Ulf Dittmer
Rancher
Posts: 42975
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

What makes AWT heavy weight component an Swing light weight component


This really has nothing to do with the original question. In the future please start a new topic for a new question.

This particular question has been asked numerous times; a quick search using the old posts using the "Search" link at the top of the page finds numerous discussions.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!