Exemplo n.º 1
2
  AdminMain() {
    l = new JLabel();
    l.setBounds(10, 20, 1340, 1000);
    l.setBackground(Color.black);
    Font ft = new Font("Arial", Font.BOLD, 30);
    Font ft1 = new Font("Arial", Font.BOLD, 14);
    Font ft2 = new Font("Arial", Font.BOLD, 20);

    f1 = new Frame("Soft Test Management (Beta)");
    f1.setLayout(null);

    l1 = new Label("Test Instructions", l1.CENTER);
    l1.setBounds(10, 20, 1300, 60);
    l1.setForeground(Color.blue);
    l1.setBackground(Color.white);
    l1.setFont(ft);

    l2 = new JLabel("Deletion of Faculty/Students");
    l2.setBounds(20, 30, 1000, 500);
    l2.setBackground(Color.blue);
    l2.setFont(ft2);
    l3 = new JLabel("Test Pattern");
    l3.setBounds(20, 90, 1300, 500);
    l3.setBackground(Color.green);
    l3.setFont(ft2);

    b1 = new JButton("Go !");
    b1.setBounds(300, 220, 120, 30);
    b1.setBackground(Color.white);
    b1.setForeground(Color.blue);
    b1.setFont(ft2);

    b2 = new JButton("Go");
    b2.setBounds(300, 240, 120, 30);
    b2.setBackground(Color.white);
    b2.setForeground(Color.blue);
    b2.setFont(ft2);

    f1.add(l);
    l.add(l1);
    l2.add(b1);
    l.add(l2);
    l3.add(b2);
    l.add(l3);

    b1.addActionListener(this);
    b2.addActionListener(this);

    f1.setVisible(true);
    f1.setSize(1800, 800);
  }
  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);
  }
Exemplo n.º 3
0
  public hostelStatus() {
    setTitle("Hostel");
    connect();
    updateRecord();

    JFrame fr = new JFrame();
    Toolkit tkt = fr.getToolkit();
    Dimension frsize = tkt.getScreenSize();
    setBounds(frsize.width / 4, frsize.height / 12, frsize.width / 2, frsize.height / 8);
    setLayout(null);

    cn = getContentPane();
    cn.setBackground(new Color(190, 180, 170));

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    tl = new JLabel("Current Hostels Status");
    tl.setFont(new Font("Engravers MT", 1, 25));
    tl.setForeground(new Color(247, 251, 249));

    p1 = new JPanel();
    p1.setBounds(0, 0, 600, 50);
    p1.add(tl);
    p1.setBackground(new Color(31, 88, 166));
    cn.add(p1);

    b1 = new JButton("LOAD");
    b1.setMnemonic('L');
    b1.addActionListener(new dispListener());
    b1.setBounds(230, 320, 120, 30);

    b2 = new JButton("EXIT");
    b2.setMnemonic('X');
    b2.addActionListener(new exitListener());
    b2.setBounds(350, 320, 100, 30);

    cn.add(b1);
    cn.add(b2);

    table = new JTable(data, col);
    table.setFont(new Font("Serif", Font.BOLD, 16));
    table.setBackground(new Color(250, 250, 250));
    table.setEnabled(false);

    JScrollPane jsp = new JScrollPane(table);
    jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jsp.setBounds(5, 100, 590, 200);
    cn.add(jsp);

    screensize = Toolkit.getDefaultToolkit().getScreenSize();

    setSize(600, 400);
    setVisible(true);
    setVisible(true);
    setResizable(true);
    connect();
  }
Exemplo n.º 4
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.setBounds(100, 100, 450, 300);
    frame.setVisible(true);
    frame.setResizable(false);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

    JButton btnCustomer = new JButton("Customer");
    btnCustomer.setFont(new Font("Tahoma", Font.BOLD, 16));
    btnCustomer.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            JOptionPane.showMessageDialog(null, "Welcome to Coffee Kiosk ");
            // Coffee1 nw = new Coffee1();
            // nw.NewScreen();
            cust = cust + 1;
            Customer cs = new Customer();
            cs.CustomerScreen();
          }
        });
    btnCustomer.setBounds(83, 94, 117, 86);
    frame.getContentPane().add(btnCustomer);

    JButton btnAdmin = new JButton("Admin");
    btnAdmin.setFont(new Font("Tahoma", Font.BOLD, 16));
    btnAdmin.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(null, "Welcome Admin ");
            Login ls = new Login();
            ls.LoginScreen();
          }
        });

    btnAdmin.setBounds(229, 94, 117, 86);
    frame.getContentPane().add(btnAdmin);

    JButton btnExit = new JButton("EXIT");
    btnExit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            JOptionPane.showMessageDialog(null, "Thank You for using Coffee Kiosk");
            System.exit(0);
          }
        });
    btnExit.setBounds(168, 207, 89, 23);
    frame.getContentPane().add(btnExit);

    JLabel lblLeedsCoffeeKiosk = new JLabel("LEEDS COFFEE KIOSK");
    lblLeedsCoffeeKiosk.setHorizontalAlignment(SwingConstants.CENTER);
    lblLeedsCoffeeKiosk.setFont(new Font("Times New Roman", Font.BOLD | Font.ITALIC, 30));
    lblLeedsCoffeeKiosk.setForeground(new Color(148, 0, 211));
    lblLeedsCoffeeKiosk.setBounds(36, 11, 366, 72);
    frame.getContentPane().add(lblLeedsCoffeeKiosk);
  }
