308holes
May 11th, 2002, 12:57 AM
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"
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();
}
}
"Could not Find Main Mothod Program will exit"
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();
}
}