java code using swings

java code using swings

code that should be able to enter data of student details using all swings into the access database using jdbc connectivity

View Answers

July 23, 2011 at 10:37 AM

import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;
class  FormData{
    public static void main(String[] args){
    Frame f=new Frame();
    Label label1=new Label("Emp No: ");
    Label label2=new Label("Emp Name: ");
    Label label3=new Label("Salary: ");
    final TextField text1=new TextField(20);
    final TextField text2=new TextField(20);
    final TextField text3=new TextField(20);
    Button b=new Button("Save");
    b.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
        int v1=Integer.parseInt(text1.getText());
        String v2=text2.getText();
        int v3=Integer.parseInt(text3.getText());
        try{
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           Connection con = DriverManager.getConnection("jdbc:odbc:student");
           String sql = "insert into emp(EMP_NO,EMP_NAME,SALARY) values(?,?,?) ";
           PreparedStatement pst = con.prepareStatement(sql);

            pst.setInt(1, v1);
            pst.setString(2, v2);
            pst.setInt(3,v3);
            pst.executeUpdate();
           JOptionPane.showMessageDialog(null,"Data is inserted successfully");
        }
        catch(Exception ex){
            System.out.println(ex);
        }
        }
    });
        Panel p=new Panel(new GridLayout(5,2));
        p.add(label1);
        p.add(text1);
        p.add(label2);
        p.add(text2);
        p.add(label3);
        p.add(text3);
        p.add(b);
        f.add(p);
        f.setVisible(true);
        f.pack();
    }
}









