Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

 

It requires us to change some code around in a file to add joptionpane dialog boxes in instead of the fields already there. The following is the exact wording of the assignment:

Look through the source code for the Flora. java file. Insert comment marks (//) at the beginning of all lines involving any of the message boxes, except for the MessageBox declaration statements. Directly underneath the lines that are commented out, insert new code to generate JOptionPane dialog boxes that replace the message boxes. Use the same titles, prompts, and buttons. Do not forget to import the necessary Swing packages.

I am having trouble figuring out how to add a JOptionPane box in. I imported the swing for the joptionpane but I need assistance setting it up for the boxes

String code;
  if (arg == "New Sticker")
     code = "N";
  else
     code = "R";

  if (
        (vin.getText().compareTo("")<1)       ||
        (year.getText().compareTo("")<1)      ||
        (make.getText().compareTo("")<1)      ||
        (model.getText().compareTo("")<1)     ||
        (firstName.getText().compareTo("")<1) ||
        (lastName.getText().compareTo("")<1)  ||
        (address.getText().compareTo("")<1)
     )
  {

     errorBox = new MessageBox(this, "Data Entry Error", "You must complete all fields.");
     errorBox.setVisible(true);
  }
  else
  {
  try
  {
     output.writeUTF(code);
     output.writeUTF(vin.getText());
     output.writeUTF(year.getText());
     output.writeUTF(make.getText());
     output.writeUTF(model.getText());
     output.writeUTF(firstName.getText());
     output.writeUTF(lastName.getText());
     output.writeUTF(address.getText());

         savedBox = new MessageBox(this, "Data Submitted", "The vehicle information has been saved.");
         savedBox.setVisible(true);
      }
      catch(IOException c)
      {
         System.exit(1);
      }
      clearFields();
      }
   }

   public void clearFields()
   {
      //Clear fields and reset the focus
      vin.setText("");
      year.setText("");
      make.setText("");
      model.setText("");
      firstName.setText("");
      lastName.setText("");
      address.setText("");
      vin.requestFocus();
    }
}

 

 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9451649

Have any Question?


Related Questions in Computer Engineering

A compute the sumnbsps1nbsp 1 2 3 nbsp nbsp 9999 the sum

(a) Compute the sum S1 = 1 + 2 + 3 + . . . + 9999 (the sum of all integers from 1 to 9999). Do not use a program. (b) Compute the sum S2 = 1+3+5+...+9999 (the sum of all odd integers from 1 to 9999). Do not use a program ...

Question research and provide a write up on available

Question : Research and provide a write up on available routers and switches. The report should include information for at least two router and two switching devices. Included in the write-up should be a description of t ...

Design a automatic room climate control system with

Design a automatic room climate control system with contextual model, state transition diagram.

Junit test labyou will be creating a junit test class for

JUnit Test Lab You will be creating a JUnit Test Class for Gradebook.java, that has been provided for you.   Add a getScoreSize() method to the Gradebook class which returns scoresSize; Add a toString() method to the Gra ...

Regarding terminology for the quality of a picture explain

Regarding terminology for the quality of a picture, explain briefly What is a pixel? What is color depth? Higher is better or lower Search for purchasing a monitor, list the specifications (concentrate on the criteria th ...

Display the manager of the employee with the oldest project

Display the manager of the employee with the oldest project start date (start_date). (This query requires 3 nested queries, start by finding the min start_date from project, then find the emp_id from project where start_ ...

Shellys preferences for consumption and leisure can be

Shelly's preferences for consumption and leisure can be expressed as U(C, L) = (C - 100) (L - 40). This utility function implies that Shelly's marginal utility of leisure is C - 100 and her marginal utility of consumptio ...

Ellen is an anthropologist who has been working at olduvai

Ellen is an anthropologist who has been working at Olduvai Gorge in Tanzania for the past six months. She has been conducting research on the Internet. She finds a Web site with an article that proposes a revolutionary t ...

Question erd assignmentcreate a crows foot erd following

Question: ERD Assignment Create a Crow's foot ERD following the business rules for the ProdCo Company. 1. Each sales representative writes many invoices 2. Each invoice is written by one sales representative 3. Each sale ...

Referring to the slides from text book chapter 5 there are

Referring to the slides from text book, Chapter 5, there are two versions of Fibonacci number calculators: BinaryFib(n) and LinearFibonacci(n). The first algorithm has exponential time complexity, while the second one is ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As