projects on cyber cafe

Ads

 
 

Share on Google+Share on Google+

Sumeeta Mudhaliyar
projects on cyber cafe
1 Answer(s)      6 years and 9 months ago
Posted in : Swing AWT

To accept details from user like name Birth date address contact no etc and store in a database

Ads
View Answers

January 24, 2011 at 12:25 PM


Hi Friend,

Try this:

import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;
class  FormData{

    public static void main(String[] args){
    JFrame f=new JFrame();
    JLabel label1=new JLabel("Name: ");
    JLabel label2=new JLabel("Date Of Birth: ");
    JLabel label3=new JLabel("Address: ");
    JLabel label4=new JLabel("Contact No: ");
    final JTextField text1=new JTextField(20);
    final JTextField text2=new JTextField(20);
    final JTextField text3=new JTextField(20);
    final JTextField text4=new JTextField(20);
    JButton b=new JButton("Save");
    b.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
        String v1=text1.getText();
        String v2=text2.getText();
        String v3=text3.getText();
        int v4=Integer.parseInt(text4.getText());

        try{
           Class.forName("com.mysql.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
           Statement st=con.createStatement();
           int i=st.executeUpdate("insert into data(name,dateOfBirth,address,contactNo) values('"+v1+"','"+v2+"','"+v3+"',"+v4+")");
           JOptionPane.showMessageDialog(null,"Data is inserted successfully");
        }
        catch(Exception ex){
            System.out.println(ex);
        }
        }
    });
        JPanel p=new JPanel(new GridLayout(5,2));
        p.add(label1);
        p.add(text1);
        p.add(label2);
        p.add(text2);
        p.add(label3);
        p.add(text3);
        p.add(label4);
        p.add(text4);
        p.add(b);
        f.add(p);
        f.setVisible(true);
        f.pack();
    }
}

Thanks


Ads









Related Tutorials/Questions & Answers:
projects on cyber cafe
projects on cyber cafe  To accept details from user like name Birth date address contact no etc and store in a database   Hi Friend, Visit Here Thanks
projects on cyber cafe
projects on cyber cafe  To accept details from user like name Birth date address contact no etc and store in a database   Hi Friend, Visit Here Thanks
Advertisements
projects on cyber cafe
projects on cyber cafe  To accept details from user like name Birth date address contact no etc and store in a database   Hi Friend, Try this: import java.awt.*; import java.sql.*; import javax.swing.*; import
Cyber Cafe Billing Application in Java
Cyber Cafe Billing Application in Java In this section, we are going to create a bill of Cyber Cafe. Now to create this bill, we have allowed the user... number of hours: 3 *****Cyber Cafe***** Name: Anusmita You have
Cyber Dummy
Cyber Dummy       AJAX code samples and source code Read full Description
projects
projects  any billing projects in java please send message in the following email id
projects
projects  hi'Sir thank's How to make collage library projects in gui or java code with from design
java projects
java projects  I am interested to developed the JAVA projects. But I want to some help about java example projects. So give me suggestions to developed the java projects by me.   Please visit the following links: http
Cafe and Restaurant Website Design
Cafe and Restaurant Website Design We provide high quality Cafe and restaurant... and development team will help you in developing websites templates for boosting your Cafe... and maintaining websites for cafe and restaurant industry. A website is the virtual
Java Projects
Java Projects  Can anyone please share java projects for college submission with source code?? Thanks
java projects
java projects  i have never made any projects in any language. i want to make project in java .i don't know a bit about this .i am familar with java.please show me the path please......   Hi, You can develop
Java Marketing projects
Java Marketing projects  Java Marketing projects
JAva Projects - Java Magazine
JAva Projects  I need Some Java Projects
Threads in realtime projects
Threads in realtime projects  Explain where we use threads in realtime projects with example
java projects - Java Beginners
java projects  hi, im final yr eng student.plz give me latest java or web related topics for last yr projects
Simple Java Projects
Simple Java Projects  Hi, I am beginner in Java and trying to find Simple Java Projects to learn the different concepts on Java. Can anyone tell me where to get it? Thanks
procedures to create struts projects?
procedures to create struts projects?  i am new to learn in struts. i am start to learn struts program, How to create a struts projects explain with step by step procedure.   Please visit the following link: Struts
Version of com.garethahealy>projects-pom dependency
List of Version of com.garethahealy>projects-pom dependency
Version of com.pddstudio>iconmanager-projects dependency
List of Version of com.pddstudio>iconmanager-projects dependency
Java Example projects about STRUTS
Java Example projects about STRUTS  Hai... I completed MCA but i have no job in my hands. But i do some small projects about STRUTS. Please send me some example projects about STRUTS.   Please visit the following link
Java projects for beginners
In this tutorial you will be briefed about the Java projects for beginners who have to various ideas and projects, which is likely to involving Java. Java... of complex java projects as far as you can imagine and think, as these projects
Maven Dependency projects-pom >> 1.0.1
You should include the dependency code given in this page to add Maven Dependency of com.garethahealy >> projects-pom version1.0.1 in your project
Maven Dependency projects-pom >> 1.0.2
You should include the dependency code given in this page to add Maven Dependency of com.garethahealy >> projects-pom version1.0.2 in your project
Maven Dependency projects-pom >> 1.0.3
You should include the dependency code given in this page to add Maven Dependency of com.garethahealy >> projects-pom version1.0.3 in your project
Maven Dependency projects-pom >> 1.0.4
You should include the dependency code given in this page to add Maven Dependency of com.garethahealy >> projects-pom version1.0.4 in your project
Maven Dependency projects-pom >> 1.0.5
You should include the dependency code given in this page to add Maven Dependency of com.garethahealy >> projects-pom version1.0.5 in your project
Maven Dependency projects-pom >> 1.0.6
You should include the dependency code given in this page to add Maven Dependency of com.garethahealy >> projects-pom version1.0.6 in your project
Maven Dependency projects-pom >> 1.0.7
You should include the dependency code given in this page to add Maven Dependency of com.garethahealy >> projects-pom version1.0.7 in your project
Maven Dependency projects-pom >> 1.0.8
You should include the dependency code given in this page to add Maven Dependency of com.garethahealy >> projects-pom version1.0.8 in your project
Maven Dependency projects-pom >> 1.1.0
You should include the dependency code given in this page to add Maven Dependency of com.garethahealy >> projects-pom version1.1.0 in your project

Ads

 
Advertisement null

Ads