This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to insert java code in Static HTML page ?

 
jignesh soni
Ranch Hand
Posts: 154
  • 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
 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser VI Editor Linux
  • 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: 154
  • 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: 154
  • 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
 
Bear Bibeault
Marshal
Posts: 67420
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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: 154
  • 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: 154
  • 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 ?
 
Ulf Dittmer
Rancher
Posts: 43016
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: 154
  • 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: 43016
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: 154
  • 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: 43016
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.
 
please buy my thing and then I'll have more money:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic