Example #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);
  }
Example #2
0
  public void actionPerformed(ActionEvent e) {
    p2.str1 = fn1.getText();
    p2.str2 = ln1.getText();
    p2.str3 = un1.getText();
    p2.str4 = ps11.getText();
    p2.str5 = eid1.getText();
    p2.str6 = ps21.getText();
    p2.str7 = mb1.getText();
    p2.str8 = cct1.getText();
    p2.str9 = hquali1.getText();
    p2.str10 = dober1.getText();
    p2.str11 = dober2.getText();
    p2.str12 = dober3.getText();
    p2.str13 = p2.str10 + "/" + p2.str11 + "/" + p2.str12;

    boolean bl1, bl2, bl3, bl4, bl5, bl6, bl7, bl8, bl9;
    bl1 = false;
    bl2 = false;
    bl3 = false;
    bl4 = false;
    bl5 = false;
    bl6 = false;
    bl7 = false;
    bl8 = false;

    if (str1.length() > 0) {
      // er1.setForeground(null);
      er1.setText("");
      fn1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl1 = true;
      repaint();
    } else {
      er1.setForeground(Color.red);
      er1.setText("(First name can't be null)");
      fn1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }

    if (str3.length() > 0) {
      er3.setText("");
      un1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl2 = true;
      repaint();

    } else {
      er3.setForeground(Color.red);
      er3.setText("(Username can't be null)");
      un1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }

    if (str5.length() > 0) {
      er6.setText("");
      eid1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl3 = true;
      repaint();

    } else {
      er6.setForeground(Color.red);
      er6.setText("(email id can't be null)");
      eid1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }

    if (str4.length() > 0) {
      er4.setText("");
      ps11.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl4 = true;
      repaint();

    } else {
      er4.setForeground(Color.red);
      er4.setText("(Password can't be null)");
      ps11.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }

    if ((str4.equals(str6))) {
      str6 = str4;
      er5.setForeground(null);
      er5.setText("");
      ps21.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl5 = true;
      repaint();

    } else {
      er5.setForeground(Color.red);
      er5.setText("(both pwd should be same)");
      ps21.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }
    if (str7.length() == 10) {
      er7.setText("");
      mb1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl6 = true;
      repaint();

    } else {
      er7.setForeground(Color.red);
      er7.setText("(number should be of 10 digit)");
      mb1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }
    if (str8.length() > 0) {
      er8.setText("");
      cct1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl7 = true;
      repaint();

    } else {
      er8.setForeground(Color.red);
      er8.setText("(Current City can't be null)");
      cct1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }
    if (str9.length() > 0) {
      er9.setText("");
      hquali1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl8 = true;
      repaint();

    } else {
      er9.setForeground(Color.red);
      er9.setText("(Highest Qualif. can't be null)");
      hquali1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }

    try {
      if ((bl1 && bl2 && bl3 && bl4 && bl5 && bl6 && bl7 && bl8) == true) {
        JOptionPane.showMessageDialog(null, "Data submitting ");
        p2.goer();
      }
    } catch (Exception e3) {
    }
  }