import java.io.*; import java.applet.*; import java.awt.*; import java.awt.event.*; import java.

sql.*; public class menu extends Frame implements WindowListener,ActionListener { MenuBar mb; MenuItem student,rollnowise,namewise,allresult; public static menu m; rollnowise rw; namewise n; student st; int x,y,d; public menu() { super("menu ARPAN"); addWindowListener(this); x=y=700; d=10; setSize(x,y); setBackground(Color.orange); addMenu(); show(); } public static void main(String args[]) { m=new menu(); } void addMenu() { MenuBar mb=new MenuBar(); Menu register=new Menu("REGISTER"); Menu inquery=new Menu("INQUERY"); register.add("STUDENT"); register.add("EXIT"); inquery.add("ROLLNOWISE"); inquery.add("NAMEWISE");

st.getSource() instanceof Menu) if("ROLLNOWISE".exit(0).equals(arg)) { rw=new rollnowise().add(inquery).equals(arg)) { n=new namewise(). register. mb. } if(ae.equals("EXIT")) { System.show().show(). rw.addActionListener(this).getSource() instanceof Menu) if("STUDENT". n. if(ae.show().addActionListener(this).mb. setMenuBar(mb).add(register).getSource() instanceof Menu) if(arg. } public void actionPerformed(ActionEvent ae) { String arg=ae.getSource() instanceof Menu) if("NAMEWISE". } if(ae. inquery. } } public void windowClosed(WindowEvent we){} public void windowDeiconified(WindowEvent we){} .equals(arg)) { st=new student().getActionCommand(). } if(ae.

dispose().com").Label. Button but_entername =new Button("FIND").y).LEFT). Statement st.Label. Font font18=new Font("VinetaBT".Label. show(). Button ok=new Button("OK").LEFT).LEFT).BOLD|Font.Font.ITALIC.Label. Graphics g.2). y=y-d.println("mail me at arpankumarsingh@yahoo. Label l3=new Label("COLG". TextField tf_entername=new TextField(20). x=x-d. Label l1=new Label("NAME". Label l7=new Label("SUB4". System. Label l2=new Label("ROLLNO".LEFT). } System. . } } //class for name wise report class namewise extends Frame implements WindowListener. String sqlstr. Label l4=new Label("SUB1".public void windowIconified(WindowEvent we){} public void windowActivated(WindowEvent we){} public void windowDeactivated(WindowEvent we){} public void windowOpened(WindowEvent we){} public void windowClosing(WindowEvent we) { while(x>0 && y>0) { setSize(x.LEFT).Label.LEFT).5).LEFT).ActionListener { public static namewise nw. Label l5=new Label("SUB2".Label.exit(0).18).LEFT). GridLayout gl=new GridLayout(1.Label.Label. GridLayout cl=new GridLayout(1. Label l8=new Label("SUB5".out. Label l6=new Label("SUB3".

Dialog dlg.y). addMenu(). .add(l11). Label msg. setLayout(new GridLayout(12. dlg.100). add(p4). setForeground(Color.add(ok).100). setBackground(Color.1)). show().add(tf_entername).1)). x=550. d=100. ok.int x.setSize(100. dlg."Inventory Management System". Label l11=new Label("ENTERNAME"). p4.setLocation(200. dlg. y=450. addWindowListener(this).50).black). public namewise() { super("NAMEWISE").orange).addActionListener(this). ok.add(but_entername). //Dialog for confirmation dlg=new Dialog(this.add(msg).y. p4.setLayout(new GridLayout(2. setSize(x. p4. dlg. } void addMenu() { Panel p4=new Panel().false).addActionListener(this).d.setSize(50. dlg. but_entername. msg=new Label("NAME NOT FOUND").

