Ich habe einige Probleme bei meinem Quelltext:
Folgende Ausrufezeichen zeigt mir Eclipse an und ich versteh nicht recht was es von mir will
:
4: The import java.applet is never used
10: The serializable class wuerfel1 does not declare a static final serialVersionUID field of type long
18: The static field Label.CENTER should be accessed in a static way
Und das vierte Problem sieht man hier
Warum zum henker macht mir meine AppletViewer zwei Fenster ich wollte doch nur eines ?
Code:
package Wuerfel;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class wuerfel1 extends java.applet.Applet{
Frame f;
Button b;
Label l;
int Zufallszahl, nochmal;
public void init(){
f = new Frame();
b = new Button("würfeln");
l = new Label("Bitte Würfeln", l.CENTER);
}
public void start(){
f.setTitle("Würfel");
f.setSize(300,100);
f.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
}
);
f.setLayout(new GridLayout(2,1));
f.add(l);
f.add(b);
b.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e){
Zufallszahl = (int)((Math.random()*6)+1);
l.setText(Zufallszahl+"");
}
}
);
f.setVisible(true);
}
public void stop(){
}
public void destroy(){
}
}
Folgende Ausrufezeichen zeigt mir Eclipse an und ich versteh nicht recht was es von mir will
4: The import java.applet is never used
10: The serializable class wuerfel1 does not declare a static final serialVersionUID field of type long
18: The static field Label.CENTER should be accessed in a static way
Und das vierte Problem sieht man hier

Warum zum henker macht mir meine AppletViewer zwei Fenster ich wollte doch nur eines ?