Related Tutorials/Questions & Answers:
java code using swings
java code using swings  code that should be able to enter data of student details using all swings into the access database using jdbc connectivity
want a program for date picker by using java swings
want a program for date picker by using java swings  to write a program for the date picker by using java swings.any one please help me by providing the code to this java date picker by using the java swings.previously a program
Advertisements
Image Movement using Swings
Image Movement using Swings  How to move image using Swings
An application using swings and vector methods
An application using swings and vector methods   Hi, I want an application in Java swings which uses good selection of Vectors methods
making of dynamic textfields using swings
making of dynamic textfields using swings  How to make dynamic textfields using java swings
how can i draw a table using applet or swings - Java Beginners
how can i draw a table using applet or swings  Hi RoseIndia, Actually, I was trying for creating a table using applet or swings.......... My task... Mohammed Afsar  Hi Friend, Try the following code: import java.awt.
virtual onscreen keyboard project using java and swings - Swing AWT
virtual onscreen keyboard project using java and swings  Im doing... backspace and space operation using swings in java.can please help me  Hi Friend, Try the following code: import java.util.*; import java.awt.
another frame by using awt or swings
another frame by using awt or swings  how to connect one frame to another frame by using awt or swings
how to store data in table using swings - Java Beginners
how to store data in table using swings  Hi, I am doing a project in which i need to store some data in the table using swings.......Iam using... , whether do i have any option in swings to increase my output look (my target
java code using while loop
java code using while loop  
java code for PartialSearch using Map????
java code for PartialSearch using Map????  java code for Partial Search using Map
virtual onscreen keyboard project using java and swings - Swing AWT
virtual onscreen keyboard project using java and swings  sir thanks... project code of virtual on screen keyboard.i did but im not sure as it was right or not  Hi Friend, Please send your code. Thanks
How can i draw a line using java swings
How can i draw a line using java swings  Sir my program contains different components i am using JFrame. I want to draw a straight line between components(Jtextfeilds, Jlabels).So could you help me for it. Thank You
How can i draw a line using java swings
How can i draw a line using java swings  Sir my program contains different components i am using JFrame. I want to draw a straight line between components(Jtextfeilds, Jlabels).So could you help me for it. Thank You
Java Swings
Java Swings  I am doing one project on java Swings, in this i have created one jframe where i defined some JButtons and Jcombobox's, here i need to insert one JTable with headers(IN CURRENT JFrame only).pls help me urgently
java swings - Java Beginners
java swings   Hi, I need the code for click the refresh button then list values will be refresh.Please send the code ........... Thanks, Valarmathi
java swings - Java Beginners
java swings   Do you want to add textfields on the JPanel
making of dynamic textfields using swings
making of dynamic textfields using swings  how to crate dynamic texfields by clicking on button
java swings - Swing AWT
java swings  I am doing a project for my company. I need a to show the performance of the employees by using bar bharts. Please give me how can we write the code for bar charts using java swings.  Hi friend, I am
java swings
java swings  Hi, I have one class file using three panel methods,the three methods is used for three tabs.then how can i set the background image.Please send the sample code for me. I already posted two questions,but i didnt get
java swings
java swings  Hi, I need a sample code for once click the exit tab the frame window will be closed. Instead of button close i need tab close option.Please send the sample code immediately.......?Its very urgent........ Thanks
java swings
java swings  Hi, I need the sample code for how to set the background image using jframe and also set the jtext field and jlable boxes under the bachground image. Please send the code immediately,its very urgent.Please send me
java swings
java swings  hi... I am having multiple swing forms.. when i click on a button another form is going to opening but it is opening as different form... Now i want it to be open dynamically instead separately.... Is there any
java swings
java swings  how can we use the shared locks of dbms in java? I am working on a mini project which is based on the eamcet councilling .i am struck with a problem where if a student select a college and a branch and sees
java swings - Java Beginners
java swings   Hi, I need the code for joptionpane with jcombobox. my requirement is click on add button,one joptionpane will come.from the option pane i need to select the combobox values. Please send the sample code
code for multiplication of matrix in java using methods
code for multiplication of matrix in java using methods  code for multiplication of matrix in java using methods
parsing xml file using java code
parsing xml file using java code  parsing a xml file using java code
Reading RDF file using Java code in Eclipse
Reading RDF file using Java code in Eclipse  Could you please tel me what this statement means - Model model = ModelFactory.createDefaultModel
java code using combobox,radiobutton,checkbox
java code using combobox,radiobutton,checkbox  hi, send me java code for entering student details into ms access database, the code should includes combo box,radiobutton and checkboxes pl send as early as possible
View source code of a html page using java ..
View source code of a html page using java ..  I could find the html source code of a web page using the following program, http://download.oracle.com/javase/1.4.2/docs/api/java/net/URLConnection.html i could get the html code
Error in MySQL Procedure Using JAVA Code
Error in MySQL Procedure Using JAVA Code  The following Java code (using Connector/J to create a stored procedure on MySQL 5.0) does not execute successfully. Identify the cause and available solutions. statement.execute
java plugin code for nutch using filter indexer
java plugin code for nutch using filter indexer  hello: i want... in the doc.add(name,value) . I don't know what is the error in it. Tthis is the code... = conf; } } I think that the error is in using parsedData but I don't know what I
determinant of n*n matrix using java code
determinant of n*n matrix using java code  Here is my code: import java.util.Scanner.*; import java.util.*; public class determinantcode { double A[][]; double m[][]; int N; public input() { Scanner s=new
about swings - Java Beginners
about swings   Dear sir,Good evening, i am doing mca sir,i am doing the project in swings,so plz provide the material about swings sir...: http://www.roseindia.net/java/example/java/swing/ Hope
plz help me to write a snake game using swings - Swing AWT
plz help me to write a snake game using swings  write snake game program using swings
java swings - Java Beginners
java swings   Hi, I already posted the question for three times.... I have two listboxes.If i select first value in the first listbox and moved... code............. jboss.mq:service
SWINGS
SWINGS  WHAT ARE THE DIFFERENCES BETWEEN AWT AND SWINGS
How to write the code for date in swings - Struts
How to write the code for date in swings  Hi Friends, I want to code for display the calendar.......technologies use only swing and core java also how to display calendar like that popup window.....please write and send me
java swings - Java Beginners
java swings   Hi, I have two classes(two tabbed panes). how can i... the code as sson as possible. Thanks, Valarmathi  Hi Friend, Try the following code: 1)ClassA.java import java.awt.event.*; 2
java client server program for playing video file(stored in folder in the same workspace) using swings
java client server program for playing video file(stored in folder in the same workspace) using swings  Hello friends this is RAGHAVENDRA, I am doing a client server program to play a video file, when I run both client and server
java client server program for playing video file(stored in folder in the same workspace) using swings
java client server program for playing video file(stored in folder in the same workspace) using swings  Hello friends this is RAGHAVENDRA, I am doing a client server program to play a video file, when I run both client and server
java client server program for playing video file(stored in folder in the same workspace) using swings
java client server program for playing video file(stored in folder in the same workspace) using swings  Hello friends this is RAGHAVENDRA, I am doing a client server program to play a video file, when I run both client and server
java client server program for playing video file(stored in folder in the same workspace) using swings
java client server program for playing video file(stored in folder in the same workspace) using swings  Hello friends this is RAGHAVENDRA, I am doing a client server program to play a video file, when I run both client and server
swings - Java Beginners
for this in google, but i got very difficult programs. i am beginner in java swings . i want... Friend, Try the following code: import java.awt.*; import javax.swing....); } } For more information, visit the following link: http://www.roseindia.net/java
java swings - Java Beginners
java swings   Hi , I have two listboxes.I want to move one listbox value into another listbox using add button. I have the code....Please check... correct the value and send it to me. This is my java code package
java swings - JavaMail
java swings  Hi sir,i am doing a project on swings,i don't have any...://www.roseindia.net/java/example/java/swing/GrideComponents.shtml http://www.roseindia.net/java/example/java/swing/AbsCoordinate.shtml http://www.roseindia.net
swings - Java Beginners
swings  how to upload images using swings   Hi Friend, Try the following code: import java.awt.*; import java.io.*; import javax.swing.*; import java.awt.image.*; import java.awt.event.*; import
java swings - Java Beginners
java swings   Hi, This is my code. How can i set the jtextfield...", Font.BOLD, 12)); javapathname = new JLabel("Java Path"); javatextpath = new JTextField(33); javatextpath.setToolTipText("Java Installation Path
java swings - Java Beginners
java swings   hi, I posted the same question two times,but i didnt... the code immediately. This is my code package com.zsl.ibm.mqtool; import... code as we have done in the following code. import javax.swing.*; import
Java Swings problem - Swing AWT
Java Swings problem  Sir, I am facing a problem in JSplitPane. I want... of using BasicSplitPaneUI, BasicSplitPaneDivider etc etc but no solution. Please give me a complete source code to achieve this. Please

Ads