plzzzzzzzzz xplain this code

import java.awt.*;
import java.awt.event.*;
import java.awt.MenuItem.*;
import java.sql.*;
import sun.jdbc.odbc.*;
import java.io.*;
public class MarkDelivery extends Frame implements
ActionListener
{

Label l1,l2,l3,l4,l5,l6,l7;
Button exit,save,next,top,prev,botm,ad;
TextField
txtCMemoNo,txtConsNo,txtCMemoDt,txtConsName,txtAddr1,txtBook
ingNo,adr2,adr3;




public static void main(String sr[])
{
new MarkDelivery().setVisible(true);
}

public MarkDelivery()
{
super("Mark Delivery");
Statement stmt;
ResultSet rs;
//PreparedStatement pst;
Connection con;
try
{

Class.forName
("sun.jdbc.odbc.JdbcOdbcDriver");

con=DriverManager.getConnection("jdbc:odbc:Agency");
if (con!=null);
System.out.println
("connected");
stmt =con.createStatement
();


}
catch(Exception e1)
{
System.out.println
(e1);
}


setSize(1280,800);
setBackground(Color.lightGray);
setLayout(null);

l1=new Label("Cashmemo No");
l1.setBounds(260,60,90,30);
l1.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l1.setAlignment(Label.CENTER);
add(l1);

l1=new Label("Booking No");
l1.setBounds(30,90,90,30);
l1.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l1.setAlignment(Label.CENTER);
add(l1);

l2=new Label("CONSMR NO");
l2.setBounds(30,60,90,30);
l2.setFont(new Font("TimesRoman",Font.PLAIN,15));
l2.setAlignment(Label.CENTER);
add(l2);

l3=new Label("Cashmemo Date");
l3.setBounds(520,60,130,30);
l3.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l3.setAlignment(Label.CENTER);
add(l3);

l4=new Label("NAME");
l4.setBounds(30,150,45,30);
l4.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l4.setAlignment(Label.CENTER);
add(l4);

l5=new Label("ADRS");
l5.setBounds(30,220,45,30);
l5.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l5.setAlignment(Label.CENTER);
add(l5);

txtBookingNo=new TextField();
txtBookingNo.setBounds(130,90,80,30);
txtBookingNo.setBackground(Color.white);
add(txtBookingNo);

txtCMemoNo=new TextField();
txtCMemoNo.setBounds(375,60,80,30);
txtCMemoNo.setBackground(Color.white);
add(txtCMemoNo);

txtConsNo=new TextField();
txtConsNo.setBounds(130,60,80,30);
txtConsNo.setBackground(Color.white);
add(txtConsNo);

txtCMemoDt=new TextField();
txtCMemoDt.setBounds(635,60,80,30);
txtCMemoDt.setBackground(Color.white);
add(txtCMemoDt);

txtConsName=new TextField();
txtConsName.setBounds(100,150,200,30);
txtConsName.setBackground(Color.white);
add(txtConsName);

txtAddr1=new TextField();
txtAddr1.setBounds(100,220,350,30);
txtAddr1.setBackground(Color.white);
add(txtAddr1);

adr2=new TextField();
adr2.setBounds(100,250,350,30);
adr2.setBackground(Color.white);
add(adr2);

adr3=new TextField();
adr3.setBounds(100,280,350,30);
adr3.setBackground(Color.white);
add(adr3);






exit=new Button("EXIT");
exit.setBackground(Color.orange);
exit.setBounds(760,700,40,40);
exit.addActionListener(this);
add(exit);

save=new Button("SAVE");
save.setBackground(Color.orange);
save.setBounds(715,700,40,40);
save.addActionListener(this);
add(save);

next=new Button("NEXT");
next.setBackground(Color.orange);
next.setBounds(90,700,40,40);
next.addActionListener(this);
add(next);

top=new Button("TOP");
top.setBackground(Color.orange);
top.setBounds(0,700,40,40);
top.addActionListener(this);
add(top);

prev=new Button("PREV");
prev.setBackground(Color.orange);
prev.setBounds(45,700,40,40);
prev.addActionListener(this);
add(prev);


botm=new Button("BOTM");
botm.setBackground
(Color.orange);
botm.setBounds
(135,700,40,40);
botm.addActionListener
(this);
add(botm);

ad=new Button("ADD");
ad.setBackground
(Color.orange);
ad.setBounds
(300,700,40,40);
ad.addActionListener
(this);
add(ad);



}

public void actionPerformed(ActionEvent e)
{
if(e.getSource()==exit)
{
this.dispose();
System.exit(0);
}



/* if(e.getSource()==save)
{
try
{
Connection
con=DriverManager.getConnection("jdbc:odbc:Agency");

PreparedStatement pst=con.prepareStatement("INSERT INTO
NewCon values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
pst.setInt
(1,Integer.parseInt(txtConsNo.getText()));
pst.setInt
(2,Integer.parseInt(txtSvNo.getText()));
pst.setString
(3,txtSvDt.getText());
pst.setString
(4,txtConsName.getText());
pst.setInt(5,Integer.parseInt
(txtPhNo.getText()));
pst.setString(6,txtAddr1.getText());
pst.setString(7,adr2.getText());
pst.setString(8,adr3.getText());
pst.setInt(9,Integer.parseInt
(txtCylQty.getText()));
pst.setInt(10,Integer.parseInt
(txtCylDep.getText()));
pst.setInt(11,Integer.parseInt
(txtRegQty.getText()));
pst.setInt(12,Integer.parseInt
(txtRegDep.getText()));
pst.setInt(13,Integer.parseInt
(tot.getText()));
pst.setInt(14,Integer.parseInt
(stnry.getText()));
pst.setString(15,rmrk.getText());
pst.executeUpdate
();
con.close();
}
catch(Exception e2)
{System.out.println(e2);}
//cs(txtConsName.getText
(),txtAddr1.getText());
}




if(e.getSource()==ad)
{
try
{

Connection
con1=DriverManager.getConnection("jdbc:odbc:Agency");
Statement
stmt1=con1.createStatement();
ResultSet
rs1=stmt1.executeQuery("SELECT Max(Cons_No) FROM NewCon");
int nextcono = rs1.getInt
("Cons_No");
System.out.println
(nextcono);
nextcono=nextcono+1;
txtConsNo.setText
("nextcono");

txtSvNo.setText("");
txtSvDt.setText("");
txtConsName.setText("");
txtAddr1.setText("");
txtPhNo.setText("");
txtCylQty.setText("");
txtCylDep.setText("");
txtRegDep.setText("");
txtRegQty.setText("");
adr2.setText("");
adr3.setText("");
tot.setText("");
stnry.setText("");
rmrk.setText("");
con1.close();
}
catch(Exception e4){}

}*/
}



}

