Home Answers Viewqa Java-Beginners can modify this application connection with database

 
 


vincent mon
can modify this application connection with database
1 Answer(s)      a year and 2 months ago
Posted in : Java Beginners

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.









Related Pages:
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.
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
please modify this so that it can work better - Swing AWT
please modify this so that it can work better   this program is about opening a savings account, i need any one to modify it and add new features to it to make i more better.no database is needed. the codes are; // class
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 Pooling (DBCP)
within a giant database application. The database enabled applications needs the database connection for processing the request send by the clients... to relating clients. There are several Database Connection Pools already available
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 sql server 2005 - JDBC
Database 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
Understanding Connection Object
with a database. When we connect to a database by using connection method, we create a Connection Object, which represents the connection to the database. An application may have one or more than one connections with a single database
J2ME with Database Connection - MobileApplications
J2ME with Database Connection  I'm using SonyEricssion Java ME SDk for CLDC with WTK2. Can u give me a sample program for Database Connection using MS-Access with MIDlet code
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. Here is the sample code to connect
Connection to database - Java Beginners
Connection 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
Java-Connection Pool - JDBC
Java-Connection Pool  How can I create a connection pool. My database is MS SQL server 2000(username-sa, pwd-admin) and my application server is Weblogic 8. Which is the best approach to create a connection pool? Kindly help
modify this so that i can work better - Swing AWT
modify this so that i can work better  this program is about opening a savings account, i need any one to modify it and add new features... OpenSavingsAccount2() { super("Savings Account Application Form"); setLayout
connection pooling - JDBC
friend, A connection pool is a cache of database connections maintained by the database. This results connections can be reused when the database receives... commands on a database. It open and maintain a database connection for each user
JDBC Connection Pool
database connection in resource pool. You can make your own code for JDBC... and see how to use Apache DBCP for creating the database connection pool. We... application will give you improved performance if you use the JDBC Connection
database connection in javascript - Java Beginners
database connection in javascript  hi, How can i connect the database and insert the data's by using javascript. thank u in advance. ragards, sakthi
connection
connection   how to make multiple database connection using jdbc
How can I to my database to my application
How can I to my database to my application  How can I to my database to my application   Hi, Please see the JDBC discussion thread. Thanks
Connection pooling
database connections.   Hi, Connection pool stores a number of collection in a pool. This pool is called the Connection pool. In your Java program you can get the database connection and use and then close (returned to the pool
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
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
How can I protect my database password ?
How can I protect my database password ?   How can I protect my database password ? I'm writing a client-side java application that will access..., where the connection string to the database, including user and password, is stored
JDBC Connection Example
; package. An connection object represents a connection with specific database. A single application can have more than one Connection object with a single.... To create a connection with database you need to call a method
connection
connection   How to get connected to my database using jsp   Please visit the following links: http://www.roseindia.net/jsp/connectjspwith_mysql.shtml http://www.roseindia.net/jsp/displaydatafrom_database1.shtml http
DataBase Connection
DataBase Connection  How to connect java and Oracle 10g? Tell me Jdbc connection
connection pooling - Java Interview Questions
Pooling : A connection pool is a cache of database connections maintained by the database. This results connections can be reused when the database receives... commands on a database. It open and maintain a database connection for each user
connection
connection  sir i have created a web page for login form and i have also created the related data base in both ms access and oracle 10g now how to store those values in form to databases can u plz hlp me
Common connection in JSP - JSP-Servlet
Common connection in JSP  Hi I am creating an JSP application. I... connection to database. I am able to get connection in other(common) JSP..., We are providing you the code where we have used database Connection object
PHP Mysql Database Connection
. Before you can access data in a database, you must create a connection... PHP Mysql Database Connection       PHP Mysql Database Connection is used to build a connection
database connection
database connection  how to connect the jsp page with 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
A JDBC Connection Pooling Concept
object pooling. Connection pooling is very useful for any application which uses database database as backend. Database connection is very expensive to create... the connection, this take more time, therefore application becomes slower
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
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
Pentaho Report Designer connection through Property files
, every time i need to modify the report connection string. So if there are too many reports, changing connection string every time has become cumbersome. Can anyone provide a code where i can pick the connection string directly from property
Error in connecting to the mySQL database in TOMCAT using more than one PC (database connection pooling)
the same application/database, I get a java.lang.NullPointer Exception. Can you help...Error in connecting to the mySQL database in TOMCAT using more than one PC (database connection pooling)  how do i implement connection pooling
Regarding connection between sqlserver 2005 and android application
Regarding connection between sqlserver 2005 and android application  hi to all, i want to know how to create webservice to connect sqlserver 2005 and android. can you please help me by providing source code for ref.. thanks
REQ for connection b/w jdbc and oracle database
REQ for connection b/w jdbc and oracle database    REQ for connection b/w jdbc and oracle database    The Java classes to connect... for, such as ojdbc14.jar (for Java 1.4), ojdbc15.jar (for Java 1.5), etc. These drivers can
How to connect to database to my application if the database is made up in oracle
How to connect to database to my application if the database is made up in oracle  How to connect to database to my application if the database...:*** DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); or you can use
Configure JMS connection factories and destinations
of database connectivity and messaging within IBM WebShpere Application Server Next    Configure JMS connection factories... Configure JMS connection factories
database
database  Can you please help me to establish database connection to ms sql 2000 from java swing in netbeans
close a Connection application
close 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
JAVA DATABASE CONNECTION WITH JTABLE
JAVA DATABASE CONNECTION WITH JTABLE  HOw To Load Database Contents From Access Database to JTable without using Vector
JDBC connection timeout
. Once a connection is built ,your application page can interact with backend... for which driver can wait to connect database. Understand with Example... the maximum time for the driver can wait while trying to connect a database
Sql Connection is not creating
Sql Connection is not creating  Hi i am developing an web application..for that i am using excel as database. To connect for database am using jdbc... it is creating sql connection and allwoing me to access excel but when i am
jsp connection to db2
jsp connection to db2  hello friends i have a project to do in jsp using db2 database can anyone please help me in connecting a jsp page to db2 database?? please frienda help me

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.