Exemplo n.º 5
0
 public void tampilan_GUI() {
   this.getContentPane().setBackground(Color.yellow);
   this.getContentPane().setLayout(null);
   jLabel1.setFont(new java.awt.Font("Dialog", 1, 16));
   jLabel1.setText("Please Waiting...");
   jLabel1.setBounds(new Rectangle(14, 5, 187, 30));
   prosesBar.setBounds(new Rectangle(14, 40, 311, 16));
   prosesBar.setStringPainted(true);
   statusProses.setText("");
   statusProses.setBounds(new Rectangle(14, 60, 311, 16));
   this.getContentPane().add(jLabel1);
   this.getContentPane().add(prosesBar);
   this.getContentPane().add(statusProses);
 }
Exemplo n.º 6
0
  LoginForm() {
    setDefaultLookAndFeelDecorated(true);
    f = new JFrame("LoginForm");
    f.setSize(750, 330);
    f.setLocation(200, 200);
    f.setResizable(false);
    JPanel p = new JPanel();
    f.getContentPane().add(p);
    p.setBackground(Color.white);
    icon = new ImageIcon("img.jpg");
    image = new JLabel(icon);
    image.setSize(100, 100);
    l2 = new JLabel("�");
    t1 = new JTextField(16);
    l3 = new JLabel("Password");
    jp1 = new JPasswordField(16);
    // img = getImage(getDocumentBase(), getParameter("img"));

    b1 = new JButton("Login");
    b2 = new JButton("Reset");
    b3 = new JButton("Cancel");
    l1 = new JLabel("       SANJEEVANI HOSPITAL");
    Font fk = new Font("Algerian", Font.BOLD, 40);
    l1.setFont(fk);
    l1.setForeground(Color.RED);
    l2 = new JLabel("UserName");
    l4 = new JLabel("�                                              ");

    p.add(l1);
    p.add(l4);
    p.add(l2);

    p.add(t1);

    p.add(l3);
    p.add(jp1);

    p.add(b1);
    p.add(b2);
    p.add(b3);
    p.add(image, BorderLayout.SOUTH);
    b1.addActionListener(this);
    b2.addActionListener(this);
    b3.addActionListener(this);

    f.setVisible(true);
  }
Exemplo n.º 7
0
  Jf() {

    j.setBounds(500, 40, 500, 500);
    j.setVisible(true);
    j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    j.setLayout(null);
    ImageIcon image = new ImageIcon("im1.jpg");
    JLabel l = new JLabel(image);
    int m = image.getIconWidth();
    int m1 = image.getIconHeight();
    j.setResizable(false); // frame resize nahi hoga	
    l.setBounds(0, 0, m, m1);
    j.add(l);
    l.add(linfo);
    l.add(lid);
    l.add(fid);
    l.add(lpass);
    l.add(fpass);
    fpass.setEchoChar('*');

    l.add(blogin);
    l.add(bnewaccount);
    l.add(bforget);

    ImageIcon image1 = new ImageIcon("logo1.png");
    JLabel limage = new JLabel(image1);
    l.add(limage);
    limage.setBounds(10, 50, 190, 130);

    Font f = new Font("ALGERIAN", Font.BOLD, 20);
    linfo.setFont(f);
    linfo.setBounds(40, 10, 420, 30);
    lid.setBounds(210, 50, 70, 30);
    fid.setBounds(290, 50, 150, 30);
    lpass.setBounds(210, 90, 70, 30);
    fpass.setBounds(290, 90, 150, 30);
    blogin.setBounds(210, 130, 100, 50);
    bnewaccount.setBounds(320, 130, 160, 20);
    bforget.setBounds(320, 160, 160, 20);
    blogin.setBackground(Color.green);
    bnewaccount.setBackground(Color.cyan);
    bforget.setBackground(Color.pink);

    blogin.addActionListener(new Login());
    bnewaccount.addActionListener(new Account());
    bforget.addActionListener(new Forget());
  }
Exemplo n.º 8
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.getContentPane().setBackground(new Color(153, 50, 204));
    frame.setBounds(100, 100, 725, 547);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

    JLabel lblNewLabel = new JLabel("Username");
    lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 18));
    lblNewLabel.setBounds(119, 113, 146, 36);
    frame.getContentPane().add(lblNewLabel);

    textField = new JTextField();
    textField.setBounds(355, 122, 153, 22);
    frame.getContentPane().add(textField);
    textField.setColumns(10);

    JLabel lblNewLabel_1 = new JLabel("Password");
    lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 18));
    lblNewLabel_1.setBounds(119, 213, 87, 22);
    frame.getContentPane().add(lblNewLabel_1);

    JButton btnNewButton = new JButton("Back");
    btnNewButton.setFont(new Font("Tahoma", Font.PLAIN, 22));
    btnNewButton.setBounds(124, 313, 121, 36);
    frame.getContentPane().add(btnNewButton);

    JButton btnNewButton_1 = new JButton("Login");
    btnNewButton_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            try {
              String query = "select * from logindetails where UserName=? and Password=?";
              PreparedStatement pst = connect.prepareStatement(query);
              pst.setString(1, textField.getText());
              pst.setString(2, passwordField.getText());
              ResultSet rs = pst.executeQuery();
              if (rs.next()) {
                // JOptionPane.showMessageDialog(null, "connection successfull");
                ah.setVisible(true);
                frame.dispose();
              } else {
                JOptionPane.showMessageDialog(
                    null, "user credentials are wrong.Try again with correct credentials");
              }
            } catch (Exception e) {
              JOptionPane.showMessageDialog(null, e);
            }
          }
        });
    btnNewButton_1.setFont(new Font("Tahoma", Font.PLAIN, 22));
    btnNewButton_1.setBounds(424, 314, 97, 35);
    frame.getContentPane().add(btnNewButton_1);

    passwordField = new JPasswordField();
    passwordField.setBounds(355, 215, 166, 22);
    frame.getContentPane().add(passwordField);

    JLabel lblNewLabel_2 = new JLabel("Administrator Login");
    lblNewLabel_2.setForeground(new Color(128, 128, 128));
    lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 28));
    lblNewLabel_2.setBounds(199, 48, 309, 34);
    frame.getContentPane().add(lblNewLabel_2);
  }
Exemplo n.º 9
0
  public void setContent(String cat) {
    cat = cat.trim();
    selectAllCB.setVisible(false);
    selectAllCB.setSelected(false);
    deleteBut.setVisible(false);
    restoreBut.setVisible(false);
    refreshBut.setVisible(true);
    Object columns[] = null;
    int count = 0;
    switch (cat) {
      case "Inbox":
        columns = new Object[] {"", "From", "Date", "Subject", "Content"};
        count = Database.getCount("Inbox");
        workingSet = db.getData("SELECT * FROM messages WHERE tag='inbox' ORDER BY msg_id desc");
        ;
        break;
      case "SentMail":
        columns = new Object[] {"", "To", "Date", "Subject", "Content"};
        count = Database.getCount("Sentmail");
        workingSet = db.getData("SELECT * FROM messages WHERE tag='sentmail' ORDER BY msg_id desc");
        break;
      case "Draft":
        columns = new Object[] {"", "To", "Date", "Subject", "Content"};
        count = Database.getCount("Draft");
        workingSet = db.getData("SELECT * FROM messages WHERE tag='draft' ORDER BY msg_id desc");
        break;
      case "Outbox":
        columns = new Object[] {"", "To", "Date", "Subject", "Content"};
        count = Database.getCount("Outbox");
        workingSet = db.getData("SELECT * FROM messages WHERE tag='outbox' ORDER BY msg_id desc");
        break;
      case "Trash":
        //                restoreBut.setVisible(true);
        columns = new Object[] {"", "To/From", "Date", "Subject", "Content"};
        count = Database.getCount("Trash");
        workingSet =
            db.getData(
                "SELECT * FROM messages,trash WHERE messages.tag='trash' and messages.msg_id=trash.msg_id ORDER BY deleted_at desc");
        break;
      default:
        System.out.println("in default case");
    }
    if (count > 0) {
      selectAllCB.setVisible(true);
      rows = new Object[count][];
      msgID = new int[count];
      try {
        workingSet.beforeFirst();
        for (int i = 0; i < count && workingSet.next(); i++) {
          msgID[i] = workingSet.getInt(1);
          rows[i] =
              new Object[] {
                false,
                workingSet.getString(2),
                workingSet.getDate(3),
                workingSet.getString(4),
                workingSet.getString(5)
              };
        }
      } catch (SQLException sqlExc) {
        JOptionPane.showMessageDialog(null, sqlExc, "EXCEPTION", JOptionPane.ERROR_MESSAGE);
        sqlExc.printStackTrace();
      }

      tableModel = new MyDefaultTableModel(rows, columns);
      table = new JTable(tableModel);
      table.getSelectionModel().addListSelectionListener(this);
      table.addMouseListener(this);
      table.getTableHeader().setOpaque(true);
      table.getTableHeader().setReorderingAllowed(false);
      //            table.getTableHeader().setBackground(Color.blue);
      table.getTableHeader().setForeground(Color.blue);
      //        table.setRowSelectionAllowed(false);
      //            table.setColumnSelectionAllowed(false);
      table.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 14));
      table.setRowHeight(20);
      table.setFillsViewportHeight(true);

      TableColumn column = null;
      for (int i = 0; i < 5; i++) {
        column = table.getColumnModel().getColumn(i);
        if (i == 0) {
          column.setPreferredWidth(6);
        } else if (i == 3) {
          column.setPreferredWidth(250);
        } else if (i == 4) {
          column.setPreferredWidth(450);
        } else {
          column.setPreferredWidth(40);
        }
      }
      table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);

      remove(contentPan);
      contentPan = new JScrollPane(table);
      contentPan.setBackground(Color.orange);
      contentPan.setOpaque(true);
      contentPan.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
      add(contentPan, "Center");
      Home.home.homeFrame.setVisible(true);
    } else {
      JPanel centPan = new JPanel(new GridBagLayout());
      centPan.setBackground(new Color(52, 86, 70));
      JLabel label = new JLabel("No Messages In This Category");
      label.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 22));
      label.setForeground(Color.orange);
      centPan.add(label);
      remove(contentPan);
      contentPan = new JScrollPane(centPan);
      contentPan.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
      add(contentPan, "Center");
      contentPan.repaint();
    }
  }