Answer Posted / durgesh kumar

import java.awt.*; ///for gui
import java.awt.event.*; // for event handling
import java.awt.MenuItem.*; // menu item
import java.sql.*; // for sql quiries
import sun.jdbc.odbc.*; // for creaing jdbc connection
import java.io.*; // for getting data in and out in the
database
public class MarkDelivery extends Frame implements
ActionListener /// actionlistener is used to perform any
action such as clicking on buuton
{

Label l1,l2,l3,l4,l5,l6,l7; // for creating label
Button exit,save,next,top,prev,botm,ad; // for
declaring button
TextField
txtCMemoNo,txtConsNo,txtCMemoDt,txtConsName,txtAddr1,txtBook; //for
declaring textfields
String No,adr2,adr3;




public static void main(String sr[])
{
new MarkDelivery().setVisible(true); // making the
constructor visible
}

public MarkDelivery() //declaration of cnostructor
{
super("Mark Delivery"); // to print it on the
title bar
Statement stmt; //declaring statement
ResultSet rs; // rs will store the results from the db
//PreparedStatement pst;
Connection con; //declaration for connection
try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //
creating driver

con=DriverManager.getConnection("jdbc:odbc:Agency");
if (con!=null);
System.out.println("connected");
stmt =con.createStatement();


}
catch(Exception e1)
{
System.out.println(e1);
}


setSize(1280,800);//setting the size of frame in
the window
setBackground(Color.lightGray);
setLayout(null);

l1=new Label("Cashmemo No");
l1.setBounds(260,60,90,30);
l1.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l1.setAlignment(Label.CENTER);
add(l1);

l1=new Label("Booking No");
l1.setBounds(30,90,90,30);
l1.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l1.setAlignment(Label.CENTER);
add(l1);

l2=new Label("CONSMR NO");
l2.setBounds(30,60,90,30);
l2.setFont(new Font("TimesRoman",Font.PLAIN,15));
l2.setAlignment(Label.CENTER);
add(l2);

l3=new Label("Cashmemo Date");
l3.setBounds(520,60,130,30);
l3.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l3.setAlignment(Label.CENTER);
add(l3);

l4=new Label("NAME");
l4.setBounds(30,150,45,30);
l4.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l4.setAlignment(Label.CENTER);
add(l4);

l5=new Label("ADRS");
l5.setBounds(30,220,45,30);
l5.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l5.setAlignment(Label.CENTER);
add(l5);

txtBookingNo=new TextField();
txtBookingNo.setBounds(130,90,80,30);
txtBookingNo.setBackground(Color.white);
add(txtBookingNo);

txtCMemoNo=new TextField();
txtCMemoNo.setBounds(375,60,80,30);
txtCMemoNo.setBackground(Color.white);
add(txtCMemoNo);

txtConsNo=new TextField();
txtConsNo.setBounds(130,60,80,30);
txtConsNo.setBackground(Color.white);
add(txtConsNo);

txtCMemoDt=new TextField();
txtCMemoDt.setBounds(635,60,80,30);
txtCMemoDt.setBackground(Color.white);
add(txtCMemoDt);

txtConsName=new TextField();
txtConsName.setBounds(100,150,200,30);
txtConsName.setBackground(Color.white);
add(txtConsName);

txtAddr1=new TextField();
txtAddr1.setBounds(100,220,350,30);
txtAddr1.setBackground(Color.white);
add(txtAddr1);

adr2=new TextField();
adr2.setBounds(100,250,350,30);
adr2.setBackground(Color.white);
add(adr2);

adr3=new TextField();
adr3.setBounds(100,280,350,30);
adr3.setBackground(Color.white);
add(adr3);






exit=new Button("EXIT");
exit.setBackground(Color.orange);
exit.setBounds(760,700,40,40);
exit.addActionListener(this);
add(exit);

save=new Button("SAVE");
save.setBackground(Color.orange);
save.setBounds(715,700,40,40);
save.addActionListener(this); ///registering the save
button for action to be performed
add(save);

next=new Button("NEXT");
next.setBackground(Color.orange);
next.setBounds(90,700,40,40);
next.addActionListener(this);
add(next);

top=new Button("TOP");
top.setBackground(Color.orange);
top.setBounds(0,700,40,40);
top.addActionListener(this);
add(top);

prev=new Button("PREV");
prev.setBackground(Color.orange);
prev.setBounds(45,700,40,40);
prev.addActionListener(this);
add(prev);


botm=new Button("BOTM");
botm.setBackground
(Color.orange);
botm.setBounds
(135,700,40,40);
botm.addActionListener
(this);
add(botm);

ad=new Button("ADD");
ad.setBackground
(Color.orange);
ad.setBounds
(300,700,40,40);
ad.addActionListener
(this);
add(ad);



}

