Results 1 to 8 of 8

Thread: Help!!

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2002
    Location
    USA
    Posts
    432

    Help!!

    Ok i have been messing with his in Jbuilder5 for 2 days and its not working at all im getting this error
    "Could not Find Main Mothod Program will exit"

    Code:
    package ButtonApplet;
    
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    
    public class ButtonApplet extends Applet implements ActionListener
    {
      //Declare components
      TextField txtDept = new TextField(15);
      TextField txtName = new TextField(20);
      TextField txtPhone = new TextField(5);
      TextArea txaPhoneList = new TextArea(10,30);
      Button btnAdd = new Button("Add to List");
      //Declares Var
      String strDept;
      String strName;
      String strPhone;
    
      public void init()
      {
        //Place components on Applet
    
        add(new Label("Department: "));
        add(txtDept);
        add(new Label("Name:       "));
        add(txtName);
        add(new Label("Extension:  "));
        add(txtPhone);
        add(btnAdd);
        add(txaPhoneList);
        txtDept.requestFocus();
    
        //Add Action Listeners
        btnAdd.addActionListener(this);
        txtDept.addActionListener(this);
        txtName.addActionListener(this);
        txtPhone.addActionListener(this);
    
      }
    
      public void actionPerformed(ActionEvent event)
      {
        //Action for "Add to List"
        //Triggered when the user click on the Button or press the Enter Key
        //in any Text Field
    
        String strOutPutLine;
    
        //Assign the Text Field to a Variable
        strDept = txtDept.getText();
        strName = txtName.getText();
        strPhone = txtPhone.getText();
    
        //Concatenate the Variables
        strOutPutLine = strDept + "\t" + strName + "\t" + strPhone;
        //Append the concatenated line to the phone list
        txaPhoneList.append(strOutPutLine + "\n");
    
        //Clears the Text Fields
        txtDept.setText("");
        txtName.setText("");
        txtPhone.setText("");
    
        //Set the Focus
        txtDept.requestFocus();
      }
    }

  2. #2
    Addicted Member
    Join Date
    Nov 2001
    Location
    Yewston, Texis
    Posts
    240
    Will your JBuilder5 compile a simple applet like this:

    Code:
    import javax.swing.*;
    import java.awt.*;
    
    public class Applet1 extends JApplet {
      public void init() {
        getContentPane().add(new JLabel("Applet!"));
      }
    }
    Also, have you tried compiling outside of JBuilder5 using the javac command on the commandline? Have you successfully compiled and run anything using JBuilder5?

    cudabean

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2002
    Location
    USA
    Posts
    432
    No same Error

  4. #4
    Addicted Member
    Join Date
    Nov 2001
    Location
    Yewston, Texis
    Posts
    240
    Y'know, it could be the case that JBuilder, for whatever reason, is not aware that it has an applet and instead is trying to execute it. Executing applets is usually not appropriate (sometimes it is, if you write the class to be a dual applet/application). I've not used JBuilder, but there's probably some compiler option that needs to be checked to tell JBuilder to handle your class as an applet at runtime.

    cudabean

  5. #5
    Addicted Member Mrs Kensington's Avatar
    Join Date
    Sep 2001
    Location
    Dorset, UK
    Posts
    144
    JCreator!!!!!!!!!!!!!!!!
    www.jcreator.com
    There is a free version available. It has no GUI creater but real men/women write gui's with notepad!
    Ford? Theres an infinite number of monkeys outside that want to talk to you about a script of hamlet they've produced!

  6. #6
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Well ...

    There's also Forte from sun microsystems and NetBeans from I think www.netbeans.org.

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2002
    Location
    USA
    Posts
    432
    JCreator works SOO MUCH BETTER THANKS !!!!

  8. #8
    joan_fl
    Guest
    Ok i have been messing with his in Jbuilder5 for 2 days and its not working at all im getting this error
    Check your project properties in the tab RUN. You'll see settings for application & applet. That should fix your problem in JBuilder.

    Joan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width