allora ho inserito il mio applet java nella home page in questo modo:
codice:
<HTML>
<HEAD>
<TITLE>Contatore punti freccette</TITLE>
</HEAD>
<BODY>
<H2>Contatore freccette</H2>
<APPLET CODE="/FreccettePC/build/classes/freccettepc/Freccette.classes"
WIDTH=600 HEIGHT=300 ALIGN=LEFT>Freccette!</APPLET>
</BODY>
</HTML>
il codice invece dell'applet è :
codice:
package freccettepc;
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
/**
*
* @author francesco
*/
public class Freccette extends Applet implements ActionListener{
TextField t1=new TextField("301");
TextField tt1=new TextField();
TextField t2=new TextField("301");
TextField tt2=new TextField();
TextField t3=new TextField("301");
TextField tt3=new TextField();
TextField t4=new TextField("301");
TextField tt4=new TextField();
Button ok1=new Button("OK");
Button ok2=new Button("OK");
Button ok3=new Button("OK");
Button ok4=new Button("OK");
public void init() {
setLayout(new GridLayout(5,4,30,50));
add(new Label("Nome Giocatore"));
add(new Label("Punteggio totale"));
add(new Label("Ultimo tiro"));
add(new Label ("Premi OK"));
add(new Label("Giocatore 1"));
add(t1);
add(tt1);
ok1.addActionListener(this);
add(this.ok1);
add(new Label("Giocatore 2"));
add(t2);
add(tt2);
ok2.addActionListener(this);
add(this.ok2);
add(new Label("Giocatore 3"));
add(t3);
add(tt3);
ok3.addActionListener(this);
add(this.ok3);
add(new Label("Giocatore 4"));
add(t4);
add(tt4);
ok4.addActionListener(this);
add(this.ok4);
}
public void actionPerformed(ActionEvent e){
Button premuto=(Button) e.getSource();
if (premuto==ok1)
celle(t1,tt1);
else if (premuto==ok2)
celle(t2, tt2);
else if (premuto==ok3)
celle(t3,tt3);
else if (premuto==ok4)
celle(t4,tt4);
}
public int totTiro (int a){
int array[];
array=new int[3];
int somma=0;
for (int i=0;i<3;i++){
array[i]=a%100;
a=a/100;
}
for (int i=0;i<3;i++){
somma+=array[i];
}
return somma;
}
public void celle (TextField t,TextField tt){
int c,a=0,b=0,risultato=0;
a=Integer.parseInt(t.getText());
b=Integer.parseInt(tt.getText());
c=totTiro(b);
if (a<c) {
tt.setText("non valido");
}
else{
risultato=a-c;
t.setText(""+risultato);
tt.setText("");
}
}
}
e l'errore che mi da la console è questa quando apro la pagina:
codice:
caricamento: classe /FreccettePC/build/classes/freccettepc/Freccette.classes non trovata.
java.lang.ClassNotFoundException: .FreccettePC.build.classes.freccettepc.Freccette.classes
at sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:252)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Plugin2ClassLoader.java:249)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:179)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plugin2ClassLoader.java:690)
at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:3045)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1497)
at java.lang.Thread.run(Thread.java:680)
Eccezione: java.lang.ClassNotFoundException: .FreccettePC.build.classes.freccettepc.Freccette.classes
che devo fare????
l'applet se la faccio partire da netbeans funziona a meraviglia..