首页 > 解决方案 > 通过程序 GUI 中的队列类 (listnode) 通过电子邮件搜索申请人

问题描述

我有一个家庭作业计划,我们在其中添加/编辑/删除/分配已申请 uni/college 的学生以及联系方式和 ucas 积分。他们的联系方式之一涉及他们的电子邮件。

基本上我想通过电子邮件找到我想编辑的申请人。我对列表节点知之甚少,但我认为我做对了,但它不起作用。

我已经尝试过使用 int 搜索方法,它似乎可以正常工作,但是使用字符串时并没有那么多。

这是从AppGUI

if(e.getSource() == btnFind)
        {
            ApplicantQueue editApplicant = new ApplicantQueue();

            String findEmail = txtFind.getText();
            editApplicant.search(findEmail);
            taEditDelteDisplay.setText(editApplicant.display());
    if(editApplicant.getFront().getAppDetails().getEmail() == findEmail)
            {
                JOptionPane.showMessageDialog(null, "NOTICE, \nQualifications & UCAS Points have been cleared!\n you must re-enter this information!",  "INFO", JOptionPane.INFORMATION_MESSAGE);
            }
    if(editApplicant.getFront().getAppDetails().getEmail() == null)
            {
                JOptionPane.showMessageDialog(null, "NONE FOUND, \nEmail not found.",   "ERROR", JOptionPane.ERROR_MESSAGE);
            }

这是来自队列类(listnodes)

public DegreeApp search(String email)
        {
            ListNode current = front;
while(current != null && current.getAppDetails().getEmail().equals(email) != false)
            {
                current = current.getLink();
            }
            if(current != null)
                return current.getAppDetails();
            else
            return null;// dunno about this part so put it to null
        }
        //original int method
        /*public int search(int reqNo)
        {
            int pos = 1;
            ListNode current = front;
            while(current != null && current.getAppDetails().getPriority() != reqNo)
            {
                current = current.getLink();
                pos++;
            }
            if(current != null)
                return pos;
            else
                return -1;
        }*/

当他们通过电子邮件找到合适的申请人时,我希望能够编辑给定的申请人,我已经对该部分进行了完整的编码,因为我希望首先让搜索工作,正如你所看到的,我已经为他们制作了弹出窗口'要么被发现,要么不存在。

标签: javalistswingjtextfield

解决方案


推荐阅读