Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Operation This application begins by displaying a table of customer data. If the

ID: 3577124 • Letter: O

Question

Operation

This application begins by displaying a table of customer data.

If the user clicks the Add button, the application allows the user to add customer data to the table (and the underlying database).

If the user selects a customer row and clicks the Edit button, the application allows the user to update the data for the selected customer row in the table (and the database).

If the user selects a customer row and clicks the Delete button, the application deletes the selected customer row from the table (and the database).

Specifications

Create a table in the mma database described in chapter 19 to store the necessary data. To do that, you can use the SQL script stored in the create_customer_table.sql file that’s supplied. If this script isn’t supplied, you can create your own SQL script.

Create a class named Customer that stores data for the user’s id, email address, first name, and last name.

Create a class named CustomerDB that contains the methods necessary to get an array list of Customer objects, to get a Customer object for the customer with the specified id, and to add, update, or delete the specified customer.

Create a CustomerManagerFrame class like the one shown above. This frame should display a table of customer data as well as the Add, Edit, and Delete buttons. This class should use the Customer and CustomerDB classes to work with the customer data.

Create a CustomerForm class that allows the user to add or edit customer data.

Create a Java Customer Management program with NetBeans that satisfies the specifications above.

Customer Manager Email frankiones nes@yahoo.com johnsmith@hotmail.com seagreen@levi.com wendyk@warners.com First Name Last Name Frank Jones John Smith Green Cynthia Wendy Kowolski Add Eidt Delete

Explanation / Answer

import java.awt.*;   
// Defines basic classes for GUI programming.
import java.awt.event.*;
   // Defines classes for working with events.
import java.applet.*;   
   // Defines the applet class.


/*<applet code="ColoredHelloWorldApplet" width=300 height=400>
</applet>
*/
public class ColoredHelloWorldApplet
extends Applet implements ActionListener {

// Defines a subclass of Applet. The "implements ActionListener"
// part says that objects of type ColoredHelloApplet are
// capable of listening for ActionEvents. This is necessary
// if the applet is to respond to events from the button.

Font textFont; // The font in which the message is displayed.
// A font object represent a certain size and
// style of text drawn on the screen.
TextField T1;
TextField T2;
TextField T3;
int redColor, greenColor, blueColor;
String as, ag, ab;
Button bttn;
public void init() {

// This routine is called by the system to initialize
// the applet. It sets up the font and initial colors
// the applet. It adds a button to the applet for
// changing the message color.

setBackground(Color.lightGray);
// The applet is filled with the background color before
// the paint method is called. The button and the message
// in this applet will appear on a light gray background.

redColor=0;
greenColor=0;
blueColor=0;


textFont = new Font("Serif",Font.BOLD,24);
// Create a font object representing a big, bold font.

/*
        TextField T1=new TextField("",12);
        TextField T2=new TextField("",12);
        TextField T3=new TextField("",12);
        */

        T1=new TextField("",12);
       T2=new TextField("",12);
       T3=new TextField("",12);


        add(T1);
        add(T2);
        add(T3);
bttn = new Button("Change Color");
// Create a new button. "ChangeColor" is the text
// displayed on the button.

bttn.addActionListener(this);
// Set up bttn to send an "action event" to this applet
// when the user clicks the button. The parameter, this,
// is a name for the applet object that we are creating.

add(bttn); // Add the button to the applet, so that it
// will appear on the screen.

} // end init()


public void paint(Graphics g) {

// This routine is called by the system whenever the content
// of the applet needs to be drawn or redrawn. It displays
// the message "Hello World" in the proper color and font.

Color mixColor=new Color(redColor, greenColor,blueColor);
//Color mixColor=new Color(255,255,50);

//g.setColor(mixColor);
g.setColor(mixColor);
//g.setColor(new Color(redColor, greenColor, blueColor));
g.setFont(textFont); // Set the font.

g.drawString("This Color changes", 20,70); // Draw the message.
//T1.setText("Is this function reached");

} // end paint()


public void actionPerformed(ActionEvent evt) {

// This routine is called by the system when the user clicks
// on the button. The response is to change the colorNum
// which determines the color of the message, and to call
// repaint() to see that the applet is redrawn with the
// new color.
// T1.setText("23");

if (evt.getSource() == bttn)
{

as=T1.getText();
ag=T2.getText();
ab=T3.getText();
        as=as.trim();
   ag=ag.trim();
ab=ab.trim();

redColor= Integer.parseInt(as);
greenColor= Integer.parseInt(ag);
blueColor= Integer.parseInt(ab);

repaint(); // Tell system that this applet needs to be redrawn
}
} // end init()

} // end class ColoredHelloWorldApplet

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote