public Welcome() {
    c.setLayout(null);

    c.add(welcome);
    welcome.setBounds(250, 100, 600, 50);
    welcome.setFont(font1);
    welcome.setForeground(Color.black);

    c.add(hotel);
    hotel.setBounds(350, 170, 700, 50);
    hotel.setFont(font2);
    hotel.setForeground(Color.black);

    c.add(check);
    check.setBounds(450, 350, 250, 50);
    check.addActionListener(this);

    c.add(order);
    order.setBounds(150, 350, 250, 50);
    order.addActionListener(this);

    c.add(bill);
    bill.setBounds(750, 350, 250, 50);
    bill.addActionListener(this);

    c.add(exit);
    exit.setBounds(40, 600, 130, 20);
    exit.addActionListener(this);

    c.add(back).setBounds(0, 0, 1800, 1000);
  }
  stab(ResultSet k) {
    super("PATIENT FOUND");
    String[] chd = {
      "Date",
      "Patient ID",
      "Name",
      "Gender",
      "Age",
      "Weight",
      "Address",
      "Contact No.",
      "Doctor Name",
      "Symptoms",
      "Dignosis",
      "Fee: Rs.",
      "Blood Group"
    };
    // DefaultTableModel dtm=new DefaultTableModel();
    // jt.setModel(new DefaultTableModel(arr,chd));
    jt = new JTable();
    jsp = new JScrollPane(jt);
    btn = new JButton("CLOSE");
    btn.addActionListener(this);
    int i = 0;

    try {
      while (k.next()) {

        arr[i][0] = k.getString(1);
        // System.out.println("ddddddddddddd"+arr[i][0]);
        arr[i][1] = "" + k.getInt(2);
        arr[i][2] = k.getString(3) + " " + k.getString(4) + " " + k.getString(5);
        arr[i][3] = k.getString(6);
        arr[i][4] = "" + k.getInt(7);
        arr[i][5] = k.getString(8);
        arr[i][6] = k.getString(9);
        arr[i][7] = k.getString(10);
        arr[i][8] = k.getString(11);
        arr[i][9] = k.getString(12);
        arr[i][10] = k.getString(13);
        arr[i][11] = "" + k.getInt(14);
        arr[i][12] = k.getString(15);
        arr[i][13] = k.getString(16);
        // dtm.insertRow(i,new Object[]{patient.rs.getString(1),
        // patient.rs.getInt(2),patient.rs.getString(3)+patient.rs.getString(4)+patient.rs.getString(5),patient.rs.getString(6),patient.rs.getInt(7),patient.rs.getString(8),patient.rs.getString(9),patient.rs.getString(10),patient.rs.getString(11),patient.rs.getString(12),patient.rs.getString(13),patient.rs.getInt(14)});
        i++;
      }
    } catch (Exception e12) {
      System.out.println("" + e12);
    }
    jt.setModel(new DefaultTableModel(arr, chd));
    Container con = getContentPane();
    con.setLayout(null);
    jsp.setBounds(20, 20, 1230, 600);
    btn.setBounds(685, 630, 100, 30);
    add(jsp);
    add(btn);
    setSize(1330, 800);
    setVisible(true);
  }
  public ItensVendidos() {
    super("Itens Vendidos");
    JButton imprimir;

    final DefaultTableModel modelo = new DefaultTableModel();

    // constrói a tabela
    JTable tabela = new JTable(modelo);

    // Cria duas colunas
    modelo.addColumn("Código");
    modelo.addColumn("Vendedor");
    modelo.addColumn("Produto");
    modelo.addColumn("Quantidade");

    imprimir = new JButton("Imprimir");
    imprimir.setBounds(100, 450, 30, 24);

    // exibe os dados da tabela MySQL
    // Conexao banco = new Conexao();
    String retorno = "erro";
    try {
      // Connection ExConn = (Connection) banco.abrirBDconn();
      Class.forName("com.mysql.jdbc.Driver");
      Connection conexao = DriverManager.getConnection("jdbc:mysql://localhost/banco", "root", "");
      Statement stmt = conexao.createStatement();

      // procedimentos para obter os dados de uma tabela

      String query = "SELECT * FROM venda2";
      ResultSet rs = stmt.executeQuery(query);

      while (rs.next()) {
        int id = rs.getInt("idVendedor");
        String nome = rs.getString("nomeVendedor");
        String produto = rs.getString("produto");
        int qtd = rs.getInt("qtd");
        modelo.addRow(new Object[] {new Integer(id), nome, produto, new Integer(qtd)});
      }

      // fim procedimento para obter os dados
    } catch (SQLException ex) {
      System.out.println("SQLException: " + ex.getMessage());
      System.out.println("SQLState: " + ex.getSQLState());
      System.out.println("VendorError: " + ex.getErrorCode());
    } catch (Exception e) {
      System.out.println("Problemas ao tentar conectar com o banco de dados");
    }
    // fim MySQL

    tabela.setPreferredScrollableViewportSize(new Dimension(350, 50));

    Container c = getContentPane();
    c.setLayout(new FlowLayout());

    JScrollPane scrollPane = new JScrollPane(tabela);
    c.add(scrollPane);
    c.add(imprimir);

    setSize(400, 300);
    setVisible(true);
  }
  public Assi() {
    c = getContentPane();

    c.setLayout(new BorderLayout());
    c.add(pnn, BorderLayout.NORTH);
    c.add(pns, BorderLayout.SOUTH);
    c.add(pnc, BorderLayout.CENTER);
    c.add(pne, BorderLayout.EAST);

    pne.setLayout(new GridLayout(2, 1));
    pne.add(pne1);
    pne.add(pne2);
    pne1.setLayout(new FlowLayout());
    pne1.add(go);
    go.addItem("Student");
    go.addItem("Teacher");
    go.addItem("Course");
    go.addItem("Result");
    pne1.add(b6);
    pne2.setLayout(cl2);

    pns.add(b1);
    pns.add(b2);
    pns.add(b3);
    pns.add(b4);
    pns.add(b5);

    setJMenuBar(m);
    m.add(student);
    m.add(teacher);
    m.add(course);
    m.add(result);

    stu.setLayout(new GridLayout(8, 2));
    stu.add(l1);
    stu.add(t1);
    stu.add(l2);
    stu.add(t2);
    stu.add(l3);
    stu.add(t3);
    stu.add(l4);
    stu.add(t4);
    stu.add(l5);
    stu.add(t5);
    stu.add(l6);
    stu.add(t6);

    cou.setLayout(new GridLayout(4, 2));
    cou.add(l7);
    cou.add(t7);
    cou.add(l8);
    cou.add(t8);
    cou.add(l9);
    cou.add(t9);
    cou.add(l0);
    cou.add(t0);

    tea.setLayout(new GridLayout(4, 2));
    tea.add(l11);
    tea.add(t11);
    tea.add(l12);
    tea.add(t12);
    tea.add(l13);
    tea.add(t13);
    tea.add(l14);
    tea.add(t14);

    res.setLayout(new GridLayout(15, 3));
    res.add(l15);
    res.add(t15);
    res.add(l16);
    res.add(t16);
    res.add(l17);
    res.add(t17);
    res.add(lg);
    res.add(l);
    res.add(l18);
    res.add(t18);
    res.add(l19);
    res.add(t19);
    res.add(l20);
    res.add(t20);
    res.add(l21);
    res.add(t21);
    res.add(l22);
    res.add(t22);
    res.add(l23);
    res.add(t23);
    res.add(l24);
    res.add(t24);
    res.add(l25);
    res.add(t25);
    res.add(l26);
    res.add(t26);
    res.add(l27);
    res.add(t27);
    res.add(l28);
    res.add(t28);

    pnc.setLayout(cl);
    pnc.add(blk, "cblk");
    pnc.add(stu, "cstu");
    pnc.add(tea, "ctea");
    pnc.add(cou, "ccou");
    pnc.add(res, "cres");

    b1.addActionListener(this);
    b2.addActionListener(this);
    b3.addActionListener(this);
    b4.addActionListener(this);
    b5.addActionListener(this);
    b6.addActionListener(this);

    student.addActionListener(this);
    teacher.addActionListener(this);
    course.addActionListener(this);
    result.addActionListener(this);

    go.addItemListener(this);
  }
  public vehicle() {
    message = new JLabel("VEHICLE  DETAILS");
    mname = new JLabel("Model Name");
    cap = new JLabel("Capacity");
    cc = new JLabel("CC");
    eng = new JLabel("Engine");
    stroke = new JLabel("Stroke");
    bhp = new JLabel("BHP");
    volt = new JLabel("Volts");
    rpm = new JLabel("RPM");
    weight = new JLabel("Weight");
    kg = new JLabel("Kg");
    gear = new JLabel("Gears");
    color = new JLabel("Color");

    jcmname = new JComboBox();

    tfcap = new JTextField(30);
    tfeng = new JTextField(20);
    tfbhp = new JTextField(10);
    tfvolt = new JTextField(20);
    tfrpm = new JTextField(20);
    tfweight = new JTextField(20);
    tfgear = new JTextField(30);

    jccolor = new JComboBox();

    ok = new JButton("OK");
    can = new JButton("CANCEL");

    can.addActionListener(this);
    can.setActionCommand("can");
    ok.addActionListener(this);
    ok.setActionCommand("Ok");

    Container c = getContentPane();

    setSize(800, 600);
    setTitle("Vehicle Details");
    c.setLayout(null);
    setVisible(true);

    c.add(message);
    c.add(mname);
    c.add(cap);
    c.add(cc);
    c.add(eng);
    c.add(stroke);
    c.add(bhp);
    c.add(volt);
    c.add(rpm);
    c.add(weight);
    c.add(kg);
    c.add(gear);
    c.add(color);

    c.add(jcmname);

    c.add(tfcap);
    c.add(tfeng);
    c.add(tfbhp);
    c.add(tfvolt);
    c.add(tfrpm);
    c.add(tfweight);
    c.add(tfgear);

    c.add(jccolor);

    c.add(ok);
    c.add(can);
    c.setBackground(Color.pink);

    message.setBounds(300, 40, 200, 50);
    mname.setBounds(50, 100, 100, 30);
    cap.setBounds(50, 150, 100, 30);
    cc.setBounds(275, 150, 50, 30);
    eng.setBounds(50, 200, 50, 30);
    stroke.setBounds(275, 200, 100, 30);
    bhp.setBounds(50, 250, 100, 30);
    volt.setBounds(50, 300, 100, 30);
    rpm.setBounds(50, 350, 100, 30);
    weight.setBounds(50, 400, 50, 30);
    kg.setBounds(275, 400, 100, 30);
    gear.setBounds(450, 150, 150, 30);
    color.setBounds(450, 200, 100, 30);

    jcmname.setBounds(200, 100, 100, 30);
    jcmname.addItem(" -- Select --");
    jcmname.addItem("Pulsar");
    jcmname.addItem("CT 100");
    jcmname.addItem("Discover DTS-i");
    jcmname.addItem("Wave DTS-i");

    tfcap.setBounds(200, 150, 70, 30);
    tfeng.setBounds(200, 200, 70, 30);
    tfbhp.setBounds(200, 250, 70, 30);
    tfvolt.setBounds(200, 300, 70, 30);
    tfrpm.setBounds(200, 350, 70, 30);
    tfweight.setBounds(200, 400, 70, 30);
    tfgear.setBounds(500, 150, 70, 30);

    jccolor.setBounds(500, 200, 100, 30);
    jccolor.addItem("Black");
    jccolor.addItem("Blue");
    jccolor.addItem("Red");
    jccolor.addItem("Grey");

    ok.setBounds(270, 480, 85, 30);
    can.setBounds(370, 480, 85, 30);
  }
  public Design() throws Exception {
    super.setBackground(Color.BLACK);
    this.setTitle("");
    con = getContentPane();
    con.setLayout(null);
    dim = tk.getDefaultToolkit().getScreenSize();
    this.setTitle("Customer Peer Login");

    l1 = new JLabel(new ImageIcon("plain.jpg"));
    l1.setBounds(0, 0, 400, 400);
    con.add(l1);
    l1.setBorder(BorderFactory.createEtchedBorder(5, Color.black, Color.black));

    title = new JLabel("CUSTOMER PEER LOGIN ");
    title.setFont(new Font("Bookman Old Style", Font.ROMAN_BASELINE, 20));
    title.setForeground(Color.red);
    title.setBounds(80, 30, 300, 30);
    l1.add(title);

    l4 = new JLabel("CMACHINE NAME");
    l4.setFont(new Font("Bookman Old Style", Font.BOLD, 16));
    l4.setForeground(Color.BLUE);
    l4.setBounds(70, 100, 160, 20);
    //	l4.setBorder(BorderFactory.createEtchedBorder(5,Color.green,Color.green));

    l1.add(l4);
    jtf2 = new JTextField();
    jtf2.setBounds(250, 100, 100, 20);
    jtf2.setBorder(BorderFactory.createEtchedBorder(5, Color.green, Color.green));

    l1.add(jtf2);

    l2 = new JLabel("CUSER LOGIN");
    l2.setFont(new Font("Bookman Old Style", Font.BOLD, 16));
    l2.setForeground(Color.blue);
    l2.setBounds(70, 150, 120, 20);
    l1.add(l2);

    jtf1 = new JTextField();
    jtf1.setBounds(250, 150, 100, 20);
    jtf1.setBorder(BorderFactory.createEtchedBorder(5, Color.green, Color.green));

    l1.add(jtf1);

    l3 = new JLabel("CPASSWORD");
    l3.setFont(new Font("Bookman Old Style", Font.BOLD, 16));
    l3.setForeground(Color.blue);
    l3.setBounds(70, 200, 120, 20);
    l1.add(l3);

    jptf1 = new JPasswordField();
    jptf1.setBounds(250, 200, 100, 20);
    jptf1.setBorder(BorderFactory.createEtchedBorder(5, Color.green, Color.green));

    l1.add(jptf1);

    JLabel l4 = new JLabel("DAgent");
    l4.setFont(new Font("Bookman Old Style", Font.BOLD, 16));
    l4.setForeground(Color.blue);
    l4.setBounds(70, 250, 120, 20);
    l1.add(l4);

    box = new JComboBox();
    box.setBounds(250, 250, 100, 20);
    box.setBorder(BorderFactory.createEtchedBorder(5, Color.green, Color.green));
    l1.add(box);

    b2 = new JButton("Register");
    b2.setBounds(50, 300, 100, 20);
    l1.add(b2);
    b2.setBorder(BorderFactory.createEtchedBorder(10, Color.BLUE, Color.BLUE));

    b3 = new JButton("Login");
    b3.setBounds(150, 300, 100, 20);
    b3.setBorder(BorderFactory.createEtchedBorder(10, Color.BLUE, Color.BLUE));
    l1.add(b3);

    b1 = new JButton("Cancel");
    b1.setBounds(250, 300, 100, 20);
    b1.setBorder(BorderFactory.createEtchedBorder(10, Color.BLUE, Color.BLUE));

    l1.add(b1);

    b1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent we) {

            dispose();
          }
        });

    try {

      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      conn = DriverManager.getConnection("jdbc:odbc:agent");

    } catch (Exception exp) {

    }

    try {
      Statement satem = conn.createStatement();
      ResultSet rsatem = satem.executeQuery("select * from Dagent");
      while (rsatem.next()) {
        String namem = rsatem.getString("uname");
        box.addItem(namem);
      }

    } catch (Exception expo1) {

    }

    b2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent we) {

            String username = jtf1.getText().trim();
            String password = jptf1.getText().trim();
            String mechine = jtf2.getText().trim();
            String dname = box.getSelectedItem().toString();
            int porte = 0;

            try {
              Statement sate = conn.createStatement();
              ResultSet rsate =
                  sate.executeQuery("select * from Dagent where uname='" + dname + "'");
              if (rsate.next()) {
                servermachine = rsate.getString("umechine");
                porte = rsate.getInt("ulistport");
                System.out.println(servermachine);
              }
              System.out.println(servermachine);

            } catch (Exception exp) {
              exp.printStackTrace();
            }

            try {
              packet p = new packet();
              p.setaction("Creg");
              p.setCuser(username);
              p.setCpass(password);
              p.setCmname(mechine);
              p.setCDpeer(dname);
              Socket soc = new Socket(servermachine, porte);
              ObjectOutputStream out = new ObjectOutputStream(soc.getOutputStream());
              out.writeObject(p);
              ObjectInputStream in = new ObjectInputStream(soc.getInputStream());
              packet rpac = (packet) in.readObject();
              if (rpac.getaction().equals("ok")) {

                JOptionPane.showMessageDialog(null, "Sucessfully Registered");

                jtf2.setText("");
                jtf1.setText("");
                jptf1.setText("");

              } else {

                JOptionPane.showMessageDialog(null, "Already Registered");
                jtf2.setText("");
                jtf1.setText("");
                jptf1.setText("");
              }

            } catch (Exception exp) {
            }
          }
        });

    b3.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent we) {

            String username = jtf1.getText().trim();
            String password = jptf1.getText().trim();
            String mechine = jtf2.getText().trim();
            String Dname = box.getSelectedItem().toString();

            int porte = 0;

            try {
              Statement sate = conn.createStatement();
              ResultSet rsate =
                  sate.executeQuery("select * from Dagent where uname='" + Dname + "'");
              if (rsate.next()) {
                servermachine = rsate.getString("umechine");
                porte = rsate.getInt("ulistport");
                System.out.println(servermachine);
              }
              System.out.println(servermachine);

            } catch (Exception exp) {

            }

            try {

              packet p1 = new packet();
              p1.setaction("clogin");
              p1.setCuser(username);
              p1.setCpass(password);
              p1.setCmname(mechine);
              p1.setCDpeer(Dname);
              Socket soc1 = new Socket(servermachine, porte);
              ObjectOutputStream out1 = new ObjectOutputStream(soc1.getOutputStream());
              out1.writeObject(p1);
              ObjectInputStream in1 = new ObjectInputStream(soc1.getInputStream());
              packet rpac1 = (packet) in1.readObject();
              if (rpac1.getaction().equals("ok")) {
                int port1 = 0;
                try {

                  int portm = rpac1.getCport();
                  System.out.println("XXXXXXX" + portm);
                  //	JOptionPane.showMessageDialog(null,"Sucessfully Started");

                  new Listen(portm);
                  new process(username, portm);
                  dispose();
                } catch (Exception exp) {
                }
              } else {
                JOptionPane.showMessageDialog(
                    null, "Enter valid username and password", "Server reply", 2);
                jtf1.setText("");
                jtf2.setText("");
                jptf1.setText("");
              }

            } catch (Exception exp) {
            }
          }
        });

    setSize(400, 400);
    show();
    setLocation(150, 100);
    setResizable(false);
  }