private String username; private String password; private static JFrame loginFrame; private static JPanel panel1; private static JPanel panel2; private static JPanel panel3; private JButton loginBtn; private JButton exitBtn; int dialogtype = JOptionPane.PLAIN_MESSAGE; String dialogmessage; String dialogs; private JLabel nameLbl; private JLabel userLbl; private JLabel passwordLbl; private static JTextField userTxt; // private static JTextField passwordTxt; private static JPasswordField passwordTxt; public String loginname; public String loginpass;
//
Dimension screen
Toolkit.getDefaultToolkit().getScreenSize();
// static Date td
= new Date();
main() {
panel1 = new JPanel(); panel1.setLayout(new FlowLayout()); nameLbl = new JLabel("Hospital Managment ");
panel2 = new JPanel(); panel2.setLayout(new GridLayout(2,2)); userLbl = new JLabel("Username :"); userTxt = new JTextField(20);
passwordLbl = new JLabel("Password :"); // passwordTxt = new JTextField(20); passwordTxt = new JPasswordField(20); // passwordTxt.setEchoChar('?');
exitBtn.addActionListener(this); panel1.add(nameLbl); panel1.setOpaque(true); panel2.add(userLbl); panel2.add(userTxt); panel2.add(passwordLbl); panel2.add(passwordTxt); panel2.setOpaque(true); panel3.add(loginBtn); panel3.add(exitBtn); panel3.setOpaque(true); frame = new JFrame("Hospital Managment"); frame.setSize(300,200);
Container pane = frame.getContentPane(); pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); //pane.setLayout(new GridLayout(3,1)); pane.add(panel1); pane.add(panel2);
pane.add(panel3); frame.setLocation((screen.width - 500)/2,((screen.height-350)/2)); frame.setVisible(true); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } });
// //
//
class submit implements ActionListener // { public void actionPerformed(ActionEvent event) { /* String user,pass; user=tfuser.getText(); pass=tfpass.getText(); if(user.equals("student") && pass.equals("student")) {
}*/
Object source = event.getSource(); if(source.equals(loginBtn)) { //login(); String loginname,loginpass; loginname = userTxt.getText().trim(); loginpass = passwordTxt.getText().trim(); if(loginname.equals("s") && loginpass.equals("s")) { dialogmessage = "Welcome - " +loginname; dialogtype = JOptionPane.INFORMATION_MESSAGE; JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype); userTxt.setText(""); new start(); setVisible(false); frame.dispose();
userTxt.setText(""); passwordTxt.setText(""); }
/* {
/*
} }*/
// }
class docStart extends JFrame implements ActionListener { JButton badd,bmod,bview,bback,bexit; JLabel linfo,linfo1,linfo2,linfo3,linfo4;
badd.addActionListener(new add()); bmod.addActionListener(new mod()); bview.addActionListener(new view()); //bexit.addActionListener(new exit()); bback.addActionListener(new back());
class back implements ActionListener { public void actionPerformed(ActionEvent ae) { new start(); setVisible(false); } }
class add implements ActionListener { public void actionPerformed(ActionEvent ae) { new DoctorInfoAdd();
setVisible(false); } }
class mod implements ActionListener { public void actionPerformed(ActionEvent ae) { new DoctorInfomodify(); setVisible(false); } }
class view implements ActionListener { public void actionPerformed(ActionEvent ae) { new DoctorInfoView(); setVisible(false);
} }
/* class exit implements ActionListener { public void actionPerformed(ActionEvent ae) { System.exit(0); } } */ public static void main(String[] args) { new docStart(); } }
package hospital;
class InvalidPassError {
InvalidPassError() { String message = "Patient Number is invalid."; JOptionPane.showMessageDialog(new JFrame(), message, "ERROR!", JOptionPane.ERROR_MESSAGE); }
class patStart extends JFrame implements ActionListener { JButton badd,bmod,bview,bback,bexit; JLabel linfo,linfo1,linfo2,linfo3,linfo4; patStart()
badd.addActionListener(new add()); bmod.addActionListener(new mod()); bview.addActionListener(new view()); //bexit.addActionListener(new exit()); bback.addActionListener(new back());
class back implements ActionListener { public void actionPerformed(ActionEvent ae) { new start(); setVisible(false); } }
class add implements ActionListener { public void actionPerformed(ActionEvent ae) { new PatientInfo(); setVisible(false); } }
class view implements ActionListener { public void actionPerformed(ActionEvent ae) { new PatientInfoView(); setVisible(false); } }
class start extends JFrame implements ActionListener { JButton bpat,bdoc,bbill,breport,bback,bexit; JLabel linfo,linfo1,linfo2,linfo3,linfo4; start() { super("Hospital Management System"); setSize(1024,768); setVisible(true); setLayout(null);
linfo1=new JLabel("1. For Inserting, Modifying, Retrieving Patients related Data"); linfo1.setBounds(50,205,335,20); add(linfo1);
linfo2=new JLabel("2. For Inserting, Modifying, Retrieving Doctors related Data"); linfo2.setBounds(50,275,335,20); add(linfo2);
bpat.addActionListener(new patient()); bdoc.addActionListener(new doctor()); bbill.addActionListener(new billing()); bexit.addActionListener(new exit()); bback.addActionListener(new back());
breport.addActionListener(new report());
class report implements ActionListener { public void actionPerformed(ActionEvent ae) { new Report(); setVisible(false); } };
class back implements ActionListener { public void actionPerformed(ActionEvent ae) { new main(); setVisible(false); } }
class patient implements ActionListener { public void actionPerformed(ActionEvent ae) { new patStart(); setVisible(false); } }
class doctor implements ActionListener { public void actionPerformed(ActionEvent ae) { new docStart(); setVisible(false); } }
/*