Home Answers Viewqa Java-Beginners Java Final Project Error

 
 


Anna
Java Final Project Error
0 Answer(s)      2 years and 9 months ago
Posted in : Java Beginners

It isnt showing the result when I press the proper button...?? It isnt doing the work... can someone help me??

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import java.text.SimpleDateFormat;
import java.util.Date;
public class FinalProject extends JFrame implements ActionListener
{
JLabel textPrompt;
JTextArea inputText;
JLabel keyPrompt;
JTextField inputKey;
Container container;

public FinalProject()
{
super( "Final Project " );
JTabbedPane tab = new JTabbedPane();

// constructing the Pool Panel

JPanel p1 = new JPanel();
JLabel label4,label5,lable6;
final JTextField text4,text5,text6,text13;
label4 = new JLabel();
label4.setText("Height:");
p1.add(label4);
text4 = new JTextField(20);
p1.add(text4);
JLabel space3 = new JLabel(" ");
p1.add(space3);
label5 = new JLabel();
label5.setText("Width:");
p1.add (label5);
text5 = new JTextField(20);
p1.add(text5);
JLabel space5 = new JLabel(" ");
p1.add(space5);
lable6 = new JLabel();
lable6.setText("Depth:");
p1.add(lable6);
text6 = new JTextField(20);
p1.add(text6);
JLabel space2 = new JLabel(" ");
p1.add(space2);
JButton button = new JButton("Enter");
p1.add(button);
tab.addTab( "Pool", null, p1, " Pool" );
text13 = new JTextField();
p1.add(text13);
button.addActionListener(this);

new ActionListener(){
public void actionPerformed(ActionEvent e) {
e.getActionCommand();
int length=Integer.parseInt(text4.getText());
int width=Integer.parseInt(text5.getText());
int depth=Integer.parseInt(text6.getText());

if (e.getActionCommand().equals("Enter")) {
int volume = ((length * width) * depth);
JOptionPane.showMessageDialog(null, "The Volume is:"+volume,"for your pool.", JOptionPane.INFORMATION_MESSAGE);
}
}
};
// constructing the Hot Tube panel

new JLabel("Hot Tube");
JPanel p2 = new JPanel();
JLabel label7,label8,lable9;
final JTextField text7,text8,text9;{
label7 = new JLabel();
label7.setText("Height:");
p2.add(label7);
text7 = new JTextField(20);
p2.add(text7);
JLabel space6 = new JLabel(" ");
p2.add(space6);
label8 = new JLabel();
label8.setText("Width:");
p2.add(label8);
text8 = new JTextField(20);
p2.add(text8);
JLabel space7 = new JLabel(" ");
p2.add(space7);
lable9 = new JLabel();
lable9.setText("Depth:");
p2.add(lable9);
text9 = new JTextField(20);
p2.add(text9);
JLabel space8 = new JLabel(" ");
p2.add(space8);
JButton rbutton = new JButton("Oval");
p2.add(rbutton);
JButton rbutton1 = new JButton ("Round");
p2.add(rbutton1);

tab.addTab( "Hot Tube", null, p2, " Hot Tube" );
rbutton.addActionListener(this);
rbutton1.addActionListener(this);

new ActionListener(){
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub

int length=Integer.parseInt(text7.getText());
int width=Integer.parseInt(text8.getText());
int depth=Integer.parseInt(text9.getText());

if(e.getActionCommand().equals("Oval")){
int volume = ((length * width) * depth);
JOptionPane.showMessageDialog(null, "The Volume is:"+volume,"" +
"for your oval hot tube.", JOptionPane.INFORMATION_MESSAGE);
}
else if(e.getActionCommand().equals("Round")){
int volume1= (((length/2)^2) * depth);
JOptionPane.showMessageDialog(null, "The Volume is:"+volume1,"" +
"for your round hot tube.", JOptionPane.INFORMATION_MESSAGE);
}
}
};
// constructing the Temperature Change panel

new JLabel( " Temperature Change!" );
JPanel p3 = new JPanel();
JLabel label10;
final JTextField text10;
label10 = new JLabel();
label10.setText("Temperature:");
p3.add(label10);
text10 = new JTextField(20);
p3.add(text10);
JButton button3 = new JButton("Enter");
p3.add(button3);
JCheckBox boxF = new JCheckBox("F");
p3.add(boxF);
JCheckBox boxC = new JCheckBox("C");
p3.add(boxC);
tab.addTab( "Temperature Change", null, p3, " Temperature Change" );
button3.addActionListener(this);
boxF.addActionListener(this);
boxC.addActionListener(this);

new ActionListener(){
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
int temperature=Integer.parseInt(text10.getText());

if(e.getActionCommand().equals("C")){
int temp = (( temperature* 9)/5+32);
JOptionPane.showMessageDialog(null, "The Celcuis temperature is changed to:"
+temp,"" +
"in fahrenheit", JOptionPane.INFORMATION_MESSAGE);
}
else if(e.getActionCommand().equals("F")){
int temp1= (((temperature - 32)/9)*5);
JOptionPane.showMessageDialog(null, "The farhrenheight temperature is changed to:"+temp1,""+
"in Celcius.", JOptionPane.INFORMATION_MESSAGE);
}
}
};
// constructing the Customer panel

JPanel p4 = new JPanel();
JLabel label1,label2;
final JTextField text1,text2;
label1 = new JLabel();
label1.setText("Name:");
p4.add(label1);
text1 = new JTextField(20);
p4.add(text1);
JLabel space = new JLabel(" ");//MDB
p4.add(space);
label2 = new JLabel();
label2.setText("Address:");
p4.add(label2);
text2 = new JTextField(20);
p4.add(text2);
JButton button4 = new JButton("Enter");
p4.add(button4);
tab.addTab( "Customer", null, p4, " Customer" );
button4.setActionCommand ("Enter");

new ActionListener(){
public void actionPerformed(ActionEvent e) {
e.getActionCommand();
int Name=Integer.parseInt(text1.getText()) ;
int Address=Integer.parseInt(text2.getText());
if (e.getActionCommand().equals("Enter")) {
JOptionPane.showMessageDialog(null, "Customer's name is:"+Name,"Their address is:"
+Address, JOptionPane.INFORMATION_MESSAGE);
}
}
};
// constructing the General panel

new JLabel( "General" );
JPanel p5 = new JPanel();
Date date = new Date();
SimpleDateFormat dateformatMMDDYYYY = new SimpleDateFormat("MM/dd/yyyy");
new StringBuilder( dateformatMMDDYYYY.format( date ) );
JLabel space11 = new JLabel(" ");
p5.add(space11);
JLabel space12 = new JLabel(" ");
p5.add(space12);
JLabel space13 = new JLabel(" ");
p5.add(space13);
JLabel label11;
label11 = new JLabel();
label11.setText("Today's Date is:");
p5.add(label11);
JLabel texta1;
texta1 = new JLabel();
texta1.setText(dateformatMMDDYYYY.format(date));
p5.add(texta1);
tab.addTab( "General", null, p5, " Today's Date");

//constructing the Manufacture panel

JPanel p6 = new JPanel();
JLabel label3;
final JTextField text3;
label3 = new JLabel();
label3.setText("Manufacture:");
p6.add(label3);
text3 = new JTextField(20);
p6.add(text3);
JLabel space1 = new JLabel(" ");
p6.add(space1);
tab.addTab( "Manufacture", null, p6, " Manufacture" );
JButton button6 = new JButton("Enter");
p6.add(button6);
button6.addActionListener(this);
{
button6.setActionCommand ("Enter");

new ActionListener(){
public void actionPerformed(ActionEvent e) {
e.getActionCommand();
int Manufacture=Integer.parseInt(text3.getText()) ;

if (e.getActionCommand().equals("Enter")) {
JOptionPane.showMessageDialog(null, "Manufacture's name is:"
+Manufacture,"", JOptionPane.INFORMATION_MESSAGE);
}
}
};
//constructing the Comment panel

new JLabel("Customer Comments?");
JPanel p7 = new JPanel();
new JPanel( );
textPrompt = new JLabel("Customer comments:");
inputText = new JTextArea(5, 15);
inputText.setLineWrap(true);
inputText.setWrapStyleWord(true);

//add components to window
container = getContentPane();
//use borderlayout to position our two i/o panels
container.setLayout(new BorderLayout());
p7.setLayout(new FlowLayout());
//add components to panels
p7.add(textPrompt);
p7.add(inputText);
//add panels to our primary borderlayout
add(p7, BorderLayout.NORTH);
// add JTabbedPane to container
getContentPane().add( tab );
setSize( 400, 250 );
setVisible( true );
JButton button7 = new JButton("Enter");
p7.add(button7);
tab.addTab ("Customer Comments?",null,p7,"Customer Comments?");
button7.addActionListener(this);}

new ActionListener(){
public void actionPerformed(ActionEvent e) {
e.getActionCommand();
int Comments=Integer.parseInt(inputText.getText()) ;

if (e.getActionCommand().equals("Enter")) {
JOptionPane.showMessageDialog(null, "Customer's comment:"+Comments,"", JOptionPane.INFORMATION_MESSAGE);
}
}

};
}
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
}

