Exemple #1
0
  //    int frame = 0;
  public void paint(Graphics g) {
    // System.out.println("frame: " + (frame++));
    lStatus.setText(
        "t = "
            + df.format(md.dt * md.step)
            + ", "
            + "N = "
            + md.N
            + ", "
            + "E/N = "
            + df.format(md.E / md.N)
            + ", "
            + "U/N = "
            + df.format(md.U / md.N)
            + ", "
            + "K/N = "
            + df.format(md.K / md.N)
            + ", "
            + "p = "
            + df.format(md.p)
            + ";");
    tAvK.setText(df.format(md.avK.getAve() / md.N) + "  ");
    tAvU.setText(df.format(md.avU.getAve() / md.N) + "  ");
    tTemp.setText(df.format((2 * md.K) / (3 * (md.N - 1))) + "  ");
    tAvp.setText(df.format(md.avp.getAve()) + "  ");
    canvas.refresh(md.getXWrap(), md.N, true, false);
    cpnl.repaint();
    spnl.repaint();

    try {

      PrintWriter wavefunc =
          new PrintWriter(new FileOutputStream(new File("energyData.txt"), true));
      wavefunc.print(md.E / md.N + " " + md.K / md.N + " " + md.U / md.N);
      wavefunc.println();
      wavefunc.close();
    } catch (IOException ex) {
    }

    try {

      PrintWriter tempwriter =
          new PrintWriter(new FileOutputStream(new File("tempData.txt"), true));
      tempwriter.print(df.format((2 * md.K) / (3 * (md.N - 1))));
      tempwriter.println();
      tempwriter.close();
    } catch (IOException ex) {
    }
  }
 public void setTextFieldText() {
   if (ifOp) {
     ifOp = false;
     txt.setText("");
     setTextFieldText_Temp();
   } else {
     setTextFieldText_Temp();
   }
 }
 public void setTextFieldText_Temp() {
   if (txt.getText().length() < 15 && (txt.getText().indexOf(".") == -1 || !s.equals("."))) {
     txt.setText(txt.getText() + s);
   } else {
     txt.setText((txt.getText() + s).substring(0, 15));
   }
 }
  public void init() {
    d = getSize();
    resize(d.width, d.height);
    GridBagLayout g = new GridBagLayout();
    setLayout(g);
    GridBagConstraints gC = new GridBagConstraints();

    // first row
    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 0, 10, 0);
    gC.gridy = 0;
    gC.gridwidth = 5;
    gC.fill = GridBagConstraints.BOTH;
    txt = new JTextField();
    txt.setHorizontalAlignment(JTextField.RIGHT);
    txt.setEditable(false);
    g.setConstraints(txt, gC);
    add(txt);

    // second row
    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 0, 5, 0);
    gC.gridy = 1;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b7 = new JButton("7");
    b7.setForeground(Color.BLACK);
    b7.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b7, gC);
    add(b7);

    gC = new GridBagConstraints();
    gC.fill = GridBagConstraints.HORIZONTAL;
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 1;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b8 = new JButton("8");
    b8.setForeground(Color.BLACK);
    b8.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b8, gC);
    add(b8);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 1;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b9 = new JButton("9");
    b9.setForeground(Color.BLACK);
    b9.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b9, gC);
    add(b9);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 1;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    bAdd = new JButton("+");
    bAdd.setForeground(Color.BLUE);
    bAdd.addActionListener(new setOperator_ActionListener());
    g.setConstraints(bAdd, gC);
    add(bAdd);

    // third row
    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 0, 5, 0);
    gC.gridy = 2;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b4 = new JButton("4");
    b4.setForeground(Color.BLACK);
    b4.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b4, gC);
    add(b4);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 2;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b5 = new JButton("5");
    b5.setForeground(Color.BLACK);
    b5.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b5, gC);
    add(b5);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 2;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b6 = new JButton("6");
    b6.setForeground(Color.BLACK);
    b6.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b6, gC);
    add(b6);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 2;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    bDec = new JButton("-");
    bDec.setForeground(Color.BLUE);
    bDec.addActionListener(new setOperator_ActionListener());
    g.setConstraints(bDec, gC);
    add(bDec);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 1;
    gC.gridwidth = 1;
    gC.gridheight = 2;
    gC.fill = GridBagConstraints.BOTH;
    bC = new JButton("C");
    bC.setForeground(Color.RED);
    bC.addActionListener(new setOperator_ActionListener());
    g.setConstraints(bC, gC);
    add(bC);

    // fourth row
    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 0, 5, 0);
    gC.gridy = 3;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b1 = new JButton("1");
    b1.setForeground(Color.BLACK);
    b1.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b1, gC);
    add(b1);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 3;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b2 = new JButton("2");
    b2.setForeground(Color.BLACK);
    b2.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b2, gC);
    add(b2);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 3;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    b3 = new JButton("3");
    b3.setForeground(Color.BLACK);
    b3.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b3, gC);
    add(b3);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 3;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    bMul = new JButton("*");
    bMul.setForeground(Color.BLUE);
    bMul.addActionListener(new setOperator_ActionListener());
    g.setConstraints(bMul, gC);
    add(bMul);

    // fifth row
    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 0, 5, 0);
    gC.gridy = 4;
    gC.gridwidth = 2;
    gC.fill = GridBagConstraints.BOTH;
    b0 = new JButton("0");
    b0.setForeground(Color.BLACK);
    b0.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(b0, gC);
    add(b0);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 4;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    bPoint = new JButton(".");
    bPoint.setForeground(Color.BLACK);
    bPoint.addActionListener(new setLabelText_ActionListener());
    g.setConstraints(bPoint, gC);
    add(bPoint);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 4;
    gC.gridwidth = 1;
    gC.fill = GridBagConstraints.BOTH;
    bDiv = new JButton("/");
    bDiv.setForeground(Color.BLUE);
    bDiv.addActionListener(new setOperator_ActionListener());
    g.setConstraints(bDiv, gC);
    add(bDiv);

    gC = new GridBagConstraints();
    gC.insets = new Insets(0, 5, 5, 0);
    gC.gridy = 3;
    gC.gridwidth = 1;
    gC.gridheight = 2;
    gC.fill = GridBagConstraints.BOTH;
    bCal = new JButton("=");
    bCal.addActionListener(new setOperator_ActionListener());
    bCal.setForeground(Color.RED);
    g.setConstraints(bCal, gC);
    add(bCal);
  }
