|
-
November 11th, 2000, 06:59 AM
#1
Swinf in the html file
I wana a browse a swing applet in the html file i use to write
<HTML>
<BODY>
<Applet code=TJApplet width=200 height=100>
</Applet>
</BODY>
</HTML>
and my source code of the class is :
//Listing 2.2 Swing Applet with a Matte Border (TJApplet.java)
// Demonstrates the Swing applets
/*
* <Applet code=TJApplet width=200 height=100>
* </Applet>;
*/
import javax.swing.*;
import java.awt.*;
public class TJApplet extends JApplet {
public void init() {
JOptionPane.showMessageDialog(null,"text","test",2);
// 1. Get a reference to the content pane of the applet.
Container contentPane = getContentPane();
// 2. Create a label with an icon and text.
JLabel label = new JLabel("This is a Swing applet", // text
new ImageIcon("Metal.gif"), // icon
JLabel.CENTER); // horiz. position
// 3. Assign a matte border by using an icon and the specified insets.
label.setBorder(BorderFactory.createMatteBorder(
10, // top inset
10, // left inset
10, // bottom inset
10, // right inset
new ImageIcon("border.gif"))); // border icon
// 4. Add the label to the applet's content pane.
contentPane.add(label);
setVisible(true);
}
}
I don't know why it's not working
Help me please
-
November 17th, 2000, 01:05 PM
#2
Re: Swinf in the html file
You will have to use 'object' and 'embed' instead of 'Applet' tag.
See appletviewer help in ur JDK1.2 documentation.
- UnicMan
http://members.tripod.com/unicman
-
November 17th, 2000, 02:24 PM
#3
Re: Swing in the browser/ html file
You don't say what the error is. I guess it's that the browser doesn't have the swing classes. If that's the case, you need to convert your HTML to use the java plugin which has the newer java classes. The Sun site has a free download of an HTMLConversion program that will do it.
Good luck
Norm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|