|
-
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
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
|