Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Java Final Project Error

Have Programming Question? Ask it here!
 
 
 


Anna
Java Final Project Error
0 Answer(s)      4 years 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 );
}
}

Advertisement
View Answers

Related Tutorials/Questions & Answers:
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
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
Advertisements
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
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
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
Final method in java
Final method in java In this section we will learn about Final method in java... time error because final class cannot be inherited. Final method : public class...() // Error Final method cannot be overridden { System.out.println("hi
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
Java final Keyword Example
Java final Keyword Example In this section we will read about the final keyword in Java in various context. final keyword in Java can be used... the final keyword can be used in Java applies its main integrity i.e.
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
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
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
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
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
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 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
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
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
I GOT ERROR FOR MY PROJECT
I GOT ERROR FOR MY PROJECT  Dear Friend/ RoseIndia Team, Firstly I would to thank u Guys help me so many time.. I got error on my little project when running at server. please correctly my error Guys... ERROR CODE: "LOGIN
Java final method
;); } } class A extends FinalDemo { public void display() // Error Final method cannot...: Final Methods - Java Tutorials Final method in java Java final Keyword Example Java final keyword
Java method final parameter
Java method final parameter       Example below demonstrates the working of java final keyword... set to final. This means double type radius is no more a variable
Java Project
Java Project  Java project using with collection and generic with observer design pattern
java project
java project  how many tables are required in backend for online examination system project in jsp If backend is SQL
java project
java project  i would like to get an idea of how to do a project by doing a project(hospital management) in java.so could you please provide me with tips,UML,source code,or links of already completed project with documentation
Error in Shopping Cart project - Development process
Error in Shopping Cart project  I tried running the shopping cart project given in the below link: http://www.roseindia.net/shoppingcart... when I submit "http://localhost:8080/cart" I received the following error
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
final keyword
final keyword  why is final keyword used in java
JAVA project
JAVA project  How to extract tags and their corresponding properties of a "cascading style sheet" file using JAVA
Can you give few examples of final classes defined in Java API?
Can you give few examples of final classes defined in Java API?   Hi, Can you give few examples of final classes defined in Java API? thanks
java project
java project  Connecting to MySQL database and retrieving and displaying data in JSP page by using netbeans
Java Project
Java Project  how to write a program for competitive exams(for student practice purpose)? for example: first student have to login after login then he has to select the particular exam what he want to write i.e the exam may
project - Java Beginners
project in Java  Need example project in Java
Grid World project Run Error !! help please!!
Grid World project Run Error !! help please!!  i'm trying to make...); } } } } and Here is my error...: (it runs at first but when the bug hits a side, the error occurs and i exit the error but run does not work anymore
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
java project - Java Beginners
java project  how can i download the source code for the project college admission system
Im getting this error while running JPA project
Im getting this error while running JPA project  Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: examplePersistenceUnit] Unable to configure EntityManagerFactory
Java Project - Java Beginners
Java Project  Hey, thanks for everything your doing to make us better. Am trying to work on a project in java am in my first year doing software Engineering and the project is m end of year project. Am really believing
project detail - Java Beginners
project detail  Dear roseindia, i wnat to the idea for doing project in the java
Java Project - Java Beginners
Java Project  Hello Sir I want Mini Student Admission System project in java with Source Code and Back end Database is MS Access. plz Give That Sir its Very Very Urgent
java project - Java Beginners
java project  project for internet banking  Hi friend, I am sending you a link. This link will help you. Please visit for more information. http://www.roseindia.net/jsp/bank.shtml Thanks
Java Project - Java Beginners
Java Project  I'm a III yr Engineering student. I've been ask 2 prepare a project on Java. Can u plz suggest me some topics ?   Hi friend... Java project topic with more information. 1. Asset Management 2. Shopping
JAVA PROJECT - Java Beginners
JAVA PROJECT  Dear Sir, I going to do project in java " IT in HR, recruitment, Leave management, Appriasal, Payroll" Kindly guide me about... etc. I am doing project first time. waiting for your reply, Prashant
Java error
Java error  class WhileLoopMethod{ public static void main(String args[]){ new Hello(); } } class Hello{ int a = 5, b = 88; while(a } //it is giving compile time error .....illegal start
Java error
Java error  class WhileLoopMethod{ public static void main(String args[]){ new Hello(); } } class Hello{ int a = 5, b = 88; while(a } //it is giving compile time error .....illegal start
JAVA AWT BASE PROJECT
JAVA AWT BASE PROJECT  suggest meaningful java AWT-base project
Java Project - Java Beginners
Java Project  Dear Sir, Right now i am working in java image processing project. In that i have to split in one image like Texture, color..., Please visit the following links: http://www.roseindia.net/java/example
java project - Java Beginners
java project  hi this amol i wish to do a project on banking software in java can u help   how can i help u .. and what the kind... adam certified java programmer certified websphere   ya sure!! what
java project - Java Beginners
java project  Can u pls suggest me any ideas for my B.E project? It's urgent... Front end---Java Back end----Oracle IDE---------Netbeans5.5 It should not be completely database oriented... I am not allowed to develop any
Project - Java Beginners
Project  Give me a sample project idea done using code Java
Project - Java Beginners
Project  Give me a sample project idea done using code Java
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...; public Computer(String n,int s,int sp,String m,double p,int q){ name=n; size=s
 

 

 

DMCA.com