can modify this application connection with database

Ads
 

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

Please visit the following link:

http://www.roseindia.net/java/example/java/swing/addeditanddeleteemployee_inf.shtml

Above link will be helpful for you.

Ads









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.
DataBase Connection
DataBase Connection  How to connect java and Oracle 10g? Tell me Jdbc connection
Advertisements
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
database connection
database connection  how to connect the jsp page with database
android connection to database oracle 10g
android connection to database oracle 10g  Hello, How i can connect my android application to my oracle 10g database
database connection
database 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
JAVA DATABASE CONNECTION WITH JTABLE
JAVA DATABASE CONNECTION WITH JTABLE  HOw To Load Database Contents From Access Database to JTable without using Vector
How can i modify my account in roseindia
How can i modify my account in roseindia  Presently am not using my gmail id. I have to modify my roseindia account. Please send the answer to following mail id
ModuleNotFoundError: No module named 'database-connection'
ModuleNotFoundError: No module named 'database-connection'  Hi, My... named 'database-connection' How to remove the ModuleNotFoundError: No module named 'database-connection' error? Thanks   Hi
ModuleNotFoundError: No module named 'database-connection'
ModuleNotFoundError: No module named 'database-connection'  Hi, My... named 'database-connection' How to remove the ModuleNotFoundError: No module named 'database-connection' error? Thanks   Hi
Database connectivity Hibernate mysql connection.
Database connectivity Hibernate mysql connection.  How to do database connectivity in Hibernate using mysql
Regading Database connection
Regading Database connection  if we create the query table means how we retrive the query content from database
database application in objective c
database application in objective c  How to create a database application in XCOde
connection database error
connection 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
Database connection class in a live project ..??
Database connection class in a live project ..??  In a Live mvc project where should i put the database connection class ? I want to know in the best coding practice
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 database
Java 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
database connection by using java bean
database 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
java database connection
java 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 connection
java 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
ModuleNotFoundError: No module named 'wf-database-connection-honeycomb'
to install padas library. You can install wf-database-connection-honeycomb python...ModuleNotFoundError: No module named 'wf-database-connection-honeycomb' ...: ModuleNotFoundError: No module named 'wf-database-connection-honeycomb' How to remove
ModuleNotFoundError: No module named 'aafp-database-connection'
can install aafp-database-connection python with following command: pip...ModuleNotFoundError: No module named 'aafp-database-connection'  Hi...: No module named 'aafp-database-connection' How to remove
ModuleNotFoundError: No module named 'wf-database-connection'
ModuleNotFoundError: No module named 'wf-database-connection'  Hi...: No module named 'wf-database-connection' How to remove the ModuleNotFoundError: No module named 'wf-database-connection' error? Thanks   Hi
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
DataBase Connectivity with MySql in Visual Web JSF Application Using Net Beans IDE
. In this application, we are going to create a database connection with mysql step...DataBase Connectivity with MySql in Visual Web JSF Application Using Net Beans...;  This Application illustrates how to create database
About connection database oracle to java
About 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 java
About 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 java
About 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 java
About 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 java
About 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

Ads