Newsgroup: it.comp.java
Titolo: Vi sembra esatto?

Sto cercando di convertire un applet dalla versione 1.1 alla versione 2 di
Java, insomma
questo è il pezzo di codice riscritto ma quando lancio la pagina web la
risposta è
class GraphAlgorithm non trovata ... come si spiega.
public class GraphAlgorithm extends JApplet {
    GraphCanvas graphcanvas = new GraphCanvas(this);    /* su questo
componente devo disegnare qualcosa, prima veniva usato il Canvas */
     Options options = new Options(this);
     Documentation documentation = new Documentation();
   public void init() {
     Container contentPane = getContentPane();
     contentPane.setLayout(new BorderLayout(10, 10));
     contentPane.add(graphcanvas, BorderLayout.CENTER);
     contentPane.add(options, BorderLayout.EAST);
     contentPane.add(documentation, BorderLayout.NORTH);
    }
    public void lock() {
 graphcanvas.lock();
 options.lock();
    }
    public void unlock() {
 graphcanvas.unlock();
 options.unlock();
    }
}
class Options extends JPanel {
// opzioni sulla destra dello schermo
    JButton b1 = new JButton("clear");
    JButton b2 = new JButton("run");
    JButton b3 = new JButton("step");
    JButton b4 = new JButton("reset");
    JButton b5 = new JButton("example");
    JButton b6 = new JButton("exit");
    GraphAlgorithm parent;
    boolean Locked=false;
    Options(GraphAlgorithm myparent) {
 parent = myparent;
 Container contentPane = getContentPane();
 contentPane.setLayout(new GridLayout(6, 1, 0, 10));
 contentPane.add(b1);
 contentPane.add(b2);
 contentPane.add(b3);
 contentPane.add(b4);
 contentPane.add(b5);
 contentPane.add(b6);
    }
    public boolean action(Event evt, Object arg) {
 if (evt.target instanceof JButton) {
   if (((String)arg).equals("step")) {
      if (!Locked) {
         b3.setLabel("next step");
         parent.graphcanvas.stepalg();
      }
      else parent.documentation.doctext.showline("locked");
   }
   if (((String)arg).equals("next step"))
      parent.graphcanvas.nextstep();
   if (((String)arg).equals("reset"))
      parent.graphcanvas.reset();
      b3.setLabel("step");
      parent.documentation.doctext.showline("all items");
   }
   if (((String)arg).equals("clear"))
      parent.graphcanvas.clear();
      b3.setLabel("step");
      parent.documentation.doctext.showline("all items");
   }
   if (((String)arg).equals("run")) {
      if (!Locked)
         parent.graphcanvas.runalg();
      else parent.documentation.doctext.showline("locked");
   }
   if (((String)arg).equals("example")) {
      if (!Locked)
         parent.graphcanvas.showexample();
      else parent.documentation.doctext.showline("locked");
   }
   if (((String)arg).equals("exit"))
      System.exit(0);
   }
 }
 return true;
    }
    public void lock() {
 Locked=true;
    }
    public void unlock() {
 Locked=false;
 b3.setLabel("step");
    }
}
class Documentation extends JPanel {
    DocOptions docopt = new DocOptions(this);
    DocText doctext = new DocText();
    Documentation() {
     Container contentPane = getContentPane();
      contentPane.setLayout(new BorderLayout(10, 10));
      contentPane.add(docopt, BorderLayout.WEST);
      contentPane.add(doctext, BorderLayout.CENTER);
    }
}
class DocText extends JTextArea {
...
...
...
    DocText() {
     super(5, 2);
     setText(doc);
  }
}
    public void showline(String str) {
 if (str.equals("draw nodes"))              setText(drawnodes);
 else if (str.equals("remove nodes"))       setText(rmvnodes);
 else if (str.equals("move nodes"))         setText(mvnodes);
 else if (str.equals("the startnode"))      setText(startnode);
 else if (str.equals("draw arrows"))        setText(drawarrows);
 else if (str.equals("change weights"))     setText(weight);
 else if (str.equals("remove arrows"))      setText(rmvarrows);
 else if (str.equals("clear / reset"))      setText(clrreset);
 else if (str.equals("run algorithm"))      setText(runalg);
 else if (str.equals("step through"))       setText(step);
 else if (str.equals("example"))            setText(example);
        else if (str.equals("exit"))               setText(exitbutton);
 else if (str.equals("all items"))          setText(doc);
 else if (str.equals("toclose"))            setText(toclose);
 else if (str.equals("done"))               setText(done);
 else if (str.equals("locked"))             setText(locked);
 else if (str.equals("maxnodes"))           setText(maxnodes);
        else if (str.equals("none"))               setText(none);
        else if (str.equals("some"))               setText(some);
 else setText(str);
    }
}
Fatemi sapere please ...

 wrote in message
news:yxOz7.10817$V75.2...@news1.tin.it...
