Which compiler is needed for the following code?

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;

public class Main extends JApplet implements ActionListener{

	JTextField firstNameArea;
	JTextField lastNameArea;
	JTextField emailField;
	JTextField phoneNumber;
	JCheckBox myselfBox;
	JCheckBox someoneBox;
	JTextArea messageArea;
	
	
	public void init (){
		setSize (250,300);
		setLayout (new BorderLayout ());
		
		
		JPanel insidePane = new JPanel ();
		firstNameArea = new JTextField(15);
		lastNameArea = new JTextField (15);
		insidePane.setLayout (new GridLayout (7,2));
		insidePane.add (new JLabel ("First Name"));
		insidePane.add (firstNameArea);
		insidePane.add (new JLabel ("Last Name"));
		insidePane.add (lastNameArea);
		JButton sendButton = new JButton ("Send"); sendButton.setActionCommand ("Send Mail"); sendButton.addActionListener (this);
		emailField = new JTextField (15);
		insidePane.add (new JLabel ("Email"));
		insidePane.add (emailField);
		phoneNumber = new JTextField (15);
		insidePane.add (new JLabel ("Phone"));
		insidePane.add (phoneNumber);
		insidePane.add (new JLabel ("I am requesting "));
		myselfBox = new JCheckBox("Myself");
		someoneBox = new JCheckBox("Someone");
		insidePane.add (new JLabel ("this information for"));
		insidePane.add (new JLabel ());
		insidePane.add (myselfBox);
		insidePane.add (new JLabel ());
		insidePane.add (someoneBox);
		add (insidePane, BorderLayout.NORTH);
		
		JPanel messagePanel = new JPanel (new BorderLayout ());
		messageArea = new JTextArea (5,10);
		JScrollPane scrollPanel = new JScrollPane (messageArea);
		messagePanel.add (new JLabel ("Message"), BorderLayout.NORTH);
		messagePanel.add(scrollPanel, BorderLayout.CENTER);
		messagePanel.add(sendButton, BorderLayout.SOUTH);
		add (messagePanel, BorderLayout.CENTER);
		
		
		
	}
	
	public void actionPerformed (ActionEvent e){
		
		if (e.getActionCommand ().equals("Send Mail")){
			if (validEmailCheck (emailField.getText ())){
				if (validPhoneCheck (phoneNumber.getText())){
					if (oneBoxChecked ()){
						if (firstNameArea.getText() != null){
							if (lastNameArea.getText() != null){
								if (messageArea.getText() != null){
									sendMessage ();
								}
								else {
									JOptionPane.showMessageDialog(null, "Please Insert a Message");
								}
							}
							else {
								JOptionPane.showMessageDialog(null, "Please Insert Your Last Name");
							}
						}
						else {
							JOptionPane.showMessageDialog(null, "Please Insert Your First Name");
						}
					}
					else {
						JOptionPane.showMessageDialog(null, "Please select who you are writing for");
					}
					
				}	
				else {
					JOptionPane.showMessageDialog(null, "Please Enter a valid phone number (no dashes (-))");
				}
			}
			else {
				JOptionPane.showMessageDialog(null, "Please Insert a valid Email");
			}
			
		}
	
	}

	private void sendMessage() {
		// TODO Auto-generated method stub
		String to = "email@my-domain.com";
		String from = emailField.getText();
		String host = "http://webmail.sitegroundNUM.com/";
		
		Properties props = new Properties();
		
		 // If using static Transport.send(),
        // need to specify which host to send it to
        props.put("mail.my-domain.com:465", host);
        // To see what is going on behind the scene
        props.put("mail.debug", "true");
        Session session = Session.getInstance(props);

        try {
            // Instantiate a message
            Message msg = new MimeMessage(session);

            //Set message attributes
            msg.setFrom(new InternetAddress(from));
            InternetAddress[] address = {new InternetAddress(to)};
            msg.setRecipients(Message.RecipientType.TO, address);
            msg.setSubject("Email from" + firstNameArea.getText() + " " + lastNameArea.getText());
            msg.setSentDate(new Date());

            // Set message content
            msg.setText("Phone:" + phoneNumber.getText() + "\n" + messageArea.getText());

            //Send the message
            Transport.send(msg);
        }
        catch (MessagingException mex) {
            // Prints all nested (chained) exceptions as well
            mex.printStackTrace();
        }
		
	}

	private boolean oneBoxChecked() {
		// TODO Auto-generated method stub
		if (((myselfBox.isSelected()) || (someoneBox.isSelected())) || (myselfBox.isSelected() && someoneBox.isSelected())){
			return true;
		}
		else if (!myselfBox.isSelected() && !someoneBox.isSelected()){
			return false;
		}
		return false;
		
		
	}

	private boolean validPhoneCheck(String text) {
		// TODO Auto-generated method stub
		char [] phone = text.toCharArray();
		int trueCounter = 0;
		
		if (text.toCharArray().length == 10){
			for (int i = 0; i < 10; i++){
				checkIfValidNumbers (phone[i]);
				if (true){
					trueCounter += 1;
				}	
			}
		}
		if (trueCounter == 10){
			return true;
		}
		else {
		return false;
		}
	}

	private boolean checkIfValidNumbers(char c) {
		// TODO Auto-generated method stub
		switch (c){
		case 0:
			return true;
		case 1:
			return true;
		case 2:
			return true;
		case 3:
			return true;
		case 4:
			return true;
		case 5:
			return true;
		case 6:
			return true;
		case 7:
			return true;
		case 8: 
			return true;
		case 9:
			return true;
		default:
			return false;
		}
	}

	private boolean validEmailCheck(String text) {
	// TODO Auto-generated method stub
		
		
		char[] email = text.toCharArray();
		for (int i = 0; i < email.length; i++){
			if (email[i] == '@'){
				return true;
			}
		}
		return false;
	}
	
	
}

Please give me some instractions for running it.

1) I dont know about the least but it will easily run over JDK 1.6.
2) It has Javax.mail api which is optional in JAVASE but is included in JAVAEE 5

@Onlineshade

What do you mean by which compiler.?
Since it is a java code , you need java compiler..

What do you mean by which compiler.?
Since it is a java code , you need java compiler..

I know that a java code needs a Java compiler.How to run it in Java compiler?

It has Javax.mail api which is optional in JAVASE but is included in JAVAEE 5

How can I start this? Actually I want to say that how can I run this program. I only know about" .java" project.
Please give me some instraction.

I think u made new id after getting banned onlineshade... Still i dont have any concernd with it...
If you want to run this application then u must have java ee configured or with java se u have to download api regarding to javax.mail from oracle website and provide the application at buildpath...

I think u made new id after getting banned onlineshade... Still i dont have any concernd with it...

Sorry! do not understand your comment.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.