how to add database in Java Applet

how to add database in Java Applet

hi every java master or Java Professional my name is vincent i'm java beginners hope u all can ,tech me how to add database in Java Applet below this code is my applet source code .

thank you

import javax.swing.*; import java.applet.*; import java.awt.*; import java.util.*; import java.text.*; import java.awt.event.*;

public class RC extends Applet implements ActionListener{ TextField text,text1,text2,text3,text4,text5,text6,text7; Label label1,label2,label3,label4,label5,label6,label7,label8,label9; Label lab; Button b1,b2; JComboBox combo; DecimalFormat df = new DecimalFormat("$##.##"); public void init(){ setLayout(null);

lab=new Label("Welcome to Rental Car System");
lab.setBounds(100,20,200,20);
add(lab);

label1 = new Label("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 Label("Enter number of days: ");
label2.setBounds(20,80,180,20);
add(label2);

text = new TextField(5);
text.setBounds(200,80,100,20);
add(text);

b1 = new Button("Submit");
b1.setBounds(200,140,100,20);
add(b1);
b1.addActionListener(this);

label3=new Label("Enter Customer Name: ");
label3.setBounds(20,60,180,20);
add(label3);

text1=new TextField(10);
text1.setBounds(230,60,150,20);
add(text1);

label4=new Label("Enter IC Number: ");
label4.setBounds(20,90,180,20);
add(label4);

text2=new TextField(10);
text2.setBounds(230,90,150,20);
add(text2);

label5=new Label("Enter Age: ");
label5.setBounds(20,120,180,20);
add(label5);

text3=new TextField(10);
text3.setBounds(230,120,150,20);
add(text3);

label6=new Label("Enter Mobile Number: ");
label6.setBounds(20,150,180,20);
add(label6);

text4=new TextField(10);
text4.setBounds(230,150,150,20);
add(text4);
label7=new Label("Enter  E-Mail Address: ");
label7.setBounds(20,180,180,20);
add(label7);

text5=new TextField(10);
text5.setBounds(230,180,150,20);
add(text5);

label8=new Label("Enter  16 Digit of Credit Card Number: ");
label8.setBounds(20,210,210,20);
add(label8);

text6=new TextField(10);
text6.setBounds(230,210,150,20);
add(text6);

label9=new Label("Enter Pin Code of Credit Card: ");
label9.setBounds(20,240,180,20);
add(label9);

text7=new TextField(10);
text7.setBounds(230,240,150,20);
add(text7);

b2=new Button("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);
 }
     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....!"); } } } } }
View Answers









Related Tutorials/Questions & Answers:
how to add database in Java Applet
how to add database in Java Applet  hi every java master or Java Professional my name is vincent i'm java beginners hope u all can ,tech me how to add database in Java Applet below this code is my applet source code . thank
how to access database in applet
how to access database in applet  HI... I'm having an applet where we should display the database values in the applet... It works fine in the local system(same network)... but when its in the server, we r getting null values
Advertisements
how to retrieve data into combo from database in java applet?
how to retrieve data into combo from database in java applet?  hi,. i have written applet codes for linking two frames and database connectivity but the problem is, the database is not retrieving data into the combo..please
How to add dropdown list in a row of a sort table applet?
How to add dropdown list in a row of a sort table applet?  How to add dropdown list in a row of a sort table applet
Applet database access - Applet
Applet database access  HI... I'm having an applet where we should display the database values in the applet... It works fine in the local system... no change... How to implement this...?? thanks in advance
How to Delete a column and Add a new column to database
How to Delete a column and Add a new column to database   How to Delete a column and Add a new column to database   Hi, The following query is executed for add and delete a column in a table-ADS_TO_REPLACE_1 for drop
Applet to database error - Applet
Applet to database error  Hi... I had an application where i need to connect to the database for the values to display in the applet.... Following... Applet implements MouseListener{ boolean rect1Clicked,rect1Clicked1,mouseEntered
Applet for add two numbers
Applet for add two numbers  what is the java applet code for add two...; } public void paint(Graphics g) { //writes the output in the applet starting... Applet implements ActionListener{ TextField text1,text2,output; Label
java - Applet
java  how to connect database table with scrollbar in java applet
java - Applet
java  how to connect database table with scrollbar in java applet
Java Applet
Java Applet   How to add Image in Java Applet? what is getDocumentBase
While creating a jar how to add MySQL database to project
While creating a jar how to add MySQL database to project  Hi, Please tell me how to attach MySQL database to the Java project while building a jar or their is any other process
how to add to numbers in java
how to add to numbers in java  how to add to numbers in java
how to run applet - Applet
://www.roseindia.net/java/example/java/applet/ http://www.roseindia.net/java/example/java/applet/FirstApplet.shtml Hope that it will be helpful for you.Even...how to run applet   Hi everybody i am using connecting jdbc
How to add BigDecimal in Java?
How to add BigDecimal in Java?  Hi, I have two BigDecimal variables. I want to add these two values. How to add BigDecimal in Java? Thanks   Hello, I will show you how you can add two BigDecimal? Suppose you have
how to make JTable to add delete and update sql database table
how to make JTable to add delete and update sql database table  Hello all I want to know how to make JTable to act actively to add delete and update database table. i am struck ed here from long time please help me
How to write a simple java applet
How to write a simple java applet   Hi, how can i write a simple java applet, displaying text in specific colors and font style. For example... ShowsTextExample extends Applet{ public void paint(Graphics g){ g.setColor
How to add a columns with a button set to a Jtable built with database result set
How to add a columns with a button set to a Jtable built with database result set  hi, i have to build a gui to display account numbers and account... that button column to the table which is built with database result set. i would thank
how to add data dynamically from database into a dropdown list in a jsp
how to add data dynamically from database into a dropdown list in a jsp ... in storing them into the database,this registration form contains name... get dynamically from the database and whenever a new person has registered his
java applet
java applet  If i insert in database from applet this work, but from applet.html don't
How to add dynamically rows into database ?Need help pls
How to add dynamically rows into database ?Need help pls  Hi everyone...; <input type="button" value="Add Row" onclick="addRow();" /> <input...')"; $result = mysqli_query($link, $query) or die('Error querying database
java applet - Applet
java applet  I want to close applet window which is open by another button of applet program. plz tell me!   Hi Friend, Try...://www.roseindia.net/java/example/java/applet/ Thanks
how to convert java Applet to Jave Frame
how to convert java Applet to Jave Frame  hi every java master or Java Professional my name is vincent i'm java beginners hope u all can ,tech me how to convert Java Applet to Jave Frame below this code is my applet source code
java applet - Applet
java applet  wants to creat address bar on my java applet.  Hi Applet don't provide a facility to create a address bar directly. You just create a text box. In this text box if you enter any http address
loading Java Applet - Applet
loading Java Applet  Hi, I use the archive tag to download my applet into the Browser It takes too long to load. Can I do it in several steps... control the loading within the applet? thanks
add record to database - JDBC
add record to database  How to create program in java that can save record in database ?  Hi friend, import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; public class
How to add dynamic table in java
How to add dynamic table in java  How to add dynamic table in java   import java.awt.*; import java.sql.*; import java.util.*; import javax.swing.*; import java.awt.event.*; import javax.swing.table.*; public class
Java applet
Java applet   How do I go from my applet to another JSP or HTML page
java applet problem - Applet
java applet problem  i was doing a program using java applet. I want... for add,multiply,divide,minus and a clear and exit button to clear the textboxes and to exit from the applet respectively.Now i want to display a message when
Java Applet
Java Applet  Hi, What is Java Applet and how it can be useful in development of Java programs? Can anyone tell me the url to learn Java Applet? Thanks   Hi, See the tutorial at: Applications and Applets Thanks
java - Applet
java  how to communicate to my servlet through applet.   ... this information to the servlet in the normal way. The applet pretends... is concerned, the applet is just another HTTP client. For more infomation
Add a file into database
Add a file into database  Provide the code to upload a file into oracle database?   1)page.jsp <%@ page language="java" %> <Html> <HEAD><TITLE>Display file upload form to the user</TITLE>
java - Applet
java  what is applet?  Hi Friend, Please visit the following link: http://www.roseindia.net/java/example/java/applet/ Thanks
java applet
java applet   I want code to implement (1) user will enter how many nodes (2)it should allow that no. of clicks and circle should be displayed at that position
Add Items in JComboBox from Access Database - Java Beginners
Add Items in JComboBox from Access Database  Heelo Sir I want To add ittem in JComboBox which is stored in Access Database. plz Help Me Sir Database Column name -Course Items -MBA,MCA,MBA IT,MBA FINANCE I want Load Database
java applet
java applet  why java applet programs doesn't contain main method
java applet
java applet  why java applet programs doesn't contain main method
Java applet
Java applet  What tags are mandatory when creating HTML to display an applet
How to add
How to add   Hi, I want to make a website which will recommend users books according to the genre selected by them. I am using PHP, JavaScript and mySQL. The problem is that there will me almost more than 100 books
java - Applet
java  what is applet
How to create Applet Hello World?
How to create Applet Hello World?  Hi, What is Applet in Java? How to create Applet Hello World? Thanks   Hi, Applet is Java Program... to create applet class in Java and then compile it into class file. After
How to add two numbers in Java?
How to add two numbers in a Java program? In Java you can easily add two number by using the plus (+) operator. The plus operator will add two... this will print: Sum is: 30 So, in this program you learned how to sum(add) two numbers
how to draw network(lines and nodes) in java - Applet
how to draw network(lines and nodes) in java  Hi, Iam doing my MSC project. I want to know, how can we draw a network(with lines and nodes, any number of lines and nodes... say 5). I also want to know how can we draw a graph
The Java Applet Viewer
The Java Applet Viewer       Applet viewer is a command line program to run Java applets...; the browser should be Java enabled.To create an applet, we need to define
disable keyboard in java applet
disable keyboard in java applet  How to disable key board of my client in an java applet embedded in a website while the applet is running.? Plz help
how to import user-define package to applet - Applet
how to import user-define package to applet  how to import user-define package to applet... can u write a java coding can execute in jdk only...; public class JavaApplet extends Applet{ public static final String DATE
how to add date and change date in java - netbeans
how to add date and change date in java - netbeans  I need to code use to increase date How to get date after 30 days using netbeans
java applet
java applet  create applets to accept the personal details and sales details in the database. create jdbc application to connect the applets with the database
How to add key value pair in Java
How to add key value pair in Java  Hi, I have to store the key and value pair in Java. How to store key value pair in Java? Thanks   Hi, You can use the put method of Hashtable. Check the tutorial Creating a Hash
java applet notpad
java applet notpad  i need Codes Or programe in java applet ; i want add this programe to my site html > please help me our   Learn Java...: Java Applet Tutorials

Ads