Exemple #5
0
  public LJ3MDApp() {
    tNum.setHorizontalAlignment(JTextField.CENTER);
    tTemp.setHorizontalAlignment(JTextField.CENTER);
    tRho.setHorizontalAlignment(JTextField.CENTER);
    tSpeed.setHorizontalAlignment(JTextField.CENTER);

    tAvK.setHorizontalAlignment(JTextField.RIGHT);
    tAvU.setHorizontalAlignment(JTextField.RIGHT);
    tAvp.setHorizontalAlignment(JTextField.RIGHT);

    float[] aveKing = new float[501];
    float[] avePot = new float[501];
    float[] aveEn = new float[501];

    JFrame box = new JFrame();
    box.setLayout(new BorderLayout());
    box.setSize(1000, 1000);
    box.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    cpnl = new JPanel(); // create a panel for controls
    cpnl.setLayout(new GridLayout(18, 2));
    box.add(cpnl, BorderLayout.EAST);

    // add controls
    cpnl.add(bStart);
    bStart.addActionListener(this);

    cpnl.add(bReset);
    bReset.addActionListener(this);

    cpnl.add(new JLabel(" N:"));
    tNum.addActionListener(this);
    cpnl.add(tNum);

    cpnl.add(new JLabel(" Density (\u03c1):"));
    tRho.addActionListener(this);
    cpnl.add(tRho);

    cpnl.add(new JLabel(" Steps/frame:"));
    tSpeed.addActionListener(this);
    cpnl.add(tSpeed);

    cpnl.add(bTstat);
    bTstat.addActionListener(this);

    cpnl.add(bPot);
    bPot.addActionListener(this);

    cpnl.add(new JLabel(" < K/N > :"));
    tAvK.setEditable(false);
    cpnl.add(tAvK);

    cpnl.add(new JLabel(" Temperature:"));
    tTemp.setEditable(false);
    cpnl.add(tTemp);

    cpnl.add(new JLabel(" < U/N > :"));
    tAvU.setEditable(false);
    cpnl.add(tAvU);

    cpnl.add(new JLabel(" < pressure > :"));
    tAvp.setEditable(false);
    cpnl.add(tAvp);

    cpnl.add(bRetime);
    bRetime.addActionListener(this);

    spnl = new JPanel(); // create a panel for status
    box.add(spnl, BorderLayout.SOUTH);
    lStatus.setFont(new Font("Courier", 0, 12));
    spnl.add(lStatus);

    canvas = new XYZCanvas();
    box.add(canvas, BorderLayout.CENTER);

    timer = new Timer(delay, this);
    timer.start();
    //        timer.stop();
    box.setVisible(true);
  }
