コード例 #1
0
  public patientAdd(String s) {
    super(s);
    image =
        new JLabel() {
          public void paint(Graphics g) {
            ImageIcon ic = new ImageIcon(str);
            Image img = ic.getImage();
            g.drawImage(img, 0, 0, 150, 150, this);
          }
        };

    image.setBounds(670, 270, 300, 300);
    bu = new JButton("UPLOAD");
    bu.setBounds(700, 230, 100, 20);
    bu.addActionListener(this);
    //	q.add(bu);

    ldt = new JLabel("Date");
    lpid = new JLabel("Patient ID");
    lpnm = new JLabel("Patient Name");
    lgen = new JLabel("Gender");
    lbg = new JLabel("Blood Group");
    lage = new JLabel("Age");
    lwt = new JLabel("Weight                                          Kg");
    ladd = new JLabel("Address");
    lcno = new JLabel("Cont. no.");
    ldnm = new JLabel("Doctor Name            Dr.");
    lsym = new JLabel("Symptoms");
    ldig = new JLabel("Diagnosis");
    lfee = new JLabel("Fee                            Rs.");
    cbg = new CheckboxGroup();
    cm = new Checkbox("Male", cbg, false);
    cm.addItemListener(this);
    cf = new Checkbox("Female", cbg, false);
    cf.setState(true);
    cf.addItemListener(this);
    tdt = new JTextField(15);
    tpid = new JTextField(6);
    tpid.addFocusListener(this);
    tpfnm = new JTextField("first");
    tpmnm = new JTextField("middle");
    tplnm = new JTextField("last");
    tage = new JTextField(4);
    tage.addFocusListener(this);
    tbg = new JTextField(6);
    twt = new JTextField(5);
    tadd = new TextArea(patient.addr);
    tcno = new JTextField(20);
    tdnm = new JTextField(20);
    tsym = new TextArea();

    tdig = new JTextField(20);
    tfee = new JTextField(6);
    tfee.addFocusListener(this);
    ba = new JButton("ADD");
    ba.addActionListener(this);
    bm = new JButton("CANCEL");
    bm.addActionListener(this);
    bd = new JButton("DELETE");
    bd.addActionListener(this);
    bl = new JButton("DISPLAY");
    bl.addActionListener(this);
    bs = new JButton("SEARCH");
    bs.addActionListener(this);
    JPanel p = new JPanel();
    p.add(ba);
    p.add(bm);
    //	p.add(bd);
    //	p.add(bl);
    //	p.add(bs);
    add(p, BorderLayout.SOUTH);
    q = new JPanel();
    q.setLayout(null);
    ldt.setBounds(1015, 20, 60, 20);
    q.add(ldt);
    tdt.setBounds(1060, 20, 170, 20);
    q.add(tdt);
    lpid.setBounds(70, 60, 80, 20);
    q.add(lpid);
    tpid.setBounds(200, 60, 60, 20);
    q.add(tpid);
    lpnm.setBounds(70, 100, 80, 20);
    q.add(lpnm);
    tpfnm.setBounds(200, 100, 100, 20);
    q.add(tpfnm);
    tpmnm.setBounds(320, 100, 100, 20);
    q.add(tpmnm);
    tplnm.setBounds(440, 100, 100, 20);
    q.add(tplnm);
    lgen.setBounds(70, 140, 60, 20);
    q.add(lgen);
    lbg.setBounds(370, 140, 80, 20);
    q.add(lbg);
    tbg.setBounds(470, 140, 60, 20);
    q.add(tbg);
    cm.setBounds(200, 140, 60, 20);
    cf.setBounds(280, 140, 60, 20);
    lage.setBounds(70, 180, 40, 20);
    q.add(lage);
    tage.setBounds(200, 180, 50, 20);
    q.add(tage);
    lwt.setBounds(370, 180, 200, 20);
    q.add(lwt);
    twt.setBounds(470, 180, 60, 20);
    q.add(twt);
    ladd.setBounds(70, 220, 60, 20);
    q.add(ladd);
    tadd.setBounds(200, 220, 350, 50);
    q.add(tadd);
    lcno.setBounds(70, 310, 60, 20);
    q.add(lcno);
    tcno.setBounds(200, 310, 120, 20);
    q.add(tcno);
    ldnm.setBounds(70, 350, 200, 20);
    q.add(ldnm);
    tdnm.setBounds(200, 350, 150, 20);
    q.add(tdnm);
    lsym.setBounds(70, 390, 100, 20);
    q.add(lsym);
    tsym.setBounds(200, 390, 300, 70);
    q.add(tsym);
    ldig.setBounds(70, 480, 60, 20);
    q.add(ldig);
    tdig.setBounds(200, 480, 100, 20);
    q.add(tdig);
    lfee.setBounds(70, 520, 200, 20);
    q.add(lfee);
    tfee.setBounds(200, 520, 40, 20);
    q.add(tfee);
    q.add(cm);
    q.add(cf);
    q.add(image);
    q.add(bu);
    add(q, BorderLayout.CENTER);
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            try {
              patient.con.close();
              System.exit(0);
            } catch (Exception e8) {
            }
          }
        });
    System.out.println(tadd.getText());
    setSize(1330, 740);
    setVisible(true);
  }
コード例 #2
0
  DoctorInfomodify() {
    super("Doctor Information");

    setSize(1200, 750);
    setLocationRelativeTo(null);
    setLayout(null);

    lmain = new JLabel("Doctor Information");
    lmain.setBounds(440, 35, 107, 15);
    add(lmain);

    ldi = new JLabel("Doctor Information");
    ldi.setBounds(40, 70, 120, 15);
    add(ldi);

    lname = new JLabel("Name :");
    lname.setBounds(104, 97, 70, 25);
    add(lname);

    tfname = new JTextField(30);
    tfname.setBounds(270, 97, 250, 20);
    add(tfname);

    ladd = new JLabel("Address :");
    ladd.setBounds(104, 138, 70, 15);
    add(ladd);

    taadd = new TextArea();
    taadd.setBounds(270, 138, 250, 100);
    add(taadd);

    ltel = new JLabel("Contact :");
    ltel.setBounds(575, 138, 50, 25);
    add(ltel);

    ldid = new JLabel("Doctor ID:");
    ldid.setBounds(570, 97, 70, 25);
    add(ldid);

    tfdid = new JTextField(30);
    tfdid.setBounds(643, 97, 50, 20);
    add(tfdid);

    tftel = new JTextField(30);
    tftel.setBounds(640, 138, 200, 20);
    add(tftel);
    settings.Numvalidator(tftel);

    ldspec = new JLabel("Specialization :");
    ldspec.setBounds(104, 310, 100, 25);
    add(ldspec);

    taspecial = new TextArea();
    taspecial.setBounds(270, 310, 250, 100);
    add(taspecial);

    lwork = new JLabel("Working hours :");
    lwork.setBounds(570, 310, 100, 15);
    add(lwork);

    lworkfrom = new JLabel("From :");
    lworkfrom.setBounds(670, 305, 37, 25);
    add(lworkfrom);

    tfworkf = new JTextField(30);
    tfworkf.setBounds(710, 310, 30, 20);
    add(tfworkf);
    settings.Numvalidator(tfworkf);

    lworkto = new JLabel("to :");
    lworkto.setBounds(747, 305, 20, 25);
    add(lworkto);

    tfworkt = new JTextField(30);
    tfworkt.setBounds(775, 310, 30, 20);
    add(tfworkt);
    settings.Numvalidator(tfworkt);

    bsub = new JButton("SEARCH", new ImageIcon("images/search.png"));
    bsub.setBounds(250, 643, 110, 30);
    add(bsub);

    bclr = new JButton("CLEAR", new ImageIcon("images/LOGGOFF.PNG"));
    bclr.setBounds(390, 643, 100, 30);
    add(bclr);

    bmod = new JButton("MODIFY", new ImageIcon("images/modify.png"));
    bmod.setBounds(530, 643, 100, 30);
    add(bmod);

    bback = new JButton("BACK", new ImageIcon("images/restore.png"));
    bback.setBounds(700, 643, 100, 30);
    add(bback);

    try {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      cn = DriverManager.getConnection("Jdbc:Odbc:doc");
    } catch (Exception e) {
      System.out.println(e);
    }

    bclr.addActionListener(new clear());
    bsub.addActionListener(new submit());
    bmod.addActionListener(new modify());
    bback.addActionListener(new back());

    setVisible(true);
  }