public void actionPerformed(ActionEvent e) // call
of action performed method
{
if(e.getSource()==exit)
{
this.dispose(); // it will close the window
System.exit(0);
}



/* if(e.getSource()==save)
{
try
{
Connection
con=DriverManager.getConnection("jdbc:odbc:Agency");

PreparedStatement pst=con.prepareStatement("INSERT INTO
NewCon values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
pst.setInt(1,Integer.parseInt(txtConsNo.getText()));
// gets the text from the text field which has integer vale
pst.setInt(2,Integer.parseInt(txtSvNo.getText()));
pst.setString
(3,txtSvDt.getText());
pst.setString
(4,txtConsName.getText());
pst.setInt(5,Integer.parseInt
(txtPhNo.getText()));
pst.setString(6,txtAddr1.getText());
pst.setString(7,adr2.getText());
pst.setString(8,adr3.getText());
pst.setInt(9,Integer.parseInt
(txtCylQty.getText()));
pst.setInt(10,Integer.parseInt
(txtCylDep.getText()));
pst.setInt(11,Integer.parseInt
(txtRegQty.getText()));
pst.setInt(12,Integer.parseInt
(txtRegDep.getText()));
pst.setInt(13,Integer.parseInt
(tot.getText()));
pst.setInt(14,Integer.parseInt
(stnry.getText()));
pst.setString(15,rmrk.getText());
pst.executeUpdate
();
con.close();
}
catch(Exception e2)
{System.out.println(e2);}
//cs(txtConsName.getText
(),txtAddr1.getText());
}




if(e.getSource()==ad)
{
try
{

Connection
con1=DriverManager.getConnection("jdbc:odbc:Agency");
Statement
stmt1=con1.createStatement();
ResultSet
rs1=stmt1.executeQuery("SELECT Max(Cons_No) FROM NewCon");
int nextcono = rs1.getInt
("Cons_No");
System.out.println
(nextcono);
nextcono=nextcono+1;
txtConsNo.setText
("nextcono");

txtSvNo.setText("");
txtSvDt.setText("");
txtConsName.setText("");
txtAddr1.setText("");
txtPhNo.setText("");
txtCylQty.setText("");
txtCylDep.setText("");
txtRegDep.setText("");
txtRegQty.setText("");
adr2.setText("");
adr3.setText("");
tot.setText("");
stnry.setText("");
rmrk.setText("");
con1.close();
}
catch(Exception e4){}

}*/
}



}
s///please specify in which line do u have the problem
actually this program will create a form and the data
provided will be stored in the database.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what full form name of B.K.U.

