Code around in a file to add joptionpane

Assignment Help Basic Computer Science
Reference no: EM13161525

 

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();
    }
}

 

 

Reference no: EM13161525

Questions Cloud

Cross-price elasticities of demand : How might you determine whether compact discs and restaurant meals are in competition with each other and interpret the following Income Elasticities of Demand (YED) values for the following and state if the good is normal or inferior;
Compute equilibrium constant for the reaction : 2NOCl(g) = 2NO + Cl2 When 3.00 mol of NOCL is heated to a given temp. in a 2.00 L container, 1.70 fol NOCL remain at equilibrium. a.) Calculate the equilibrium concentration of each substance in the reaction
Program of nutrition that would restore the student back : A junior high school student live sonly on potato chips and cola. Given that this is not a balanced diet, what effects would this have on the general health of the student? Devise a program of nutrition that would restore the student back to healt..
What is the probality that the woman is a heterozygote : What is the probality that the woman is a heterozygote if her eight child does not have this disorder?
Code around in a file to add joptionpane : 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:
Design a controlled experiment to measure the effect : With two nearby ponds in a forest as the study site, how would you design a controlled experiment to measure the effect of falling leaves on net primary production in a pond?
What is the hydroxide concentration at ph9 : If the pH decreases from 9 to 6, what is the hydroxide concentration at pH9?
What happens to the small chromosome : Plant Cell going through mitosis with two chromosomes and a small single chromosome?
Regular expression that selects lines : Write a regular expression that selects lines containing the html BR tag. The rules for this tag are that, like all html tags, it starts with . In between are the letters b and r in that order

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd