Java gui application

Assignment Help JAVA Programming
Reference no: EM13704522

Question: Assume the existence of the following Java GUI application. There are two text fields for user input. The first JTextField variable is named radius and is used to input a radius value.

The second JTextField variable named height is used to input a height value. All input values and calculations use floating point values. The user clicks a JButton to perform a calculation.

One JButton called area causes the program to calculate and display the surface area of a cylinder, A = 2 * pi * r * r + 2 * pi * r * h. Another JButton called volume causes the program to calculate the volume of the cylinder, volume = pi * r * r * h.

The result of the selected calculation is displayed in an output text area variable named output. The output string should say something like this: "Surface area of a cylinder with radius 1 and height 1 is 12.57."

The output should display two digits after the decimal point. Clicking one of the buttons generates the event which causes the program to do the selected calculation and update the output area.

Assume the user interface has already been implemented and the member variables listed above exist.

Your job is to write the ButtonHandler inner class which handles the events from the two buttons, does the requested calculation and shows the suitable result.

You have to implement ButtonHandler class and handle the events from the two buttons.

Reference no: EM13704522

Questions Cloud

Calculate the average test score and display it : Write a program that asks for five test scores. The program should calculate the average test score and display it. The number displayed should be formatted in fixed-point notation, with one decimal point of precision.
Write a program to find a baseball players batting average : Write a program to find a baseball player's batting average. The program should ask the user to enter the number of times the player was at bat and the number of hits he got. It should then show his batting average to four decimal places.
How many tickets for each class of seats were sold : Prepare a program that asks how many tickets for each class of seats were sold, then shows the amount of income generated from ticket sales.
Representation in both hexadecimal and binary : Show 75 in the IEEE single precision floating point representation in both Hexadecimal and Binary. Please demonstrate the steps so I can emulate.
Java gui application : Assume the existence of the following Java GUI application. There are two text fields for user input. The first JTextField variable is named radius and is used to input a radius value.
Create an employee class : Create an Employee class. Items to include as data members are employee number, name, data of hire, job description, department, and monthly salary. The class is often used to display an alphabetical listing of all employs.
Calculates the cutoff frequency in a simple rc circuit : Write a simple Java application which calculates the cutoff frequency in a simple RC circuit.
Provide a regular expression that shows the set of strings : Provide a regular expression that shows the set of strings over {a, b} thatcontain at least one b if its length is at least four.
Calculates the cutoff frequency in a simple rc circuit : Write a simple Java application which calculates the cutoff frequency in a simple RC circuit. Your application should ask the user to enter the capacitor and resistor values of the circuit. You must use the JOptionPane class to collect the user's ..

Reviews

Write a Review

 

JAVA Programming Questions & Answers

  Determine the length of a string

Determine the length of a string. The first version should use array subscripting, and the second version should use pointer arithmetic

  Write an application with three labeled text field

Write an application with three labeled text fields,one each for the initial amount of a savings account, the annual interest rate, and the number of years. Add a button "Calculate" and a read-only text area to display the balance of the savings acco..

  Discuss factors that affect sorting in sediment

Discuss factors that affect sorting in sediment. How could one tell the latitude at which a sediment was originally deposited? Compare and contrast phosphate and manganese nodules.

  Implement a class quiz

Implement a class Quiz that implements the Measurable interface.

  Allows the user to specify a triangle with three mouse press

Write a program that allows the user to specify a triangle with three mouse presses. After the first mouse press, draw a small dot. After the second mouse press, draw a line joining the first two points. After the third mouse press, draw the entir..

  Programming principles please help me doing my assignment i

please help me doing my assignment i have attached my assignment requirement document refer it and send me the solution

  Create three classes for a customer

a travel manager and have a job of buying a travel package for a customer. You must create three classes for this programming challenge: Customer, Ticket, and TravelManagerDemo.

  Create a method that would search through an arraylist

What is the best way of the following ways (For each, Iterator, While with index) that you would use to create a method that would search through an ArrayList of files for a certain file and then delete it, and why?

  What is the purpose of the restrict keyword in c99

Arrays of strings in C and C++ can also be initialized with string literals. In this case, the array is one of pointers to characters.

  Length of the string in order to reserve space

To determine the length of the string in order to reserve space for the new string use the library routine strlen. Register a1 contains a pointer to the string to measure and on return register a1 has the number of characters in the string. You..

  Writing a program to have it generate random words

How would I go about writing a program to have it generate random words with a letter missing for a child to guess? Maybe it would have three letters, then four, next five, and so on until maybe 10 letters. Please keep in mind that I'd like it to wor..

  Will the direction and magnitude be integers or doubles

Define a Physics_vector class which consists of a struct containing the direction and magnitude, and also define a function

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