Can someone write this code for me. I have a general idea of how to start but my knowledge of Java is limited.?
-
1. Start by creating your EmailDriver class. This class contains a single method — main() — which has one line of code, to create a new EmailClient object. 2. Next, define your EmailClient class. This class implements the ActionListener interface, and has a total of three methods: a constructor, a setupGUI() method (which does most of the work), and an actionPerformed() method (which does the rest of the work). You will need to import three Java libraries for this class: java.awt.*; java.awt.event.*; javax.swing.*; The rest of the steps that follow pertain to the EmailClient class. You should not need to make any further changes to EmailDriver. The steps below assume that you are using the same variable names as in the UML diagram. 3. Using the UML diagram at the end of this document as a guide, declare all the instance variables that your EmailClient class will need. Pay attention to the type of each variable. Most of them are corresponding JTextField and JLabel pairs. 4. The EmailClient() constructor requires exactly one line of code: to call the setupGUI() method. 5. Begin setupGUI() by setting window to point to a new JFrame to display your program’s main (and only) window. The window title should be “Compose Message”. Set it to a starting size of 400 pixels by 500 pixels. 6. Next, set up the JLabel/JTextField pairs for each text entry field. For each pair, create a new JPanel and add the label and text field to that panel. Then add that panel to the main window. Each text field should have a width of 20 columns. For example, here is the code for the “from” pair: fromLabel = new JLabel(“From:”); fromField = new JTextField(20); JPanel fromPanel = new JPanel(); fromPanel.add(fromLabel); fromPanel.add(fromField); window.add(fromPanel); 7. Repeat Step 6 for each of the remaining fields. For the last field (message body), use a JTextArea instead, with 10 rows and 20 columns. Be sure to call setLineWrap(true) on the message body’s JTextArea. 8. Create two appropriately-labelled JButtons and assign them to sendButton and clearButton, respectively. For each button, be sure to call addActionListener(this). Otherwise, your buttons won’t correctly trigger a response when they are clicked. 9. Create a new JPanel for the buttons, add them, and then add the JPanel to window. 10.Finally, call window.setVisible(true), to display the program’s window to the user. This completes the setupGUI() method (at last!). 11.Add the actionPerformed() method to your class so that it will compile. We will complete it in the next few steps. actionPerformed() has the following header: public void actionPerformed (ActionEvent a) 12.Try running your program to make sure that it works. Notice that you can type in the text fields, but nothing happens when you click either of the two buttons. We are about to fix this. 13.The last piece of the program is to complete actionPerformed() so that the buttons do something when you click them. Start by extracting the label of the button that was clicked: String message = a.getActionCommand(); 14.Now use an if-else statement to decide what to do based on the value of the message variable: if (message.equals(“Clear”)) ... else
-
Answer:
The description seems to be quite thorough, though incomplete. There is also a missing UML diagram which is key to the writing of the code. Just get on with following the instructions. You never know it might not be so difficult. Have fun.
Sunbeam at Yahoo! Answers Visit the source
Other answers
What don't you understand? not much point in just giving the code, since you wont learn anything that way. What did you write so far? maybe if u give us what u have so far, we can give you some pointers
Baatus
Related Q & A:
- Can Someone Write me a SESTINA?Best solution by Yahoo! Answers
- Where can I purchase a general gift card?Best solution by Yahoo! Answers
- How do I market a great idea?Best solution by Yahoo! Answers
- I need a creative idea for a board game.Best solution by Yahoo! Answers
- Where can I buy a G-pen and how much are they?Best solution by ChaCha
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.