add(l5).getConnection("jdbc:odbc:stu".getActionCommand(). st=con.add(l1).forName("sun.setFont(font18).add(l3).setFont(font18). p1. p3.add(l6). l1. p3.equals(arg)) try { Class. l7. l8. g. p3. l5.jdbc. l6. sqlstr="select * from stu1 where NAME='"+ tf_entername.add(l7).0).setFont(font18). p2.drawLine(40.getSource() instanceof Button) if("FIND". p2.setFont(font18).add(l8).setLayout(gl). l2. p3.setFont(font18). .setFont(font18). ResultSet rs.setFont(font18).createStatement().getText()+"'".} public void actionPerformed(ActionEvent e) { Panel p1=new Panel(). p3. l3.add(l4). String arg=e.40.odbc. l4.setLayout(gl).""). if(e. p1."".0. p3. Panel p2=new Panel(). Panel p3=new Panel().add(l2).setLayout(cl). p1. Connection con=DriverManager.setFont(font18). g=getGraphics().JdbcOdbcDriver").

l5.setLayout(gl).LEFT). while(rs. a1. l6=new Label("".LEFT).setFont(font18).getInt("SUB4")).setText(""+rs.getInt("SUB5")). l1=new Label("". l2=new Label("".setText(""+rs.LEFT). l1.add(l3).rs= st.setText(rs.Label.Label. l6.LEFT). l4. l3.setText(""+rs. a2.setText(rs. .getString("COLG")).getString("NAME")).Label. a2. a3.getInt("SUB1")).setFont(font18).LEFT).setFont(font18). l3=new Label("". a1.Label.Label. l4.setFont(font18).getInt("ROLLNO")).setFont(font18). l8.add(l2).setText(""+rs.LEFT). l7.setFont(font18).setFont(font18).getInt("SUB3")).Label.add(l1).executeQuery(sqlstr). l2.Label. l6.setLayout(gl).getInt("SUB2")).setLayout(cl). l5. l7=new Label("". l3.setFont(font18). l1. Panel a2=new Panel(). a1.LEFT). l8. Panel a3=new Panel(). l7. l2.setText(""+rs. l5=new Label("". l8=new Label("".LEFT). l4=new Label("".Label.next()) { Panel a1=new Panel().setText(""+rs.

a3. y=y-d.a3. .add(l8).add(l7). } } catch(ClassNotFoundException se) { tf_entername.toString()).setText("Error : " + se.add(l6). a3. show(). a3. add(a1). show().add(l5). add(p2). x=x-d. } } public void windowClosed(WindowEvent we){} public void windowDeiconified(WindowEvent we){} public void windowIconified(WindowEvent we){} public void windowActivated(WindowEvent we){} public void windowDeactivated(WindowEvent we){} public void windowOpened(WindowEvent we){} public void windowClosing(WindowEvent we) { while(x>0 && y>0) { setSize(x. add(p1). add(p3). a3.toString()). add(a2).y). add(a3).setText("Error : " + se. } catch(SQLException se) { tf_entername.add(l4).

18). Label l6=new Label("SUB3".Label. int x.LEFT). Statement st.Label.orange). Label l3=new Label("COLG". } } //class for rollnowise report class rollnowise extends Frame implements WindowListener. Label l8=new Label("SUB5".y). setSize(x.y.LEFT).Font. y=450. setLayout(new GridLayout(12. Label l2=new Label("ROLLNO".Label. Label l4=new Label("SUB1".LEFT).Label. addWindowListener(this).ITALIC. public rollnowise() { super("ROLLNOWISE"). GridLayout gl=new GridLayout(1.Label.Label. TextField tf_entername=new TextField(20).d. Button but_entername =new Button("FIND"). d=100.LEFT).LEFT). setForeground(Color. String sqlstr.Label. setBackground(Color.black). Label l7=new Label("SUB4".Label.1)).LEFT). show(). x=550.LEFT).} dispose(). Label l1=new Label("NAME".ActionListener { public static rollnowise rw. addMenu(). Font font18=new Font("VinetaBT".5). . Label l5=new Label("SUB2".2).LEFT).BOLD|Font. GridLayout cl=new GridLayout(1.

