Hi,
das Problem hatte ich auch so, ich weiss leider nur noch, das ich oft probieren mußte bis es ging.
Hi erstmal meine HTML-Seite :
--------------------------------------------
<!-- @(#)Proj1.html-->
<html>
<head><title>Proj1 Applet</title></head>
<body>
<!--"CONVERTED_APPLET"-->
<!-- CONVERTER VERSION 1.2.2 -->
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = 500 HEIGHT = 400 codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0">
<PARAM NAME = CODE VALUE = proj1 >
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.2.2">
<PARAM NAME="scriptable" VALUE="false">
<COMMENT>
<EMBED type="application/x-java-applet;version=1.2.2" CODE = proj1 WIDTH = 500 HEIGHT = 400 scriptable=false pluginspage="http://java.sun.com/products/plugin/1.2.2/plugin-install.html"><NOEMBED></COMMENT>
</NOEMBED></EMBED>
</OBJECT>
<!--
<APPLET CODE = proj1 WIDTH = 500 HEIGHT = 400>
</APPLET>
-->
<!--"END_CONVERTED_APPLET"-->
</body>
</html>
--------------------------------------------
Und hier mein erstes Applet :
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.applet.*;
import javax.swing.*;
public class proj1 extends JApplet {
JButton button;
JButton button2;
JComboBox combo;
JTextField text;
public void init() {
// Force Project1 to come up in the System L&F
String laf = UIManager.getSystemLookAndFeelClassName();
try {
UIManager.setLookAndFeel(laf);
// If you want the Cross Platform L&F instead, comment out the above line and
// uncomment the following:
// UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
} catch (UnsupportedLookAndFeelException exc) {
System.err.println("Warning: UnsupportedLookAndFeel: " + laf);
} catch (Exception exc) {
System.err.println("Error loading " + laf + ": " + exc);
}
getContentPane().setLayout( null);
button = new JButton("Hello");
button.setLocation( 40, 30);
button.setSize( 100, 30);
getContentPane().add(button);
button2 = new JButton("Hello2");
button2.setLocation( 140, 30);
button2.setSize( 100, 30);
getContentPane().add(button2);
text = new JTextField();
text.setLocation( 40, 80);
text.setSize( 180, 30);
getContentPane().add(text);
combo = new JComboBox();
combo.setLocation( 40, 120);
combo.setSize( 180, 30);
combo.addItem("Entry #1");
combo.addItem("Entry #2");
combo.addItem("Entry #3");
combo.addItem("Entry #4");
combo.getAccessibleContext().setAccessibleName("Choice");
combo.getAccessibleContext().setAccessibleDescription("Choose a entry");
getContentPane().add(combo);
}
public void stop() {
if (button != null) {
getContentPane().remove(button);
getContentPane().remove(button2);
button = null;
button2 = null;
}
}
}
--------------------------------------------
Denke auch an die Groß/Kleinscheibung im HTML. Auch muss der Klassenname identisch mit dem Dateinamen sein !!!
...yks