ho creato un applet.provandolo con appletviewer funziona bene ma quando lo carico sul sito mi da il seguente errore "errore lettura" (dovuto al catch).
mi potete aiutare?
il codice è il seguente:
ecc....codice:import java.awt.Graphics; import javax.swing.*; import java.awt.*; import java.awt.Component; import java.applet.*; import java.awt.event.*; import java.net.URL; import java.net.MalformedURLException; import java.io.*; public class app extends JApplet { TextField l,p; Label u; public void paint(Graphics g) { // sfondo applet g.setColor(Color.blue); g.fillRect(0, 0, 300, 100); } public void init() { Label a=new Label("Login:"); l=new TextField(20); Label b=new Label("Password:"); p=new TextField(20); Button bo=new Button("entra"); u=new Label(""); gestorePulsante bo1= new gestorePulsante(); bo.addActionListener(bo1); setSize(200,100); setLocation(100,100); setLayout(new GridLayout(3,2,10,10)); a.setBackground(Color.blue); a.setForeground(Color.yellow); b.setBackground(Color.blue); b.setForeground(Color.yellow); u.setBackground(Color.blue); u.setForeground(Color.yellow); add(a); add(l); add(b); add(p); add(bo); add(u); setVisible(true); } public void esegui() { int fine=0; int t2=0; String[] r= new String[5]; String login=l.getText(); r[0]=p.getText();//password caricata dall applet try{ FileReader in=new FileReader("o.java"); BufferedReader buffin=new BufferedReader(in); int i=1; boolean Eof=false; while(!Eof) { String riga=buffin.readLine(); r[i]=riga; if(riga==null) Eof=true; else i++; } buffin.close(); } catch(Exception e) { u.setText("errore lettura"); }

Rispondi quotando