Exemplo n.º 10
0
  public void createGUI() {
    setLayout(new BorderLayout());
    toolBar = new JToolBar("options", JToolBar.HORIZONTAL);
    toolBar.setFloatable(false);
    toolBar.setOpaque(true);
    toolBar.setBackground(new Color(154, 12, 12));
    toolBar.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 15));
    selectAllCB = new JCheckBox("Select All");
    selectAllCB.setVisible(false);
    selectAllCB.setForeground(Color.white);
    selectAllCB.addActionListener(this);
    refreshBut = new JButton(new ImageIcon(this.getClass().getResource("/images/reloadIcon.png")));
    refreshBut.setVisible(false);
    refreshBut.setToolTipText("Refresh");
    refreshBut.setForeground(new Color(20, 88, 49));
    refreshBut.addActionListener(this);
    backBut = new JButton(new ImageIcon(this.getClass().getResource("/images/backIcon.png")));
    backBut.setVisible(false);
    backBut.setToolTipText("Back");
    backBut.setForeground(new Color(20, 88, 49));
    backBut.addActionListener(this);
    deleteBut = new JButton(new ImageIcon(this.getClass().getResource("/images/trashIcon.png")));
    deleteBut.setToolTipText("Delete");
    deleteBut.setForeground(Color.red);
    deleteBut.setVisible(false);
    deleteBut.addActionListener(this);
    deleteBut.setBackground(Color.red);
    restoreBut = new JButton(new ImageIcon(this.getClass().getResource("/images/restoreIcon.png")));
    restoreBut.setToolTipText("Restore");
    restoreBut.setForeground(Color.blue);
    restoreBut.setVisible(false);
    restoreBut.addActionListener(this);
    toolBar.addSeparator(new Dimension(10, 5));
    toolBar.add(selectAllCB);
    toolBar.add(backBut);
    toolBar.add(refreshBut);
    toolBar.add(deleteBut);
    toolBar.add(restoreBut);
    add(toolBar, "North");
    JPanel centPan = new JPanel(new GridBagLayout());
    centPan.setBackground(new Color(52, 86, 70));
    JLabel label = new JLabel("Select A Category From Left Pane");
    label.setFont(new Font("arial", Font.BOLD, 35));
    label.setForeground(Color.yellow);
    centPan.add(label);
    contentPan = new JScrollPane(centPan);
    contentPan.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    add(contentPan, "Center");
    contentPan.repaint();

    db = new Database();
    //        inboxSet = db.getData("SELECT * FROM messages WHERE tag='inbox' ORDER BY msg_id
    // desc");
    //        sentmailSet = db.getData("SELECT * FROM messages WHERE tag='sentmail' ORDER BY msg_id
    // desc");
    //        draftSet = db.getData("SELECT * FROM messages WHERE tag='draft' ORDER BY msg_id
    // desc");
    //        outboxSet = db.getData("SELECT * FROM messages WHERE tag='outbox' ORDER BY msg_id
    // desc");
    //        trashSet = db.getData("SELECT * FROM messages,trash WHERE messages.tag='trash' and
    // messages.msg_id=trash.msg_id ORDER BY deleted_at desc");

  }