2688


Write a Program to truncate a given floating point value (e.g.16.25=16).

527


i want run following code on button click of view. i am trying to retrieve data from isc_order_details table and isc_product table. but after retriaval of data i m getting error like FIELD MUST BE ENTERED!! DECLARE m number; n number; CURSOR order_details IS SELECT PRODUCT_ORDER_QUAN,PRODUCT_ID FROM isc_order_details WHERE order_id=:isc_order_master.order_id; amount NUMBER (8,2):=0.0; alert number; BEGIN go_block('isc_order_details'); first_record; m:=:system.cursor_record; last_record; n:=:system.cursor_record; OPEN order_details; --for i in m..n loop FETCH order_details INTO :ISC_ORDER_DETAILS.PRODUCT_ORDER_QUAN,:ISC_ORDER_DETAIL S.PRODUCT_ID; IF order_details%FOUND THEN SELECT order_value,order_date INTO :ISC_ORDER_MASTER.ORDER_VALUE,:ISC_ORDER_MASTER.ORDER_D ATE FROM isc_order_master WHERE order_id=:ISC_ORDER_MASTER.ORDER_ID; SELECT product_desc,product_price INTO :ISC_ORDER_DETAILS.PRODUCT_DESC,:ISC_ORDER_DETAILS.PROD UCT_PRICE FROM isc_product WHERE product_id=:ISC_ORDER_DETAILS.PRODUCT_ID; next_record; END IF; EXIT WHEN order_details%NOTFOUND; END LOOP; last_record; CLOSE order_details; EXCEPTION when NO_DATA_FOUND then alert:=SHOW_ALERT('ENTER_DATA'); Go_Item('isc_order_master.order_id'); END;

1876


1.What type of material can be sent from a Java servlet to a browser ? How does the browser know how to deal with the material? 2.Explain what happens to a servlet when a servlet engine is sent a GET request.

2368


Write code to make an object work like a 2-d array?

474






How can you print an address of a variable?

509


Write a Program to find the number of words in a sentence.

526


Write a Program to find whether the given number is a Armstrong number.

529


What is the coding about how to recognize color in fuzzy logic using Matlab R2009b?

1578


Write a code snippet to display an integer in a binary format?

493


Beautiful is for 012345678 9 and a code for similar word containing the same alphabets

5316


JasperETL how to install and create simple project explain me clearly fnds iam wtg for ur rply

3624


Write a program to Print the Pascal triangle

522


i am doing my final year project about programming use verilog ,i am new about it so got problem,i want to record the readings of a waveform every 2us use the verilog code ,every ten readings i need to add them together after that i need to compare this series of number to get which one is the biggest , right now i don't know how to use code to store the readings every 2us on a waveform ,pls help me thanks a lot .

1706


How to find the list of users who have two codes su01 and pfcg? thank in advance all.

1695