Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners display he new customer no in textbox
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


dhanashree darshale
display he new customer no in textbox
1 Answer(s)      3 years and 8 months ago
Posted in : Java Beginners


i want to add the new customer for that when i click on add butto the new customernumber should be display in textfield . plz ell me the suggestions & code


Advertisement
View Answers

February 28, 2011 at 4:59 PM


Java Display new value to textbox:

import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;
class TextFieldExample
{
    public static void main(String[] args){
    Frame f=new Frame();
    Label label1=new Label("No: ");
    Label label2=new Label("Name: ");
    Label label3=new Label("Address: ");
    final TextField text1=new TextField(20);
    final TextField text2=new TextField(20);
    final TextField text3=new TextField(20);
    text1.setText("1");
    Button b=new Button("Add");
    b.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
        int v1=Integer.parseInt(text1.getText());

        String v2=text2.getText();
        String v3=text3.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 user(id,name,address) values("+v1+",'"+v2+"','"+v3+"')");
           JOptionPane.showMessageDialog(null,"Data is inserted successfully");

        }
        catch(Exception ex){
            System.out.println(ex);
        }
        v1=v1+1;
           text1.setText(Integer.toString(v1));
           text2.setText("");
           text3.setText("");
        }
    });
        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:
display he new customer no in textbox
display he new customer no in textbox   i want to add the new customer for that when i click on add butto the new customernumber should be display in textfield . plz ell me the suggestions & code
customer
a deposit. The program should display the new balance. g. Use JOptionPane to allow a user withdraw an amount. The program should display the new balance...customer  At MKO Bank, a customer should be able to deposit money
Advertisements
display data from database in textbox when id entered in textbox
display data from database in textbox when id entered in textbox  i wanted to enter data in textbox .depending on entered data in textbox data from database should be displayed dynamically in textbox
How to display current date in textbox - Date Calendar
;% } This is my problem: I want to display current date in textbox...How to display current date in textbox  Hi guys, I'm really need your help. This is my source code. var currentTime = new
How to display on textbox using ObjectUtil class
How to display on textbox using ObjectUtil class... how to display a text in textbox using ObjectUtil class. Here...: Object=new Object(); private function initApp():void
For every option selected from a dropdown a new textbox opens
For every option selected from a dropdown a new textbox opens  I have a dropdown with four options, each time I select an option a new text box... the button, everytime a textbox will get displayed. <html> <script>
Display an textbox when user Clicks checbox in struts Tags - Struts
Display an textbox when user Clicks checbox in struts Tags  Hi Friend. I need an code for to Display text box when the user clicks checkbox in struts.Pls hekp me.. Note:,... using this kind of tags alone.. Thanks
HOW TO DISPLAY ID IN TEXTBOX BASED ON COMBOBOX SELECTION IN A SAME PAGE
HOW TO DISPLAY ID IN TEXTBOX BASED ON COMBOBOX SELECTION IN A SAME PAGE  Dear sir, Am having one table called rolemaster. In that there are 2 fields... is how to get Roleid in textbox when i select Role_name from combobox in a same
how to display textbox value based on selected option value?
how to display textbox value based on selected option value?  Hi,I have some problem. I use jsp and ajax. first select: 1 second select:2 based on first value I finished above code. ID: xx Name:xx xx is baesd on second
Customer Relationship Management
to the customer rather making new customer is the key factor for survival of any business in these time. Also creating new customer and keeping old one with loyal... and their interests and tastes should not be ignored. Creating new customer
I want to display the quantity of the selected item of a drop down list in a textbox. The data is stored in database.
I want to display the quantity of the selected item of a drop down list in a textbox. The data is stored in database.  The code for retrieving data from database into Drop Down List. <% DataSource data = new
customer details
customer details  write a java code to enter n number of persons details(name,address,phone number) in a array list. Also consider exceptional cases like entering integer in name,character in phone number. use try,catch ,throw
how to display each arraylist value on new page in jsp
how to display each arraylist value on new page in jsp  hi!!!! i want to display each arraylist value on new page in jsp????? and also want to access the arraylist values using next button..... any help would be appreciated
Display values in textbox on selecting checkbox
Display values in textbox on selecting checkbox Here we are going to perform action on selecting the checkbox and display the first five text box values... in first five textbox, the same values will get displayed in next 5 textboxes
Validation for customer information
Validation for customer information  hi.... I have created one jsp page which contains customer infomation such as name,city,emailid,mobileno,date of birth.I want to do validation for all these fields using javascript....customer
new
new    hi i am jane pls explain the difference between string greeting = good morning string greeting = new string ("good morning
new
new  hi the difference between string sname = good morning string sname =new("good morning
new
new    hi i am jane pls explain the difference between heap memory and stack memory
new
new   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html
list and textbox
will display the details. similar to a mobile dictionary. how can i do
retaining textbox values
retaining textbox values  i have a calculator program, when i press a button the value displays but disappears when i press another button so how can i keep values to display when i press multiple buttons
Getting mysql table in textbox
Getting mysql table in textbox  how to get mysql table values into textbox in java using ajax and servlets
showing the information of database in textbox
showing the information of database in textbox  how to make a information of a database make appear to the user in the textbox
display
display  please tell me how to display the content from database.. if we click on any image using servlets/jsp...please
date in textbox on page load
into textbox on page load. <html> <script> function addDate(){ date = new...date in textbox on page load   i want to insret the current date in textbox but this code dosen't work and the value of text box will be blank
Sql Server 2008 with textbox
textbox in a form using vb by visual studio 2010 but its always catch an error... myconn = New SqlConnection("server=localhost;" & "Initial Catalog=4... = "INSERT INTO Table1 (A , B) VALUES ('" + Asd + "','" + Lays + "') " cmd = New
Customer orientation in marketing management
competitive scenario, it is necessary for the companies to focus on customers. Customer... of customer for the business activities, companies plan its strategy focusing on customers demand and their taste. It is known as the customer orientation
How to insert dynamic textbox values into database using Java?
How to insert dynamic textbox values into database using Java?  Hi I am trying to insert dynamic textbox values to database, my jsp form have 2 textboxes...Name, Address with an add button, if you click add button new set
Dynamically adding textbox and labels
Dynamically adding textbox and labels  Sir, In my application I want to insert texbox and labels dynamically and want to insert database field value in that generated label. Plz help me, Thanks in advance
Blocking a user when he enters his password worng for three times ??
Blocking a user when he enters his password worng for three times ??  I have a login page called login.jsp and a login validation servlet Loginval.java. And i want add more security to my login page such as if any user enters his
having difficulties in dynamically adding textbox with datepicker
add new row of textbox. And also able to use datepicker for the textbox as well. However, I am able to add and display the textbox but not the datepicker. I...having difficulties in dynamically adding textbox with datepicker  hi
Advertisements
 

 

 

DMCA.com