Exemplo n.º 11
0
  public Summary(int patient_id) {
    this.patient_id = patient_id;
    setTitle("Summary");
    setSize(
        (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth()),
        (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight()) - 40);
    setResizable(false);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    head = new JLabel("MEDI_SCAN DIAGNOSTIC LAB SERVICES", SwingConstants.CENTER);
    head.setForeground(Color.WHITE);
    Font f2 = new Font("Papyrus", Font.BOLD, 36);
    head.setFont(f2);
    res = new JLabel("RESULT SUMMARY", SwingConstants.CENTER);
    res.setForeground(Color.WHITE);
    Font f3 = new Font("Papyrus", Font.BOLD, 28);
    res.setFont(f3);
    Font f1 = new Font("Goudy Old Style", Font.BOLD, 16);
    hello = new JLabel("Hello Mr./Miss ");
    hello.setForeground(new Color(54, 34, 174));
    hello.setFont(f1);

    fin = new JLabel("Your Medical Test Is Finished");
    fin.setFont(f1);
    fin.setForeground(new Color(54, 34, 174));
    pname = new JLabel("Patient Name");
    pname.setForeground(new Color(54, 34, 174));
    pname.setFont(f1);
    ldate = new JLabel("Test Date");
    ldate.setForeground(new Color(54, 34, 174));
    ldate.setFont(f1);
    age = new JLabel("Age");
    age.setForeground(new Color(54, 34, 174));
    age.setFont(f1);
    sex = new JLabel("Sex");
    sex.setForeground(new Color(54, 34, 174));
    sex.setFont(f1);
    tname = new JLabel("Test Name");
    tname.setForeground(new Color(54, 34, 174));
    tname.setFont(f1);
    nvalue = new JLabel("Normal Value");
    nvalue.setForeground(new Color(54, 34, 174));
    nvalue.setFont(f1);
    trate = new JLabel("Test Rate");
    trate.setForeground(new Color(54, 34, 174));
    trate.setFont(f1);
    tresult = new JLabel("Test Result");
    tresult.setForeground(new Color(54, 34, 174));
    tresult.setFont(f1);
    tamt = new JLabel("Total Amout");
    tamt.setForeground(new Color(54, 34, 174));
    tamt.setFont(f1);

    exit = new JButton("EXIT");
    exit.setFont(f1);

    pHead = new JPanel(new GridLayout(2, 1));
    pHead.setBackground(new Color(134, 134, 234));
    pCenter = new JPanel(new GridBagLayout());
    pCenter.setBackground(new Color(211, 248, 253));
    pCom = new JPanel(new BorderLayout());
    pCom.setBackground(new Color(211, 248, 253));
    pSouth = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    pSouth.setBackground(new Color(211, 248, 253));

    // Adding Icon on top-left.
    ImageIcon img = new ImageIcon("pics/logo.jpg");
    this.setIconImage(img.getImage());

    try {
      Connection con = JDBCConnection.getConnection();
      PreparedStatement pstmt =
          con.prepareStatement(
              "Select first_name,last_name,age,sex,test_id,tdate from patientreg where patient_id=?");
      pstmt.setInt(1, this.patient_id);
      ResultSet rs = pstmt.executeQuery();
      if (rs.next()) {
        first_name = rs.getString("first_name");
        lname = rs.getString("last_name");
        name = new JLabel(first_name + " " + lname);
        name1 = new JLabel(first_name + " " + lname);
        p_age = rs.getInt("age");
        pAge = new JLabel(p_age + "");
        p_sex = rs.getString("sex");
        psex = new JLabel(p_sex);
        t_id = rs.getInt("test_id");
        t_date = rs.getString("tdate");
        date1 = new JLabel(t_date);
      }
    } catch (SQLException s) {
      s.printStackTrace();
    }

    try {
      Connection con = JDBCConnection.getConnection();
      PreparedStatement pstmt =
          con.prepareStatement("Select test_result from reportbydoctor where patient_id=?");
      pstmt.setInt(1, this.patient_id);
      ResultSet rs = pstmt.executeQuery();
      if (rs.next()) {

        te_res = rs.getString("test_result");
        result = new JLabel(te_res);
      }
    } catch (SQLException s) {
      s.printStackTrace();
    }

    try {
      Connection con = JDBCConnection.getConnection();
      PreparedStatement pstmt =
          con.prepareStatement("select normal_val,rate,test_name from addtest where test_id=?");
      pstmt.setInt(1, t_id);
      ResultSet rs = pstmt.executeQuery();
      if (rs.next()) {
        n_value = rs.getInt("normal_val");
        normal_value1 = new JLabel(n_value + "");
        te_rate = rs.getInt("rate");
        rate1 = new JLabel(te_rate + "");
        rate2 = new JLabel(te_rate + "");
        te_name = rs.getString("test_name");
        testname = new JLabel(te_name);
      }
    } catch (SQLException a) {
      a.printStackTrace();
    }

    content = getContentPane();

    // for label hello
    GridBagConstraints gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 1;
    gc.gridwidth = 1;
    gc.gridy = 1;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 50, 20, 0);
    pCenter.add(hello, gc);

    // for label name1
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 2;
    gc.gridwidth = 1;
    gc.gridy = 1;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 0);
    pCenter.add(name1, gc);

    // for label fin
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 3;
    gc.gridwidth = 2;
    gc.gridy = 1;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(fin, gc);

    // for label pname
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 1;
    gc.gridwidth = 1;
    gc.gridy = 2;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(pname, gc);

    // for label name
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 2;
    gc.gridwidth = 1;
    gc.gridy = 2;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(name, gc);

    // for label ldate
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 1;
    gc.gridwidth = 1;
    gc.gridy = 3;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(ldate, gc);

    // for label date1
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 2;
    gc.gridwidth = 1;
    gc.gridy = 3;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(date1, gc);

    // for label age
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 1;
    gc.gridwidth = 1;
    gc.gridy = 4;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(age, gc);

    // for label pAge
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 2;
    gc.gridwidth = 1;
    gc.gridy = 4;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(pAge, gc);

    // for label sex
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 1;
    gc.gridwidth = 1;
    gc.gridy = 5;
    gc.ipadx = 125;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(sex, gc);

    // for label psex
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 2;
    gc.gridwidth = 1;
    gc.gridy = 5;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);

    pCenter.add(psex, gc);

    // for label tname
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 1;
    gc.gridwidth = 1;
    gc.gridy = 6;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(tname, gc);

    // for label nvalue
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 2;
    gc.gridwidth = 1;
    gc.gridy = 6;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(nvalue, gc);

    // for label trate
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 3;
    gc.gridwidth = 1;
    gc.gridy = 6;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(trate, gc);

    // for label tresult
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 4;
    gc.gridwidth = 1;
    gc.gridy = 6;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(tresult, gc);

    // for label testname
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 1;
    gc.gridwidth = 1;
    gc.gridy = 7;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(testname, gc);

    // for label normal_value1
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 2;
    gc.gridwidth = 1;
    gc.gridy = 7;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(normal_value1, gc);

    // for label rate1
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 3;
    gc.gridwidth = 1;
    gc.gridy = 7;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(rate1, gc);

    // for label result
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 4;
    gc.gridwidth = 1;
    gc.gridy = 7;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(result, gc);

    // for label tamt
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 3;
    gc.gridwidth = 1;
    gc.gridy = 8;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(tamt, gc);

    // for label rate2
    gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.NONE;
    gc.gridx = 4;
    gc.gridwidth = 1;
    gc.gridy = 8;
    gc.ipadx = 0;
    gc.ipady = 10;
    gc.weightx = 0;
    gc.weighty = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.insets = new Insets(0, 0, 20, 20);
    pCenter.add(rate2, gc);

    exit.addActionListener(this);
    pSouth.add(exit);
    content.add(pSouth, BorderLayout.SOUTH);

    pHead.add(head);
    pHead.add(res);

    content.add(pHead, BorderLayout.NORTH);
    content.add(pCenter, BorderLayout.CENTER);
    setVisible(true);
  }