Exemple #6
0
  public void actionPerformed(ActionEvent e) {
    Object src = e.getSource();
    if (src == timer) {
      for (int i = 0; i < speed; i++) // integrate a few steps
      md.vv();
      repaint();
      return;
    }

    boolean adjCanvasScale = false;

    if (src == bTstat) md.thermostat = !md.thermostat;

    if (src == bPot) {
      md.ljPotential = !md.ljPotential;
      md.clearData();

      if (timer.isRunning()) timer.stop();
      bStart.setSelected(false);
      bStart.setText("Start");
      md.init(md.rho);
    }

    if (src == tTemp || src == bReset) {
      double kT = Double.parseDouble(tTemp.getText().trim());
      if (kT < 1e-8) {
        kT = 1e-8;
        tTemp.setText("  " + kT);
      }
      md.kT = kT;
      md.clearData();
    }

    if (src == tRho || src == bReset) {
      double rho = Double.parseDouble(tRho.getText().trim());
      if (rho < 1e-3) {
        rho = 1e-3;
        tRho.setText("   " + rho);
      }
      if (rho > 1.2) {
        rho = 1.2;
        tRho.setText("   " + rho);
      }
      md.setDensity(rho);
      md.clearData();
      adjCanvasScale = true;
    }

    if (src == tSpeed || src == bReset) {
      speed = Integer.parseInt(tSpeed.getText().trim());
      if (speed < 1) {
        speed = 1;
        tSpeed.setText("   " + speed);
      }
    }

    if (src == bRetime) md.clearData();

    if (src == bStart) {
      boolean on = bStart.isSelected();
      if (on) {
        timer.restart();
        bStart.setText("Pause");
      } else {
        timer.stop();
        bStart.setText("Resume");
      }
    }

    if (src == tNum) {
      int n = Integer.parseInt(tNum.getText().trim());
      if (n < 2) {
        n = 2;
        tNum.setText(" " + n);
      }
      md.N = n;
      md.init(md.rho);
      adjCanvasScale = true;
    }

    if (src == bReset) {
      if (timer.isRunning()) timer.stop();
      bStart.setSelected(false);
      bStart.setText("Start");
      md.init(md.rho);
    }

    canvas.refresh(md.getXWrap(), md.N, true, adjCanvasScale);

    repaint();
  }
  public void actionPerformed(ActionEvent e) {
    String a, b, c, f, g, h, j, k, l, m, n, o, p, tol = "";

    try {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      con = DriverManager.getConnection("jdbc:odbc:db2");
      stm = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
    } catch (Exception error) {
      System.out.println(error);
    }

    if (e.getSource() == student) {
      name = "Student";
      cl.show(pnc, "cstu");
      try {
        rs = stm.executeQuery("Select * from Student");
        rs.next();
        t1.setText(rs.getString(1));
        t2.setText(rs.getString(2));
        t3.setText(rs.getString(3));
        t4.setText(rs.getString(4));
        t5.setText(rs.getString(5));
        t6.setText(rs.getString(6));
      } catch (Exception error) {
        System.out.println(error);
      }
    }

    if (e.getSource() == teacher) {
      name = "Teacher";
      cl.show(pnc, "ctea");
      try {
        rs = stm.executeQuery("Select * from Teacher");
        rs.next();
        t11.setText(rs.getString(1));
        t12.setText(rs.getString(2));
        t13.setText(rs.getString(3));
        t14.setText(rs.getString(4));
      } catch (Exception error) {
        System.out.println(error);
      }
    }

    if (e.getSource() == course) {
      name = "Course";
      cl.show(pnc, "ccou");
      try {
        rs = stm.executeQuery("Select * from Course");
        rs.next();
        t7.setText(rs.getString(1));
        t8.setText(rs.getString(2));
        t9.setText(rs.getString(3));
        t0.setText(rs.getString(4));
      } catch (Exception error) {
        System.out.println(error);
      }
    }

    if (e.getSource() == result) {
      name = "Result";
      cl.show(pnc, "cres");
      try {
        rs = stm.executeQuery("Select * from Result");
        rs.next();
        t15.setText(rs.getString(1));
        t16.setText(rs.getString(2));
        t17.setText(rs.getString(3));
        t18.setText(rs.getString(4));
        t19.setText(rs.getString(5));
        t20.setText(rs.getString(6));
        t21.setText(rs.getString(7));
        t22.setText(rs.getString(8));
        t23.setText(rs.getString(9));
        t24.setText(rs.getString(10));
        t25.setText(rs.getString(11));
        t26.setText(rs.getString(12));
        t27.setText(rs.getString(13));
      } catch (Exception error) {
        System.out.println(error);
      }
    }

    if (e.getSource() == b6) {
      Vector cols = new Vector();
      Vector rows = new Vector();

      if (z == 1) {
        String sql = "Select * from " + co;
        try {
          rs = stm.executeQuery(sql);
          meta = rs.getMetaData();
          for (int i = 1; i <= meta.getColumnCount(); i++) cols.addElement(meta.getColumnName(i));
          while (rs.next()) {
            Vector currow = new Vector();
            for (int i = 1; i <= meta.getColumnCount(); i++) currow.addElement(rs.getString(i));
            rows.addElement(currow);
          }
        } catch (Exception ex) {
          System.out.print(ex);
        }
        tb = new JTable(rows, cols);
        js = new JScrollPane(tb);
        pne2.remove(js);
        pne2.add(blk, "bb");
        cl2.show(pne2, "bb");
        pne2.add(js, "jjs");
        cl2.show(pne2, "jjs");
        pne2.remove(blk);
        z = 0;
      }
    }

    if (e.getSource() == b1) // **** ADD BUTTON ****//
    {
      if (name == "Student") {
        a = t1.getText();
        b = t2.getText();
        c = t3.getText();
        f = t4.getText();
        g = t5.getText();
        h = t6.getText();

        tol =
            "Insert into Student values ('"
                + a
                + "','"
                + b
                + "','"
                + c
                + "','"
                + f
                + "','"
                + g
                + "','"
                + h
                + "')";
      }

      if (name == "Teacher") {
        a = t11.getText();
        b = t12.getText();
        c = t13.getText();
        f = t14.getText();

        tol = "Insert into Teacher values ('" + a + "','" + b + "','" + c + "','" + f + "')";
      }

      if (name == "Course") {
        a = t7.getText();
        b = t8.getText();
        c = t9.getText();
        f = t0.getText();

        tol = "Insert into Course values ('" + a + "','" + b + "','" + c + "','" + f + "')";
      }

      if (name == "Result") {
        a = t15.getText();
        b = t16.getText();
        c = t17.getText();
        f = t18.getText();
        g = t19.getText();
        h = t20.getText();
        j = t21.getText();
        k = t22.getText();
        l = t23.getText();
        m = t24.getText();
        n = t25.getText();
        o = t26.getText();
        p = t27.getText();

        tol =
            "Insert into Result values ('"
                + a
                + "','"
                + b
                + "','"
                + c
                + "','"
                + f
                + "','"
                + g
                + "','"
                + h
                + "','"
                + j
                + "','"
                + k
                + "','"
                + l
                + "','"
                + m
                + "','"
                + n
                + "','"
                + o
                + "','"
                + p
                + "')";
      }
      try {
        stm.executeUpdate(tol);
      } catch (Exception error) {
        System.out.println(error);
      }
    }

    if (e.getSource() == b2) // **** DELETE BUTTON ****//
    {
      if (name == "Student") {
        b = t2.getText();
        tol = "Delete from Student where Id = '" + b + "'";
      }

      if (name == "Teacher") {
        b = t12.getText();
        tol = "Delete from Teacher where Id = '" + b + "'";
      }

      if (name == "Course") {
        b = t8.getText();
        tol = "Delete from Course where Id = '" + b + "'";
      }

      if (name == "Result") {
        b = t16.getText();
        tol = "Delete from Result where Code = '" + b + "'";
      }
      try {
        stm.executeUpdate(tol);
      } catch (Exception error) {
        System.out.println(error);
      }
    }

    if (e.getSource() == b3) // **** UPDATE BUTTON ****//
    {
      if (name == "Student") {
        a = t1.getText();
        b = t2.getText();
        c = t3.getText();
        f = t4.getText();
        g = t5.getText();
        h = t6.getText();

        tol =
            "Update Student set Name = '"
                + a
                + "', ID = '"
                + b
                + "', Dept = '"
                + c
                + "', CGPA = '"
                + f
                + "', Address = '"
                + g
                + "', Cell = '"
                + h
                + "' where ID = '"
                + b
                + "'";
      }

      if (name == "Teacher") {
        a = t11.getText();
        b = t12.getText();
        c = t13.getText();
        f = t14.getText();

        tol =
            "Update Teacher set Name = '"
                + a
                + "', ID = '"
                + b
                + "', Dept = '"
                + c
                + "', Course = '"
                + f
                + "' where ID = '"
                + b
                + "'";
      }

      if (name == "Course") {
        a = t7.getText();
        b = t8.getText();
        c = t9.getText();
        f = t0.getText();

        tol =
            "Update Course set Name = '"
                + a
                + "', Code = '"
                + b
                + "', Credit = '"
                + c
                + "', Prerecusite = '"
                + f
                + "' where Code = '"
                + b
                + "'";
      }

      if (name == "Result") {
        a = t15.getText();
        b = t16.getText();
        c = t17.getText();
        f = t18.getText();
        g = t19.getText();
        h = t20.getText();
        j = t21.getText();
        k = t22.getText();
        l = t23.getText();
        m = t24.getText();
        n = t25.getText();
        o = t26.getText();
        p = t27.getText();

        tol =
            "Update Result set Course = '"
                + a
                + "', Code = '"
                + b
                + "', Credit = '"
                + c
                + "', A = '"
                + f
                + "', B+ = '"
                + g
                + "', B = '"
                + h
                + "', C+ = '"
                + j
                + "', C = '"
                + k
                + "', D+ = '"
                + l
                + "', D = '"
                + m
                + "', F = '"
                + n
                + "', I = '"
                + o
                + "', W = '"
                + p
                + "' where Code = '"
                + b
                + "'";
        // JOptionPane.showMessageDialog(null,tol,null,JOptionPane.PLAIN_MESSAGE);
        // tol = "Update Result set Course = '"+a+"', Code = '"+b+"', Credit = '"+c+"' where Code =
        // '"+b+"'";
      }
      try {
        stm.executeUpdate(tol);
      } catch (Exception error) {
        System.out.println(error);
      }
    }

    if (e.getSource() == b4) // **** NEXT BUTTON ****//
    {
      if (name == "Student") {
        try {
          if (rs.next()) {
            t1.setText(rs.getString(1));
            t2.setText(rs.getString(2));
            t3.setText(rs.getString(3));
            t4.setText(rs.getString(4));
            t5.setText(rs.getString(5));
            t6.setText(rs.getString(6));
          }
        } catch (Exception error) {
          System.out.println(error);
        }
      }

      if (name == "Teacher") {
        try {
          if (rs.next()) {
            t11.setText(rs.getString(1));
            t12.setText(rs.getString(2));
            t13.setText(rs.getString(3));
            t14.setText(rs.getString(4));
          }
        } catch (Exception error) {
          System.out.println(error);
        }
      }

      if (name == "Course") {
        try {
          if (rs.next()) {
            t7.setText(rs.getString(1));
            t8.setText(rs.getString(2));
            t9.setText(rs.getString(3));
            t0.setText(rs.getString(4));
          }
        } catch (Exception error) {
          System.out.println(error);
        }
      }

      if (name == "Result") {
        try {
          if (rs.next()) {
            t15.setText(rs.getString(1));
            t16.setText(rs.getString(2));
            t17.setText(rs.getString(3));
            t18.setText(rs.getString(4));
            t19.setText(rs.getString(5));
            t20.setText(rs.getString(6));
            t21.setText(rs.getString(7));
            t22.setText(rs.getString(8));
            t23.setText(rs.getString(9));
            t24.setText(rs.getString(10));
            t25.setText(rs.getString(11));
            t26.setText(rs.getString(12));
            t27.setText(rs.getString(13));
          }
        } catch (Exception error) {
          System.out.println(error);
        }
      }
    }

    if (e.getSource() == b5) // **** PREVIOUS BUTTON ****//
    {
      if (name == "Student") {
        try {
          if (rs.previous()) {
            t1.setText(rs.getString(1));
            t2.setText(rs.getString(2));
            t3.setText(rs.getString(3));
            t4.setText(rs.getString(4));
            t5.setText(rs.getString(5));
            t6.setText(rs.getString(6));
          }
        } catch (Exception error) {
          System.out.println(error);
        }
      }

      if (name == "Teacher") {
        try {
          if (rs.previous()) {
            t11.setText(rs.getString(1));
            t12.setText(rs.getString(2));
            t13.setText(rs.getString(3));
            t14.setText(rs.getString(4));
          }
        } catch (Exception error) {
          System.out.println(error);
        }
      }

      if (name == "Course") {
        try {
          if (rs.previous()) {
            t7.setText(rs.getString(1));
            t8.setText(rs.getString(2));
            t9.setText(rs.getString(3));
            t0.setText(rs.getString(4));
          }
        } catch (Exception error) {
          System.out.println(error);
        }
      }

      if (name == "Result") {
        try {
          if (rs.previous()) {
            t15.setText(rs.getString(1));
            t16.setText(rs.getString(2));
            t17.setText(rs.getString(3));
            t18.setText(rs.getString(4));
            t19.setText(rs.getString(5));
            t20.setText(rs.getString(6));
            t21.setText(rs.getString(7));
            t22.setText(rs.getString(8));
            t23.setText(rs.getString(9));
            t24.setText(rs.getString(10));
            t25.setText(rs.getString(11));
            t26.setText(rs.getString(12));
            t27.setText(rs.getString(13));
          }
        } catch (Exception error) {
          System.out.println(error);
        }
      }
    }
  }