Panel p3=new Panel().add(tf_entername).setFont(font18). } public void actionPerformed(ActionEvent e) { Panel p1=new Panel().add(l6). l1. p2.setFont(font18). Panel p2=new Panel(). l3.add(l1).setLayout(gl). p2.setFont(font18). Label l11=new Label("ENTERROLLNO").add(l3).add(l2). add(p4).setFont(font18). .add(but_entername). p4.setFont(font18).setLayout(gl). p3. l2. but_entername.add(l4). p1. p3. p3.add(l11). l4.setFont(font18). p1. l5.setFont(font18). p4. l7. p4. l8.setFont(font18). l6.} void addMenu() { Panel p4=new Panel().add(l5).addActionListener(this). p1.

add(l11).getActionCommand().getConnection("jdbc:odbc:stu". rs= st.p3.forName("sun. add(p2).Label. ResultSet rs. l3. Panel a2=new Panel(). sqlstr="select * from stu1 where ROLLNO="+ tf_entername. l4=new Label("".getText()+"".add(l7). p4.getSource() instanceof Button) if("FIND".add(l8).LEFT). l1=new Label("". add(p3).Label. l3=new Label("". Label l11=new Label("ENTERROLLNO"). p3.setLayout(gl).Label.LEFT).add(but_entername). st=con. l1. add(p4).LEFT).setFont(font18). while(rs. l2.Label.setFont(font18).next()) { Panel a1=new Panel(). .setFont(font18).JdbcOdbcDriver").setLayout(cl). if(e.jdbc. l2=new Label("". Connection con=DriverManager.setLayout(gl).equals(arg)) try { Class.executeQuery(sqlstr). p3.add(tf_entername).odbc."". */ String arg=e. Panel a3=new Panel().createStatement(). a1. add(p1). p4. a2.LEFT). p4. /* Panel p4=new Panel()."").

l2.getInt("SUB5")).getInt("SUB4")).getInt("SUB3")).setText(""+rs.setText(""+rs.setLayout(cl). add(p1). add(a3).Label.setText(rs.setFont(font18). l7.add(l5). l5.setText(""+rs. a3.getInt("SUB2")). a3. l3.LEFT).setFont(font18). l7.getString("NAME")). l4.LEFT). a1.add(l3).setFont(font18).getString("COLG")). l5. a2. l4. l1. add(p2).LEFT).add(l7). l6=new Label("".setText(""+rs. add(a2). } .l5=new Label("".setFont(font18).setText(""+rs.LEFT). l8.add(l6).setText(""+rs.getInt("SUB1")). a1. a3. l6.Label. a3. add(a1).getInt("ROLLNO")). l8=new Label("". a3.add(l1). add(p3).setText(rs.setFont(font18).add(l8).Label. l7=new Label("". l8.add(l4).add(l2).Label. show(). l6. a3.

} dispose().} catch(ClassNotFoundException se) { tf_entername. TextField tf_sub2=new TextField(4). TextField tf_colg=new TextField(20). y=y-d. } catch(SQLException se) { tf_entername.WindowListener { public static student st. TextField tf_rollno=new TextField(20). x=x-d. show().setText("Error : " + se. TextField tf_marks=new TextField(20). } } public void windowClosed(WindowEvent we){} public void windowDeiconified(WindowEvent we){} public void windowIconified(WindowEvent we){} public void windowActivated(WindowEvent we){} public void windowDeactivated(WindowEvent we){} public void windowOpened(WindowEvent we){} public void windowClosing(WindowEvent we) { while(x>0 && y>0) { setSize(x. TextField tf_sub1=new TextField(4). .setText("Error : " + se. } } //class which help in storing records in the database class student extends Frame implements ActionListener.toString()).y). TextField tf_name=new TextField(20).toString()).

Button but_cancel=new Button("CANCEL").yellow). Label l6=new Label("SUB1"). Button ok=new Button("OK"). show(). Label msg. Label l3=new Label("MARKS"). Button but_delete=new Button("DELETE").1)). Button but_add=new Button("ADD"). setSize(x. public student() { super("palce").TextField tf_sub3=new TextField(4). Button but_edit=new Button("EDIT"). Panel p1=new Panel(). Label l10=new Label("SUB5"). y=450.y. Label l7=new Label("SUB2"). TextField tf_sub4=new TextField(4). } void addmenu() { //GridLayout gl=new GridLayout(). Dialog dlg.d. Label l1=new Label("NAME"). addWindowListener(this). int x. p1. Label l2=new Label("ROLLNO").add(l1). setLayout(new GridLayout(6. Label l9=new Label("SUB4"). Button but_find=new Button("FIND"). addmenu(). Label l8=new Label("SUB3"). setBackground(Color. Label l5=new Label("MARK SHEET"). Label l4=new Label("COLG"). . setVisible(true). d=12. x=550.y). TextField tf_sub5=new TextField(4).

Panel p8=new Panel(). add(p1). Panel p5=new Panel(). p4.addActionListener(this).add(l8).add(but_cancel).add(tf_sub4).add(l7).add(l10). p3.add(l3). p8.add(l9). p3. p3. p4. add(p3).add(tf_name). p1. but_delete.add(tf_colg). //p4.addActionListener(this). Panel p4=new Panel(). add(p2).add(tf_sub5).add(but_edit). add(p8).add(l5).add(but_add). but_cancel.add(tf_rollno).add(l2). p8.addActionListener(this). p4. .add(l4). p1.add(tf_sub1). Panel p2=new Panel().addActionListener(this). add(p4). p5.add(but_find). p3. p8. but_add. Panel p3=new Panel().add(tf_sub3). add(p5). p3.add(tf_sub2). but_find. p8. p8. p2.add(l6).addActionListener(this). p4. p4. p5.add(but_delete). but_edit.p1.

getText()+".1)).createStatement(). //ADDBUTTON if(e.equals(arg)) try { Class.executeUpdate(sqlStr)."+tf_sub 5."+tf_sub4.SUB2."+tf_rollno.jdbc. ok. msg=new Label("Record Updated").getText()+".addActionListener(this).getText()+".SUB3.50).JdbcOdbcDriver").getConnection("jdbc:odbc:stu".show().odbc.add(msg).ok.setLocation(200.setSize(100.100). } catch(SQLException se) { // tf_name."Inventory Management System".setSize(50.100).setLayout(new GridLayout(2.setText("Error : " + se.false)."").SUB5)values('"+tf_name. msg.toString()). st.ROLLNO.getText()+". dlg.add(ok).getSource() instanceof Button) if("ADD".getText()+". //Dialog for confirmation dlg=new Dialog(this.getActionCommand(). .SUB1. sqlStr="insert into stu1(NAME. dlg. String sqlStr.SUB4. st=con.'"+tf_colg.toString()). Connection con=DriverManager.getText()+"'."+tf_sub3."+tf_sub1. } catch(ClassNotFoundException se) { // tf_name. dlg. dlg. dlg. "+tf_sub2. } public void actionPerformed(ActionEvent e) { String arg=e.getTe xt() +"'.getText()+")".setText("ERROR"). Statement st.setText("Error : " + se. dlg.forName("sun.COLG."".

setText(""). tf_sub3. tf_sub1.setText(""+rs. } //FIND if(e. rs.JdbcOdbcDriver"). tf_name.setText(""+rs. rs=st. tf_sub3.createStatement().setText("").next().getInt("SUB5")).dispose(). dlg.equals(arg)) try { Class.show().setText("").getSource() instanceof Button) if("CANCEL"."". tf_sub2. } //CANCEL if(e. tf_sub4.""). tf_sub2.setText(""+rs. tf_rollno.executeQuery(sqlstr).getConnection("jdbc:odbc:stu". tf_colg.setText("").equals(arg)) { dlg.getSource() instanceof Button) if("FIND".getInt("SUB3")). tf_sub5. tf_sub5.getSource() instanceof Button) if ("OK".setText("").getInt("SUB1")). ResultSet rs.equals(arg)) { tf_name.jdbc.forName("sun. sqlstr="select * from stu1 where ROLLNO ="+tf_rollno. tf_sub4.getInt("SUB4")). String sqlstr.setText(""+rs. Statement st.msg. Connection con=DriverManager.setText(""+rs.setText(""). tf_sub1.getString("COLG")).setText(""). st=con. tf_colg.setText("ENTER TEXTFIELD").setText(""+rs. } .getString("NAME")). } //OK button if ( e.odbc.setText("").getInt("SUB2")).setText(""+rs.getText()+"".

setText("").setText("RECORD NOT FOUND").setText("").toString()). //tf_name.setText("RECORD NOT FOUND"). tf_sub1. dlg.setText("Error : " + se. msg. st=con.toString()).setText("").show(). Statement st.getConnection("jdbc:odbc:stu". } catch(SQLException se) { tf_name.executeUpdate(sqlstr). st.setText("Error : " + se.setText("Error : " + se. tf_name.jdbc. tf_colg. // tf_name. tf_sub3.setText("").odbc.setText("Error : " + se. tf_rollno. } catch(ClassNotFoundException se) { tf_name. tf_sub4.toString()).show(). dlg.createStatement().setText(""). } catch(SQLException se) { msg.setText("").getText()+"".setText("").catch(ClassNotFoundException se) { msg.equals(arg)) try { Class. } //DELETE if(e.setText("RECORD DELETED").setText("")."". } . tf_sub2.toString()). tf_sub5.JdbcOdbcDriver")."").forName("sun.show(). Connection con=DriverManager. String sqlstr.getSource() instanceof Button) if("DELETE". dlg. sqlstr="delete * from stu1 where ROLLNO="+tf_rollno.

sqlstr="update stu1 set NAME='"+tf_name. Statement st.getText()+"'.SUB1="+tf_sub1.createStatement().SUB2="+tf_sub2.jdbc. } catch(ClassNotFoundException se) { tf_name."").getText()+". st.getConnection("jdbc:odbc:stu".getText()+".show().toString()). } } public void windowClosed(WindowEvent we){} public void windowDeiconified(WindowEvent we){} public void windowIconified(WindowEvent we){} public void windowActivated(WindowEvent we){} public void windowDeactivated(WindowEvent we){} public void windowOpened(WindowEvent we){} public void windowClosing(WindowEvent we) { while(x>0 && y>0) { setSize(x."". show(). y=y-d. dlg. st=con.setText("RECORD UPDATED"). } catch(SQLException se) { tf_name. msg.getText()+".//EDIT if(e.SUB3="+tf_sub3. x=x-d.get Text()+". Connection con=DriverManager. String sqlstr. } .executeUpdate(sqlstr).getText()+".equals(arg)) try { Class.SUB5="+tf_s ub5.odbc.y).forName("sun.getText()+"' where ROLLNO="+tf_rollno.setText("Error : " + se.getText().toString()).getSource() instanceof Button) if("EDIT".setText("Error : " + se.COLG='"+tf_colg.SUB4="+tf_sub4.JdbcOdbcDriver").

} } .dispose().

Sign up to vote on this title
UsefulNot useful