Exemplo n.º 12
0
  public void createGUI() {
    setLayout(new BorderLayout());
    JPanel topPan = new JPanel(new BorderLayout());
    //        topPan.setBorder(BorderFactory.createRaisedSoftBevelBorder());
    JPanel topCentPan = new JPanel();
    JLabel titleLab = new JLabel();
    titleLab.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));
    topCentPan.add(titleLab);

    JPanel topRightPan = new JPanel();
    //        Cursor handCursor = new Cursor(Cursor.HAND_CURSOR);
    replyBut = new JButton(new ImageIcon("src\\images\\replyIcon.png"));
    replyBut.setBorder(BorderFactory.createEmptyBorder());
    replyBut.addActionListener(this);
    replyBut.setCursor(new Cursor(Cursor.HAND_CURSOR));
    replyBut.setToolTipText("Reply");
    replyBut.setContentAreaFilled(false);
    replyBut.setRolloverEnabled(true);
    forwardBut = new JButton(new ImageIcon("src\\images\\forwardIcon.png"));
    forwardBut.setBorder(BorderFactory.createEmptyBorder());
    forwardBut.addActionListener(this);
    forwardBut.setCursor(new Cursor(Cursor.HAND_CURSOR));
    forwardBut.setToolTipText("Forward");
    forwardBut.setContentAreaFilled(false);
    forwardBut.setRolloverEnabled(true);
    topRightPan.add(replyBut);
    topRightPan.add(forwardBut);
    topPan.add(topCentPan, "Center");
    topPan.add(topRightPan, "East");

    JPanel centPan = new JPanel(new BorderLayout());
    JPanel centTopPan = new JPanel(new BorderLayout());
    JPanel centTopLeftPan = new JPanel();
    JLabel fromLab = new JLabel();
    fromLab.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 12));
    JTextArea contentTA = new JTextArea();
    //            JEditorPane contentTA = new JEditorPane(JEditorPane.W3C_LENGTH_UNITS,"");
    contentTA.setLineWrap(true);
    contentTA.setEditable(false);
    centTopLeftPan.add(fromLab);
    JPanel centTopRightPan = new JPanel();
    JLabel dateLab = new JLabel();
    dateLab.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    centTopRightPan.add(dateLab);
    centTopPan.add(centTopLeftPan, "West");
    centTopPan.add(centTopRightPan, "East");
    centPan.add(centTopPan, "North");
    centPan.add(new JScrollPane(contentTA), "Center");

    add(topPan, "North");
    add(centPan, "Center");

    try {
      workingSet.absolute(pointer + 1);
      msgID = Home.bodyPan.msgID[pointer];
      titleLab.setText(workingSet.getString("subject"));
      fromLab.setText("From: " + workingSet.getString("mail_addresses"));
      dateLab.setText(workingSet.getString("sent_date"));
      contentTA.setText(workingSet.getString("content"));
    } catch (SQLException sqlExc) {
      JOptionPane.showMessageDialog(this, sqlExc, "EXCEPTION", JOptionPane.ERROR_MESSAGE);
    }
    Home.bodyPan.remove(Home.bodyPan.contentPan);
    Home.bodyPan.contentPan = new JScrollPane(this);
    Home.bodyPan.add(Home.bodyPan.contentPan);
    Home.home.homeFrame.setVisible(true);
  }
