
Hello, I sound like every other newbie but I desperately need help. I have to write an application for the WebBuy Company that allows a user to compose the three parts of a complete email message: the "To", "Subject", and "Message:" text. The "To" and "Subject:" text areas should provide a single line for data entry. The "Message:" area should allow multiple lines of input and be able to scroll if necessary to accommodate a long message. The user clicks a button to send the email message. When the message is complete and the a send button is clicked, the application displays "Mail has been sent!" on a new line in the message area. I then save the files as JEmauil.java. This is what the code is that I have and it shows what I am missing. I would be indebted if someone could help me:
//Insert missing code here.
import java.awt.*;
import java.awt.event.*;
public class JEMail extends JFrame implements ActionListener
{
//Insert missing code here.
private JTextField toField = new JTextField(24);
private JLabel subjectLabel = new JLabel("Subject:");
private JTextField subjectField = new JTextField(24);
//Insert missing code here.
private JButton sendButton = new JButton("Send");
private JTextArea message = new JTextArea(4, 22);
public JEMail()
{
super("WebBuy Company E-Mail");
setSize(370, 270);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container pane = getContentPane();
FlowLayout flow = new FlowLayout(FlowLayout.RIGHT);
pane.setLayout(flow);
//Insert missing code here.
panel1.add(toLabel);
//Insert missing code here.
pane.add(panel1);
JPanel panel2 = new JPanel();
panel2.add(subjectLabel);
panel2.add(subjectField);
//Insert missing code here.
JPanel panel3 = new JPanel();
panel3.add(messageLabel);
message.setLineWrap(true);
message.setWrapStyleWord(true);
JScrollPane scroll = new JScrollPane(message,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
panel3.add(scroll);
//Insert missing code here.
JPanel panel4 = new JPanel();
panel4.add(sendButton);
pane.add(panel4);
sendButton.addActionListener(this);
//Insert missing code here.
}
public static void main(String[] arguments)
{
JEMail email = new JEMail();
//Insert missing code here.
}
public void actionPerformed(ActionEvent event)
{
Object source = event.getSource();
if (source == sendButton)
message.append("\nMail has been sent!");
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.