KBKrause / chemberry

Java program to facilitate classroom experiments using Arduino and Raspberry Pi
0 stars 0 forks source link

Change other InstructorGUI methods to account for new getPanel method #20

Open KBKrause opened 6 years ago

KBKrause commented 6 years ago

desync method needs to use the new method I added called getStudentPanelWithIdentifier.

Also, comment out the other two methods since they are not used.

KBKrause commented 6 years ago

The only other method to do this is during the update to desync.

Check this with 2 different machines to make sure the correct one is being removed each time.

studentTabs.remove(getIndexOfPanelWithIdentifier(tokens[1]));
. . .
private int getIndexOfPanelWithIdentifier(String ident)
    {
        System.out.println("Ident searching for is " + ident);
        int retval = 0;

        for (int i = 0; i < studentTabs.getTabCount(); i++)
        {
            System.out.println("IP of tab at " + i + " : " + ((StudentPanel)studentTabs.getComponentAt(i)).getIP());
            // TODO
            // Eventually, tabs should have names of students.
            // Then the if statement below should become
            if (((StudentPanel)studentTabs.getComponentAt(i)).getIP().equals(ident))
            //if (studentTabs.getTitleAt(i).equals(ident));
            {
                System.out.println("Found a match");
                retval = i;
            }
        }

        System.out.println("Index is " + retval);

        return retval;
    }