Exemplo n.º 13
0
  /** Create the frame. */
  public SotrudnikDialog() {
    setTitle(
        "\u041D\u043E\u0432\u044B\u0439 \u0441\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A");
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    setBounds(100, 100, 450, 330);
    contentPane = new JPanel();
    contentPane.setBackground(new Color(255, 204, 255));
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JLabel label_familiya = new JLabel("\u0424\u0430\u043C\u0438\u043B\u0438\u044F");
    label_familiya.setBounds(10, 37, 110, 14);
    contentPane.add(label_familiya);

    JLabel label_imya = new JLabel("\u0418\u043C\u044F");
    label_imya.setBounds(10, 62, 110, 14);
    contentPane.add(label_imya);

    JLabel label_otchestvo = new JLabel("\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E");
    label_otchestvo.setBounds(10, 87, 110, 14);
    contentPane.add(label_otchestvo);

    textField_otchestvo = new JTextField();
    textField_otchestvo.setBounds(167, 84, 186, 20);
    contentPane.add(textField_otchestvo);
    textField_otchestvo.setColumns(10);

    textField_imya = new JTextField();
    textField_imya.setBounds(167, 58, 186, 20);
    contentPane.add(textField_imya);
    textField_imya.setColumns(10);

    textField_familiya = new JTextField();
    textField_familiya.setBounds(167, 33, 186, 20);
    contentPane.add(textField_familiya);
    textField_familiya.setColumns(10);

    JLabel label_data_priema =
        new JLabel(
            "\u0414\u0430\u0442\u0430 \u043F\u0440\u0438\u0435\u043C\u0430 \u043D\u0430 \u0440\u0430\u0431\u043E\u0442\u0443");
    label_data_priema.setBounds(10, 112, 147, 14);
    contentPane.add(label_data_priema);

    JLabel label_phone = new JLabel("\u0422\u0435\u043B\u0435\u0444\u043E\u043D");
    label_phone.setBounds(10, 137, 134, 14);
    contentPane.add(label_phone);

    JLabel label_doljnost = new JLabel("\u0414\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C");
    label_doljnost.setBounds(10, 162, 140, 14);
    contentPane.add(label_doljnost);

    JLabel label_kvalification =
        new JLabel("\u041A\u0432\u0430\u043B\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F");
    label_kvalification.setBounds(10, 190, 147, 14);
    contentPane.add(label_kvalification);

    textField_phone = new JTextField();
    textField_phone.setBounds(167, 134, 186, 20);
    contentPane.add(textField_phone);
    textField_phone.setColumns(10);

    textField_date.setBounds(167, 109, 186, 20);
    contentPane.add(textField_date);

    label_id_hidden.setFont(new Font("Tahoma", Font.BOLD, 12));
    label_id_hidden.setBounds(143, 11, 122, 14);
    contentPane.add(label_id_hidden);

    button_insert.setBounds(83, 230, 160, 23);
    contentPane.add(button_insert);

    button_cancel.setBounds(264, 230, 104, 23);
    contentPane.add(button_cancel);

    button_update.setBounds(83, 230, 160, 23);
    contentPane.add(button_update);

    JButton button_plus_doljnost = new JButton("+");
    button_plus_doljnost.addActionListener(
        new ActionListener() {
          @SuppressWarnings("deprecation")
          public void actionPerformed(ActionEvent arg0) {
            DoljnostDialog d = new DoljnostDialog();
            d.setTitle("Добавление должности");
            d.show();
          }
        });
    button_plus_doljnost.setBounds(359, 159, 41, 23);
    contentPane.add(button_plus_doljnost);

    JButton button_plus_kvalification = new JButton("+");
    button_plus_kvalification.addActionListener(
        new ActionListener() {
          @SuppressWarnings("deprecation")
          public void actionPerformed(ActionEvent arg0) {
            KvalificationDialog d = new KvalificationDialog();
            d.setTitle("Добавление квалификации");
            d.show();
          }
        });
    button_plus_kvalification.setBounds(359, 184, 41, 23);
    contentPane.add(button_plus_kvalification);

    JLabel label =
        new JLabel(
            "\u041F\u043E\u043B\u044F, \u043E\u0442\u043C\u0435\u0447\u0435\u043D\u043D\u044B\u0435 ");
    label.setBounds(60, 264, 122, 14);
    contentPane.add(label);

    JLabel label_3 = new JLabel("*");
    label_3.setForeground(Color.RED);
    label_3.setFont(new Font("Tahoma", Font.BOLD, 11));
    label_3.setBounds(186, 264, 12, 14);
    contentPane.add(label_3);

    JLabel label_4 =
        new JLabel(
            "\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B  \u0434\u043B\u044F \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F!");
    label_4.setBounds(197, 264, 203, 14);
    contentPane.add(label_4);

    JLabel label_5 = new JLabel("*");
    label_5.setForeground(Color.RED);
    label_5.setFont(new Font("Tahoma", Font.BOLD, 11));
    label_5.setBounds(356, 37, 12, 14);
    contentPane.add(label_5);

    JLabel label_1 = new JLabel("*");
    label_1.setForeground(Color.RED);
    label_1.setFont(new Font("Tahoma", Font.BOLD, 11));
    label_1.setBounds(356, 62, 12, 14);
    contentPane.add(label_1);

    comboBox_doljnost.setBounds(167, 159, 186, 20);
    contentPane.add(comboBox_doljnost);

    comboBox_kvalification.setBounds(167, 187, 186, 20);
    contentPane.add(comboBox_kvalification);

    // Actions for button "Добавить"
    button_insert.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (!textField_familiya.getText().equals("") && !textField_imya.getText().equals("")) {
              try {
                Sotrudnik s = new Sotrudnik();
                s.setFamiliya(textField_familiya.getText());
                s.setImya(textField_imya.getText());
                s.setOtchestvo(textField_otchestvo.getText());
                s.setData_priema(Date.valueOf(textField_date.getText()));
                s.setPhone(textField_phone.getText());
                Doljnost d = (Doljnost) comboBox_doljnost.getSelectedItem();
                s.setId_doljnosti(d.getId_doljnosti());
                Kvalification k = (Kvalification) comboBox_kvalification.getSelectedItem();
                s.setId_kvalification(k.getId_kvalification());

                DBClass db = new DBClass();
                db.sotrudnikUpsert(s, "INSERT");
                MyFrame.updateList();
                ZakazDialog.updateSotrudnik();
              } catch (SQLException e) {
                e.printStackTrace();
                JOptionPane.showMessageDialog(panelException, e.getMessage());
              } catch (ClassNotFoundException ee) {
                ee.printStackTrace();
                JOptionPane.showMessageDialog(panelException, ee.getMessage());
              } finally {
                dispose();
              }
            } else JOptionPane.showMessageDialog(null, "Введите обязательные параметры!");
          }
        });

    // Actions for button "Отмена"
    button_cancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            dispose();
          }
        });

    // Actions for button "Сохранить изменения"
    button_update.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (!textField_familiya.getText().equals("")
                && !textField_imya.getText().equals("")
                && !textField_date.getText().equals("")) {
              if (textField_date.getText().length() == 10) {
                try {
                  Integer.parseInt((textField_date.getText().substring(0, 3)));
                  Integer.parseInt((textField_date.getText().substring(5, 6)));
                  Integer.parseInt((textField_date.getText().substring(8, 9)));

                  Sotrudnik s = new Sotrudnik();
                  s.setId_sotrudnika(Integer.parseInt(label_id_hidden.getText()));
                  s.setFamiliya(textField_familiya.getText());
                  s.setImya(textField_imya.getText());
                  s.setOtchestvo(textField_otchestvo.getText());
                  s.setPhone(textField_phone.getText());

                  Doljnost d = (Doljnost) comboBox_doljnost.getSelectedItem();
                  s.setId_doljnosti(d.getId_doljnosti());

                  Kvalification k = (Kvalification) comboBox_kvalification.getSelectedItem();
                  s.setId_kvalification(k.getId_kvalification());

                  DBClass db = new DBClass();
                  db.sotrudnikUpsert(s, "UPDATE");
                  MyFrame.updateList();
                  dispose();
                } catch (NumberFormatException e) {
                  JOptionPane.showMessageDialog(panelException, e.getMessage());
                } catch (SQLException e) {
                  // e.printStackTrace();
                  JOptionPane.showMessageDialog(panelException, e.getMessage());
                } catch (ClassNotFoundException ee) {
                  // ee.printStackTrace();
                  JOptionPane.showMessageDialog(panelException, ee.getMessage());
                }
              } else JOptionPane.showMessageDialog(null, "Введите дату в правильном формате!");
            } else JOptionPane.showMessageDialog(null, "Введите обязательные параметры!");
          }
        });
  }
  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);
  }