|
-
May 11th, 2002, 12:57 AM
#1
Thread Starter
Hyperactive Member
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();
}
}
-
May 11th, 2002, 02:36 PM
#2
Addicted Member
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
-
May 11th, 2002, 03:14 PM
#3
Thread Starter
Hyperactive Member
-
May 11th, 2002, 05:08 PM
#4
Addicted Member
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
-
May 14th, 2002, 04:03 AM
#5
Addicted Member
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!
-
May 14th, 2002, 09:40 AM
#6
Well ...
There's also Forte from sun microsystems and NetBeans from I think www.netbeans.org.
.
-
May 15th, 2002, 01:49 AM
#7
Thread Starter
Hyperactive Member
JCreator works SOO MUCH BETTER THANKS !!!!
-
May 16th, 2002, 09:38 AM
#8
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|