code:
import java.awt.*;
import java.awt.event.*;
class CylinderVolume extends Frame implements ActionListener
{
TextField t1,t2,t3; //Text fields declaration
Label l3;
//Adds components to the awindow or Frame, binds the action
listener to the button, where volume computation is done.
CylinderVolume()
{
super("CylinderVolume");
Label l1=new Label("Height of
Cylineder:");
t1=new TextField();
Label l2=new Label("Radius of
Cylineder:");
l3=new Label("");
t2=new TextField();
t3=new TextField();
t3.setEditable(false);
Button b=new Button("Compute
Volume");
Label l4=new
Label("Volume:");
b.addActionListener(this);
setLayout(null);
setVisible(true);
setSize(400,400);
l1.setBounds(20,80,130,20);
add(l1);
l2.setBounds(20,140,130,20);
add(l2);
l3.setBounds(20,260,300,20);
add(l3);
l4.setBounds(20,210,130,20);
add(l4);
t1.setBounds(150,90,100,20);
add(t1);
t2.setBounds(150,150,100,20);
add(t2);
t3.setBounds(150,210,100,20);
add(t3);
b.setBounds(150,310,100,20);
add(b);
}
public void actionPerformed(ActionEvent ae)
{
try{
double
height=Double.parseDouble(t1.getText());
double
radius=Double.parseDouble(t2.getText());
t3.setText(""+(Math.PI*height*radius*radius));
l3.setText("");
}
catch(Exception e)
{
t3.setText("");
l3.setText("Enter valid inputs to compute volume");
}
}
public static void main(String[] args) {
new CylinderVolume();
}
}
Sample i/o:
For invalid inputs
For valid inputs:
Explanation:
The tank image is not used here as it is mentioned optional. A java frame is created that has awt components, button is binded with a action listener where volume is calculated.
java # 5 (to be finished later) Develop at application with GUI that will be calculating...
Select one favorite application of yours (in e-commence, education, games, and so on). Design a Java FxGUI for a "customer" to access the application of your design. the application of your design. 1. Makes sure you have sufficient components (2 or more buttons, text fields/areas, a selection list, 1 or more images and other optional components of your choice). In addition, add an "account" information so that a customer/user may access or utilize the application. Your GUI application shall also...
Doing JFrame and make comments 16; 17, 18 (Marks: 50) Develop a Java Gur application that will produce an Area lookup application that will allow a user to view a phone or postal code for a Town in a particular Country. Do not forget to use allocated the marking guideline at the end of this question to see how the marks are create two combo boxes, one for the country selection and another to select a town. Also, add two...
Question 1 (Marks: 50 Develop a Java GUI application that will produce an investment report based on various criteria, such as investment amount, investment type and term. On the form create two text fields, one to capture the customer name and (10) Q.1.1 another to capture the amount to invest. Also create a combo box for the user to select the investment type which will be moderate or aggressive. Finally add three radio buttons for the user to select the...
use java to design the application, the GUI should appear as in the picture shown . Use java language: Requirements Document A local bank intends to install a new automated teller machine (ATM) to allow users (i.e., bank customers) to perform basic financial transactions. Each user can have only one account at the bank. ATM users should be able to view their account balance, withdraw cash (i.e., take money out of an account) and deposit funds (i.e., place money into...
(In Java) you will be creating a GUI for your calculator that evaluates the postfix expression. I have already created the postfix class that converts the expression from infix to postfix. Here's the postFix class and its stack class (https://paste.ofcode.org/bkwPyCMEBASXQL4pR2ym43) ---> PostFix class (https://paste.ofcode.org/WsEHHugXB38aziWRrp829n)--------> Stack class Your calculator should have: Text field for the postfix expression Text field for the result Two buttons: Evaluate and Clear You can start with the code written below and improvise to work with this...
In Java. Write a GUI contact list application. The program should allow you to input names and phone numbers. You should also be able to input a name and have it display the previously entered phone number. The GUI should look something like the following, although you are welcome to format it in any way that works. This should be a GUI application with a JFrame. The program should contain two arrays of Strings. One array will contain a list...
JAVA CODING Must be compilable, thanks The purpose is to provide an exercise in event-driven programming and image handling using JavaFX. Create an application that responds to the user clicking command buttons. Initially, it will display one of two graphic images and, based upon the button clicked by the user, will switch the image displayed. If the user clicks the mouse button to display the same image as is currently displayed, the image is not changed, but a message at...
Java: student directory GUI You need to implement three classes: Person Student StudentDirectory StudentMain Start by implementing Person and Student classes. Once you are sure you can serialize and deserialize and ArrayList of Students to and from a file, move on to building the GUI application. Person: The Person class should implement serializable interface. It contains the following: Person's first name (String) Person's last name (String) Person's id number Person's date of birth (Date) public String toString(): This method method...
I need to make javafx GUI application called Email that implements a prototype user interface for composing email message. The application should have labelled text fields for To, cc,bcc ,subject line, one for message body and button lebelled Send. When we click Send button, the program should print contents of all fields to standard output using println() statement. I am attaching photos of Email.java and EmailPane.java, I need to make it as per these classes CylinderSta.. Cylinder java MultiCylind.. ....
Please design a Java GUI application with two JTextField for user to enter the first name and last name. Add two JButtons with action events so when user click on one button to generate a full name message from the user input and put it in a third JTextField which is not editable; and click on the other button to clear all three JTextField boxes. Please run the attached nameFrame.class file (Note: because there is an actionhandler inner class in...