can modify this application connection with database
hi i'm want to say who thank java master or java professional help me convert Java applet to Java Frame, in here can i ask one more question about using this application modify connection with database ?
import javax.swing.*;
import java.applet.*;
import java.awt.*;
import java.util.*;
import java.text.*;
import java.awt.event.*;
public class RC extends JFrame implements ActionListener{
JTextField text,text1,text2,text3,text4,text5,text6,text7;
JLabel label1,label2,label3,label4,label5,label6,label7,label8,label9;
JLabel lab;
JButton b1,b2;
JComboBox combo;
DecimalFormat df = new DecimalFormat("$##.##");
public RC(){
setLayout(null);
lab=new JLabel("Welcome to Rental Car System");
lab.setBounds(100,20,200,20);
add(lab);
label1 = new JLabel("Select Type of Car: ");
label1.setBounds(20,50,180,20);
add(label1);
combo=new JComboBox();
combo.addItem("--Select--");
combo.addItem("Honda City");
combo.addItem("Toyota Vios");
combo.addItem("Nissan Latio");
combo.addItem("Proton Iswara");
combo.addItem("Proton Waja");
combo.addItem("Perodua Myvi");
combo.addItem("Toyota Avenza");
combo.addItem("Honda Stream");
combo.addItem("Nissan Grand Livina");
combo.addItem("Perodua Alza");
combo.addItem("Proton Exora");
combo.setBounds(200,50,120,20);
add(combo);
label2 = new JLabel("Enter number of days: ");
label2.setBounds(20,80,180,20);
add(label2);
text = new JTextField(5);
text.setBounds(200,80,100,20);
add(text);
b1 = new JButton("Submit");
b1.setBounds(200,140,100,20);
add(b1);
b1.addActionListener(this);
label3=new JLabel("Enter Customer Name: ");
label3.setBounds(20,60,180,20);
add(label3);
text1=new JTextField(10);
text1.setBounds(230,60,150,20);
add(text1);
label4=new JLabel("Enter IC Number: ");
label4.setBounds(20,90,180,20);
add(label4);
text2=new JTextField(10);
text2.setBounds(230,90,150,20);
add(text2);
label5=new JLabel("Enter Age: ");
label5.setBounds(20,120,180,20);
add(label5);
text3=new JTextField(10);
text3.setBounds(230,120,150,20);
add(text3);
label6=new JLabel("Enter Mobile Number: ");
label6.setBounds(20,150,180,20);
add(label6);
text4=new JTextField(10);
text4.setBounds(230,150,150,20);
add(text4);
label7=new JLabel("Enter E-Mail Address: ");
label7.setBounds(20,180,180,20);
add(label7);
text5=new JTextField(10);
text5.setBounds(230,180,150,20);
add(text5);
label8=new JLabel("Enter 16 Digit of Credit Card Number: ");
label8.setBounds(20,210,210,20);
add(label8);
text6=new JTextField(10);
text6.setBounds(230,210,150,20);
add(text6);
label9=new JLabel("Enter Pin Code of Credit Card: ");
label9.setBounds(20,240,180,20);
add(label9);
text7=new JTextField(10);
text7.setBounds(230,240,150,20);
add(text7);
b2=new JButton("Submit");
b2.setBounds(230,270,100,20);
add(b2);
label3.setVisible(false);
label4.setVisible(false);
label5.setVisible(false);
label6.setVisible(false);
label7.setVisible(false);
label8.setVisible(false);
label9.setVisible(false);
text1.setVisible(false);
text2.setVisible(false);
text3.setVisible(false);
text4.setVisible(false);
text5.setVisible(false);
text6.setVisible(false);
text7.setVisible(false);
b2.setVisible(false);
setVisible(true);
setSize(1024,760);
}
public void actionPerformed(ActionEvent ae){
String value=combo.getSelectedItem().toString();
int day=Integer.parseInt(text.getText());
if(value.equals("Honda City")){
if(day>0){
final double amount=(day-0)*60.00 + 100.00;
JOptionPane.showMessageDialog(null,"Vehicle type= Honda City \n" + " Deposit= Rm100 \n " + " Daily Rate= 60 \n" + "days= " + day+"\n\n"+"Rental Total Charges= "+df.format(amount));
String st=JOptionPane.showInputDialog(null,"Do you want to continue next Process?( y/n ): ");
if(st.equals("y")){
label1.setVisible(false);
label2.setVisible(false);
text.setVisible(false);
combo.setVisible(false);
b1.setVisible(false);
b2.setVisible(true);
label3.setVisible(true);
label4.setVisible(true);
label5.setVisible(true);
label6.setVisible(true);
label7.setVisible(true);
label8.setVisible(true);
label9.setVisible(true);
text1.setVisible(true);
text2.setVisible(true);
text3.setVisible(true);
text4.setVisible(true);
text5.setVisible(true);
text6.setVisible(true);
text7.setVisible(true);
b2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JOptionPane.showMessageDialog(null," Customer Name: " +text1.getText()+ "\n IC Number: " +text2.getText()+ "\n Age: " +text3.getText()+ "\n Mobile Number: " +text4.getText()+ "\n Rental Charger: "+ df.format(amount) );
}
});
}
else{
JOptionPane.showMessageDialog(null,"Thank survey to Rental Car System and See you Again....!");
}
}
}
else if(value.equals("Toyota Vios")){
if(day>0){
final double amount=(day-0)*60.00 + 100.00;
JOptionPane.showMessageDialog(null,"Vehicle type= Toyota Vios \n" + " Deposit= Rm100 \n " + " Daily Rate= 60 \n" + "days= " + day+"\n\n"+"Rental Total Charges= "+df.format(amount));
String st=JOptionPane.showInputDialog(null,"Do you want to continue next Process?( y/n ): ");
if(st.equals("y")){
label1.setVisible(false);
label2.setVisible(false);
text.setVisible(false);
combo.setVisible(false);
b1.setVisible(false);
b2.setVisible(true);
label3.setVisible(true);
label4.setVisible(true);
label5.setVisible(true);
label6.setVisible(true);
text1.setVisible(true);
text2.setVisible(true);
text3.setVisible(true);
text4.setVisible(true);
b2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JOptionPane.showMessageDialog(null," Customer Name: " +text1.getText()+ "\n IC Number: " +text2.getText()+ "\n Age: " +text3.getText()+ "\n Mobile Number: " +text4.getText()+ "\n Rental Charger: "+ df.format(amount) );
}
});
}
else{
JOptionPane.showMessageDialog(null,"Thank survey to Rental Car System and See you Again....!");
}
}
}
else if(value.equals("Nissan Latio")){
if(day>0){
final double amount=(day-0)*70.00 + 100.00;
JOptionPane.showMessageDialog(null,"Vehicle type= Nissan Latio \n" + " Deposit= Rm100 \n " + " Daily Rate= 70 \n" + "days= " + day+"\n\n"+"Rental Total Charges= "+df.format(amount));
String st=JOptionPane.showInputDialog(null,"Do you want to continue next Process?( y/n ): ");
if(st.equals("y")){
label1.setVisible(false);
label2.setVisible(false);
text.setVisible(false);
combo.setVisible(false);
b1.setVisible(false);
b2.setVisible(true);
label3.setVisible(true);
label4.setVisible(true);
label5.setVisible(true);
label6.setVisible(true);
text1.setVisible(true);
text2.setVisible(true);
text3.setVisible(true);
text4.setVisible(true);
b2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JOptionPane.showMessageDialog(null," Customer Name: " +text1.getText()+ "\n IC Number: " +text2.getText()+ "\n Age: " +text3.getText()+ "\n Mobile Number: " +text4.getText()+ "\n Rental Charger: "+ df.format(amount) );
}
});
}
else{
JOptionPane.showMessageDialog(null,"Thank survey to Rental Car System and See you Again....!");
}
}
}
}
public static void main(String[]args){
new RC();
}
}
View Answers
March 14, 2012 at 12:52 PM
Related Tutorials/Questions & Answers:
can modify this application connection with database can modify this
application connection with
database hi i'm want... to Java Frame, in here
can i ask one more question about using this
application modify connection with
database ?
import javax.swing.*;
import java.applet.
Advertisements
DataBase ConnectionDataBase Connection How to connect java and Oracle 10g? Tell me Jdbc
connection Connection to Database I manually make a
connection to MySQL
database in my web pages? How joomla... is the code how I am connecting to MySQL: I am
connection to MySQL
database in 2... question is that how I
can properly connect to my SQL
database where I need
How can I connect my database to my application ?How
can I connect my
database to my
application ? How
can I connect my
database to my
application?
Hi,
You
can use JDBC API to connect to
database from your Java application.ADS_TO_REPLACE_1
Here is the sample
database connectiondatabase connection i wanted to no how to connect sqlite
database through netbeans?
is it posible to connect it to a
database that is on a remote pc?
thank you
database connection database connection hi
all ready created
database table using mysql
database,employee payroll,attendance,employee details used
database
i need how to import and export excel file into
database using jsp?
pls help me any one
Database Connection Pooling (DBCP)
within a giant
database application.
The
database enabled applications needs the
database connection for
processing the request send by the clients... and returns to relating clients.
There are several
Database Connection Pools
close a Connection applicationclose a
Connection application What happens when I close a
Connection application obtained from a
connection Pool? How does a
connection pool maintain the Connections that I had closed through the
application Establish a Connection with MySQL Database
Establish a
Connection with MySQL
Database
... coding methods of establishing the
connection between MySQL
database and quartz
application for updating and
manipulating the data of MySQL
database tables. Here
database connection in struts - Strutsdatabase connection in struts Connecting
database in Struts in my project 4 table
1.user register
2.login page
3.forgot password
4.welcome page.
all in struts but i dont no how sql
database connected in struts plz
Connection to database - Java BeginnersConnection to database
HI
I have just Started working on a Project on Jsp
We hve some JSP Pages & trying to connect to our
Database .
We are using SQL server 2000 ?
We are not able to connect our
database Tables
connection with database - JSP-Servlet and the
connection with the
database using jsp code, I get exceptions that I have... with java code.
Is there any other way to establish a
connection with
database in jsp... a
connection with
database.
Plz reply.
Thanks in advance...
Hi
database connection - SQL-
database connection in eclipse IDE?
Thanks...
database connection hi friends,
This is poornima i want to connect sql server to my eclipse editer how to connect and where i have to write code
Database connection sql server 2005 - JDBCDatabase connection sql server 2005 Hi all i am developing an
application in struts and i need to connect
database for that
application using sql server 2005..
can anyone tell me how to make
database connection ..plz help me
java database connection - JDBCjava
database connection sir i want to join my project with MS access
database. i am making my project in netbeans.please tell me the coding to do... the data into the MS Access
database and retrieve the data from the
database table
Database Connection - JDBCDatabase Connection In java How will be connect
Database through JDBC? Hi Friend,
Please visit the following link:
http://www.roseindia.net/jdbc/jdbc-mysql/MysqlConnect.shtml
Thanks
database connection by using java beandatabase connection by using java bean i need a code for bean class to connect to mysql
database.
subsequently to use dis bean class whereever i need 2 connect 2
database connection database errorconnection database error import java.awt.EventQueue; // import packages
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener...{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection error oracle database connection?error oracle
database connection? hi now i am trying to connect oracle
database and also insert my data into table, but it's not working.. I created...;
PreparedStatement stmt=null;
Connection con =null;
ResultSet rs=null
Java Connection to Oracle databaseJava
Connection to Oracle database HI
I am ubable to connnect jdbc to Oracle database.i had gone to control panel >>Administrative... type properly and the Test
Connection failed.So Kindly tell me what to type in TNS
java database connection - Strutsjava
database connection how to connect a
database in struts program? First Add two jar file1> commons-dbcp-1.2.x.jar2> mysql...; value="jdbc:mysql:///
database_name?autoReconnect=true"
java database connectionjava
database connection package com.tsi.constants;
public class Constant {
public static final String DRIVER = "oracle.jdbc.driver.OracleDriver";
public static final String DBURL = "jdbc:oracle:thin
java database connectionjava
database connection package com.tsi.constants;
public class Constant {
public static final String DRIVER = "oracle.jdbc.driver.OracleDriver";
public static final String DBURL = "jdbc:oracle:thin
server database connection - JSP-Servlet" in that case how we will get the
database connection Hi Friend...server
database connection sir generally we will connect to the
database by using the following steps
1.Class.forName("sun.jdbc.odbc.JdbcOdbcDriver
About connection database oracle to javaAbout
connection database oracle to java Hi
I culdn't connect... to verify that
connection is correct or not.The testing has failed .so what could... that i
can again upload oracle to the system
About connection database oracle to javaAbout
connection database oracle to java Hi
I culdn't connect... to verify that
connection is correct or not.The testing has failed .so what could... that i
can again upload oracle to the system
About connection database oracle to javaAbout
connection database oracle to java I culdn't connect oracle... that
connection is correct or not. The testing has failed .so what could be TNS... that i
can again upload oracle to the systm. Blockquote
About connection database oracle to javaAbout
connection database oracle to java I culdn't connect oracle... that
connection is correct or not.The testing has failed .so what could be TNS... that i
can again upload oracle to the systm. Blockquote
About connection database oracle to javaAbout
connection database oracle to java **Hi
I culdn't connect... to verify that
connection is correct or not.The testing has failed .so what could... the system.so that i
can again upload oracle to the systm.Blockquote
Correctly Open and Close database connection;
}
Completely Open and Close A
Database Connection
Database Connection... and close
database connections properly. If any
database
connection is open... important to close the
database connection after it is used.
Database connection