public static void main( String args[] )
{
FinalProject demo = new FinalProject();
demo.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}
}
View Answers









Related Pages:
Java Final Project Error - Java Beginners
Java Final Project Error  It isnt showing the result when I press... inputKey; Container container; public FinalProject() { super( "Final Project " ); JTabbedPane tab = new JTabbedPane(); // constructing the Pool
Java Final Project - Java Beginners
Java Final Project  I am having a real hard time with this java... final project. This is your opportunity to show off your skills! Overall...() { super( "Final Project " ); JTabbedPane tab = new JTabbedPane(); // constructing
Final Project - Java Beginners
, but it is suggested that you begin working on the final project assignment in Week 5, which...Final Project  The importance of a graphical user interface in programming is paramount in being successful in the business industry. This project
Final Project II - Java Beginners
Final Project II  Is there anyway I can get the project back by Saturday??? It is due on Sunday by midnight...Thank You
Final Methods - Java Tutorials
The final Keyword in Java In Java, final keyword is applied in various context. The final keyword is a modifier means the final class can't be extended... lead to exception or compile time error. You can declare the final fields
Java 5 - "final" is not final anymore - Java Tutorials
Java 5 - "final" is not final anymore   2004-10-07 The Java Specialists' Newsletter [Issue 096] - Java 5 - "final" is not final anymore Author... will start moving to Java 5. Java 5 - "final" is not final anymore
important for all final years student
important for all final years student   i need a java program for my project, java program for getting path of the file in console while reading... letter content in from glassorry ,i need it in simple java code meanwhile using
important for all final years student
important for all final years student  i need a java program for my project, java program for getting path of the file in console while reading... it in simple java code meanwhile using some inbuilt function with control flow conditions
important for all final years student
important for all final years student  i need a java program for my project, java program for getting path of the file in console while reading... it in simple java code meanwhile using some inbuilt function with control flow conditions
Final Key Word in Java
.style1 { text-align: center; } Final key word in java In java... will generate error. Example- public class FinalField { public final int... in java 1.1, its declaration lacks an initializer. A blank final can only
PHP Final Keyword
Final Keyword in PHP: If you are familiar with Java then you must know the functionality of Final keyword. Final keyword prevents child classes from...: Fatal error: Class B may not inherit from final class (A) in C:\xampp\htdocs\PHP
final keyword
final keyword  why is final keyword used in java
Create Project SplashScreen - Java Beginners
Create Project SplashScreen   I want to Create project splashscreen... can create in java.   Hi Friend, Try the following code: 1... extends JFrame{ JButton SUBMIT; JPanel panel; JLabel label1,label2; final
Java Final Variable
Java Final Variable  I have some confusion --Final variable has single copy for each object so can we access final variable through class name,or it is necessary to create object for accessing final variable
project
project  i need a project in java backend sql
project
project  suggest a network security project based on core java with explanation
Java: Final keyword
Java NotesFinal keyword The Final word on the final keyword. How often do you use final? Copyleft 2005 Fred Swartz MIT License
project
project  sir i want a java major project in railway reservation plz help me and give a project source code with entire validation thank you
project detail - Java Beginners
project detail  How to do project in java I am doing final MCA i want to do project I am willing to do project in java or j2ee. But I have no idea so I want some idea about project in java please give some sample project
Project
Project  How to show Questions randomly so that no two student get the same questions in online examination system project in Java Server Pages my email id is moiza_sayyed@rediffmail.com
The final Keyword
The final Keyword       The final is a keyword. This is similar to const keyword in other... a variable or class with this name in your Java program. In the Java programming
Java final keyword
Java final keyword The final is a very important keyword in java, which... with the name "Final" in a Java program. We can have final methods, final... when final keyword use variable constant Exampleof final jeyword in Java
project
project   hi , we r working on one project related to our results. we using java and for back end sqlserver 2005. In dis we are trying to retrieve result from some site and store it in our data base so that we can perform
Project
Project  Hi, Am starting a new project to draw a 2d graph using java swing and opengl,where in the input for X-axis and Y-axis co=ordinates should be accepted from user... As am very new to this am seeking help so pls help
project...
project...   enter 10 integers, store it using array then display them from highest to lowest. 2.enter 10 integers, store it using array then display them from lowest to highest number to words conversion create a java program
Java final
Java final       In the Java programming language, the keyword "final" is used with different entity which makes it unchangeable later. We can have final methods, final
project
){ XYSeriesCollection dataset = new XYSeriesCollection(); final XYSeries data = new
project
project  write a program in java to develop a port scanner for common devices(HTTP,FTP,Telnet
project
project  how to make blinking eyes using arc, applet in core java
TYBsc IT final project (MOBILE BASED SMS SEARCH ENGIN)
TYBsc IT final project (MOBILE BASED SMS SEARCH ENGIN)  How to send sms pc to mobile using JSP & Servelet
project
should write Java code, so as to: 1. Compute Gross Monthly Salary for all employees
TYBsc IT final project (MOBILE BASED SMS SEARCH ENGIN)
TYBsc IT final project (MOBILE BASED SMS SEARCH ENGIN)  How to send... modem? Pls give me fast reply becoz my porject(TYBsc IT)final has not been completed. so i requested to you pls answer my question. My project name is MOBILE
final
final  what does final means in "public static final void main (string args[])" ?   keyword final can be assigned only once. They cannot be modified
private and final - Java Interview Questions
and final modifier in java   Hi Friend, Private modifier indicates... be accessed or instantiated outside. Final modifier indicates.... They cannot be overriden by subclasses. The final class can't be extended
Java Error in Bus Time Table Project - Development process
Java Error in Bus Time Table Project  Please Solve Errors import...*; import java.sql.*; import java.util.*; class Project{ JFrame f; JPanel...; GridBagConstraints gbc; Project(){ f=new JFrame("Bus TimeTable"); p=new JPanel(); p1
Java Project - Java Beginners
question in my java project. But this program is shoing error on the 50th line...Java Project  Create a class Computer that stores information about... of java too much hepl plz
Static final variables - Java Beginners
Static final variables  can a static final variable be accessed by a instance (non-static)method?  Hi, static final variable u can... Xyz{ private static final String name="xyz"; public void displayData
core java project by using databse
core java project by using databse  hello sir, i'm a b.tech final year student.... i wantto make a project on java with database... can u plzz suggest me how i can start for it.... means on which topic i can make project
JDBC:Runtime error - Java Beginners
to run the program from command prompt it is giving error. The follwing... to run the batch file it is showing following error...://localhost:3306/cbs I placed all jar in lib folder of the project and also
Can a main method be declared final?
be override in a subclass. for more about main method be declared final in Java...Can a main method be declared final?   Hi, Can a main method be declared final? Thanks   Hi, Yes we can. The final method can
difference between enum and final class?
difference between enum and final class?  what is the difference between enum and final class in java?   The java.lang.Enum is an abstract class, it is the common base class of all Java language enumeration types
What is the purpose of declaring a variable as final?
What is the purpose of declaring a variable as final?   Hi, What is the purpose of declaring a variable as final? Thanks   Hi, In Java when we declare a final variable as a variable which has been initialized
ERROR with my JAVA code - Java Beginners
ERROR with my JAVA code  The error came up in my main method...; Container container; public FinalProject() { super( "Final Project... JPanel p1 = new JPanel(); JLabel label4,label5,lable6; final JTextField
Java Project Questions - Java Beginners
Java Project Questions  Hello sir ,I want Course Form in JAVA SWING... java.awt.event.*; import java.sql.*; import java.util.*; class Project { JFrame f... ; Project(){ f=new JFrame("Form"); p1=new JPanel(new GridLayout(5,2)); p2=new
Java Project Questions - Java Beginners
Java Project Questions  Hello sir ,I want Course Form in JAVA SWING...*; import java.sql.*; import java.util.*; class Project { JFrame f...; JScrollPane sp1; JButton savebtn,resetbtn,editbtn1,editbtn2,deletebtn ; Project
error
of framework used and also the JDK version. This type error also comes when java file is complied in old version of java and used on latest version. Thanks
MCA Project Training
: · MCA Project Training in Core Java · MCA Project Training in Hibernate · MCA Project Training in Java Persistence API (JPI...; MCA Project Training in Java · MCA Project Training in JUnit
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package... static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package... static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package... HttpServlet { private static final long serialVersionUID = 1L; public Modify_std

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.