[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 443
  • Last Modified:

how to run the swing program

hi .............
how to run any swing program through internet browser.
I have one html file through which i am trying to run swing program(j.java).but not getting display japplet (j.java)through internet.5 browser.
why?
i am getting error that j.class file is not found when the j.class file is there in same directory.why?

html file :
-------------------------------------------------------
<html>
<head>
<title>uuuuuuuuuuu</title></head>
<body>
<applet code="j.class" width=200 height=200>
</applet>
</body>
</html>
-------------------------------------------------------
j.java program :

import java.awt.*;
import javax.swing.*;
//<applet code="j.java" width=200 height=200></applet>
public class j extends JApplet
{
JTextField j;
public void init()
{
Container con =getContentPane();
con.setLayout(new FlowLayout());
j=new JTextField(15);
con.add(j);
}
}

kalpana
0
rkalpana
Asked:
rkalpana
2 Solutions
 
OviCommented:
Because is a Swing applet, and so you need to use the Java Plug-in
0
 
rrzCommented:
0
 
yongsingCommented:
You need to use the HTML converter to convert your applet tags to the format required by the Java Plug-in. You can get the converter from this site. It's actually quite simple.

http://java.sun.com/products/plugin/1.3/docs/html_converter.html
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
shyamkumarreddyCommented:
Hi kalpana

U can do 2 things now


1.   Include swingsall.jar in ur archive of applet tag
or
2.   Use Java plug-in and use Object or embed tags to run the applet.

Any of the solution will work out

Shyam
0
 
rjackmanCommented:
hi
including swingall.jar is not the better option because browser will try to downlaod the swing classes from swingall.jar so will take a quite along time
i think u should go for the HTML converter which will convert ur HTML code so that whenever u run such HTML in ur browser it will automatically invoke the plugin required for displaying the swingclasses
cheers
RJ
0
 
shyamkumarreddyCommented:
Hi

Since if the user is not interested in having a plugin then including swingall.jar is the solution right.

I talk in terms of including plug-in or without having plug-in.

is the solution i provided

Cheers
Shyam
0
 
sudhakar_koundinyaCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:


[split points between yongsing and rrz@871311]


Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
sudhakar_koundinya
EE Cleanup Volunteer
---------------------
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post your concern in THIS thread.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now