Newsgroup: it.comp.java
Titolo: Need help on JAVA

Hi All.
    I am new in Java Language, I follow the instruction of Borland
JBuilder to write the Java named "Hello World"
    When I finished and run the file, there is an error (21)"Class
Applet not found in class Hello.Hello."
    May I have the help on solving it? Thanks for consideration.
    Files: Hello.Hello.html
             Hello.html
             Hello.java
             HelloFrame.java
             HelloFrame_AboutBox.java
    Content:
        Hello.java[*Error at line 21]
//Title:       HelloWorld
//Version:
//Copyright:   Copyright (c) 1998
//Author:      CyberSonic
//Company:     CyberSonic Production
//Description: Your description
//Title:      HelloWorld
//Version:
//Copyright:  Copyright (c) 1998
//Author:     CyberSonic
//Company:    CyberSonic Production
//Description:Your description
package Hello;
import com.sun.java.swing.UIManager;
import java.awt.*;
//import com.sun.java.swing.UIManager;
public class Hello extends Applet {
<--------------------*Error Occurs**
  XYLayout xYLayout1 = new XYLayout();
  boolean isStandalone = false;
  String test_var;
//Get a parameter value
  public String getParameter(String key, String def) {
    return isStandalone ? System.getProperty(key, def) :
      (getParameter(key) != null ? getParameter(key) : def);
  }
  //Construct the applet
  public Hello() {
  }
//Initialize the applet
  public void init() {
    try { test_var = this.getParameter("test", ""); } catch (Exception
e) { e.printStackTrace(); }
    try {
    jbInit();
    }
    catch (Exception e) {
    e.printStackTrace();
    }
  }
  //static {
  //  try {
  //    //UIManager.setLookAndFeel(new
com.sun.java.swing.plaf.metal.MetalLookAndFeel());
  //    //UIManager.setLookAndFeel(new
com.sun.java.swing.plaf.motif.MotifLookAndFeel());
  //    UIManager.setLookAndFeel(new
com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
  //  }
  //  catch (Exception e) {}
  //}
//Component initialization
  private void jbInit() throws Exception {
    xYLayout1.setWidth(400);
    xYLayout1.setHeight(300);
    this.setLayout(xYLayout1);
  }
//Start the applet
  public void start() {
  }
//Stop the applet
  public void stop() {
  }
//Destroy the applet
  public void destroy() {
  }
//Get Applet information
  public String getAppletInfo() {
    return "Applet Information";
  }
//Get parameter info
  public String[][] getParameterInfo() {
    String pinfo[][] =
    {
      {"test", "String", ""},
    };
    return pinfo;
  }
//Main method
  public static void main(String[] args) {
    Hello applet = new Hello();
    applet.isStandalone = true;
    DecoratedFrame frame = new DecoratedFrame();
    frame.setTitle("Applet Frame");
    frame.add(applet, BorderLayout.CENTER);
    applet.init();
    applet.start();
    frame.setSize(400,320);
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation((d.width - frame.getSize().width) / 2, (d.height -
frame.getSize().height) / 2);
    frame.setVisible(true);
  }
}

 
Is this supposed to be a applet or a application. If
you want an applet.
Maybe this will work.
 
import java.applet.Applet;  is missing.
 
Or try erasing the package reference.
   -**** Posted from remarQ, Discussions Start Here(tm) ****-
http://www.remarq.com/
 - Host to the the World's Discussions & Usenet