wood burning stoves 2.0*
The moose likes Applets and the fly likes How to insert java code in Static HTML page ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "How to insert java code in Static HTML page ?" Watch "How to insert java code in Static HTML page ?" New topic
Author

How to insert java code in Static HTML page ?

jignesh soni
Ranch Hand

Joined: Dec 10, 2007
Posts: 150
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

Joined: Nov 28, 2007
Posts: 215

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

Joined: Dec 10, 2007
Posts: 150
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

Joined: Dec 10, 2007
Posts: 150
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
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

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

It can't. Applets are your only option.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
jignesh soni
Ranch Hand

Joined: Dec 10, 2007
Posts: 150
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

Joined: Dec 10, 2007
Posts: 150
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
Marshal

Joined: Mar 22, 2005
Posts: 41101
    
  45
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.


Ping & DNS - my free Android networking tools app
jignesh soni
Ranch Hand

Joined: Dec 10, 2007
Posts: 150
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
Marshal

Joined: Mar 22, 2005
Posts: 41101
    
  45
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

Joined: Dec 10, 2007
Posts: 150
Thanks for explanation.
What makes AWT heavy weight component an Swing light weight component
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41101
    
  45
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to insert java code in Static HTML page ?
 
Similar Threads
insert/update in java web apps
NETBEANS provides GUI/DESIGN-VIEW for automatic designing forms in windows JFrames
What is the best method to learn JAVA?
how to convert the html file content to .txt file format
How to handle site if static data volume is big