student records such as fees-school fees, dob,age,if any due.the record stored should be like this record,name,age,dob,fee list or any dues of the student record1 isha 15 20jan record2 spandana 14 4feb record3 nagesh 13 14mar.
if user enters any of the above names it should show its details or else a error message should appear.
import java.awt.*; import javax.swing.*; public class Student extends JFrame { static JPanel panel; JLabel lclgname, lrollno, lname, ldept, laddress, lmobile, lemailid; JTextField trollno, tname,tdept, taddress, tmobile, temailid; JButton New, search, save, delete, exit; GridLayout g1; public Student() { panel =new JPanel(); getContentPane().add(panel); panel.setLayout(null); lclgname = new JLabel("DEV UNIVERSITY"); lclgname.setFont(new Font("Arial",Font.BOLD+Font.ITALIC,26)); lrollno= new JLabel("Enter rollno"); lname = new JLabel("Name"); ldept = new JLabel("dept"); laddress = new JLabel("Address"); lmobile = new JLabel("mobile"); lemailid = new JLabel("emailid"); trollno = new JTextField (1); tname = new JTextField (1); tdept = new JTextField (1); taddress = new JTextField (1); tmobile = new JTextField (1); temailid = new JTextField (1); New = new JButton ("New"); search = new JButton ("Search"); save = new JButton ("Save"); delete = new JButton ("Delete"); exit = new JButton ("Exit"); panel.add(lclgname); panel.add(lrollno); panel.add(trollno); panel.add(lname); panel.add(tname); panel.add(ldept); panel.add(tdept); panel.add(laddress); panel.add(taddress); panel.add(lmobile); panel.add(tmobile); panel.add(lemailid); panel.add(temailid); panel.add(New); panel.add(search); panel.add(save); panel.add(delete); panel.add(exit); lclgname.setBounds(10,-50,500,250); lrollno.setBounds(50,100,80,60); lname.setBounds(50,150,80,60); ldept.setBounds(50,200,80,60); laddress.setBounds(50,250,80,60); lmobile.setBounds(50,300,80,60); lemailid.setBounds(50,350,80,60); trollno.setBounds(500,100,80,40); tname.setBounds(500,150,80,40); tdept.setBounds(500,200,80,40); taddress.setBounds(500,250,80,40); tmobile.setBounds(500,300,80,40); temailid.setBounds(500,350,80,40); New.setBounds(100,550,80,60); search.setBounds(250,550,80,60); save.setBounds(400,550,80,60); delete.setBounds(550,550,80,60); exit.setBounds(700,550,80,60); } public void actionperformed(ActionEvent ae) { String s = ae.getActionCommand(); if("submit".equals(s)) { String s1 = tf1.getText(); String s2 = tf2.getText(); if (s1==s2) { lbl.setText("username"+s1+"password"+s2); } } if ("quit".equals(s)) { System.exit(0); } } public static void main(String args[]) { ActionTester t = new ActionTester(); Student sd; sd = new Student(); sd.setSize(900,900); sd.setVisible (true); } }
import java.util.*; class StudentData{ String record; String name; int age; String dob; StudentData(String record, String name, int age,String dob){ this.record=record; this.name=name; this.age=age; this.dob=dob; } public String getRecord(){ return record; } public String getName(){ return name; } public int getAge(){ return age; } public String getDob(){ return dob; } public static void main(String[] args){ LinkedList<StudentData> list=new LinkedList<StudentData>(); list.add(new StudentData("Record1","bindu",20,"20feb")); list.add(new StudentData("Record2","kavya",21,"4mar")); list.add(new StudentData("Record3","sandhya",22,"5apr")); Scanner input=new Scanner(System.in); System.out.print("Enter name to display: "); String rec=input.next(); for(StudentData data:list){ if(data.getRecord().equals(rec)){ System.out.println(data.getRecord()+"\t"+data.getName()+"\t"+data.getAge()+"\t"+data.getDob()); } } } }
import java.awt.*; import javax.swing.*; public class Student extends JFrame { static JPanel panel; JLabel lclgname, lrollno, lname, ldept, laddress, lmobile, lemailid; JTextField trollno, tname,tdept, taddress, tmobile, temailid; JButton New, search, save, delete, exit; GridLayout g1; public Student() { panel =new JPanel(); getContentPane().add(panel); panel.setLayout(null); lclgname = new JLabel("DEV UNIVERSITY"); lclgname.setFont(new Font("Arial",Font.BOLD+Font.ITALIC,26)); lrollno= new JLabel("Enter rollno"); lname = new JLabel("Name"); ldept = new JLabel("dept"); laddress = new JLabel("Address"); lmobile = new JLabel("mobile"); lemailid = new JLabel("emailid"); trollno = new JTextField (1); tname = new JTextField (1); tdept = new JTextField (1); taddress = new JTextField (1); tmobile = new JTextField (1); temailid = new JTextField (1); New = new JButton ("New"); search = new JButton ("Search"); save = new JButton ("Save"); delete = new JButton ("Delete"); exit = new JButton ("Exit"); panel.add(lclgname); panel.add(lrollno); panel.add(trollno); panel.add(lname); panel.add(tname); panel.add(ldept); panel.add(tdept); panel.add(laddress); panel.add(taddress); panel.add(lmobile); panel.add(tmobile); panel.add(lemailid); panel.add(temailid); panel.add(New); panel.add(search); panel.add(save); panel.add(delete); panel.add(exit); lclgname.setBounds(10,-50,500,250); lrollno.setBounds(50,100,80,60); lname.setBounds(50,150,80,60); ldept.setBounds(50,200,80,60); laddress.setBounds(50,250,80,60); lmobile.setBounds(50,300,80,60); lemailid.setBounds(50,350,80,60); trollno.setBounds(500,100,80,40); tname.setBounds(500,150,80,40); tdept.setBounds(500,200,80,40); taddress.setBounds(500,250,80,40); tmobile.setBounds(500,300,80,40); temailid.setBounds(500,350,80,40); New.setBounds(100,550,80,60); search.setBounds(250,550,80,60); save.setBounds(400,550,80,60); delete.setBounds(550,550,80,60); exit.setBounds(700,550,80,60); } public void actionperformed(ActionEvent ae) { String s = ae.getActionCommand(); if("submit".equals(s)) { String s1 = tf1.getText(); String s2 = tf2.getText(); if (s1==s2) { lbl.setText("username"+s1+"password"+s2); } } if ("quit".equals(s)) { System.exit(0); } } public static void main(String args[]) { ActionTester t = new ActionTester(); Student sd; sd = new Student(); sd.setSize(900,900); sd.setVisible (true); } }
Ads