..HEY GUYZ...Hey guys...I was trying to link the Input applet with the code such that, when the user selects like the "Edit function" it refers back to the input function with the empty spaces to fill the new Student information

//Marcus Student's Database program. Using Linked List.
//The prog. shud display Menu to user and allow user to select any of the operations
//shown

package studentinfo;

import javax.swing.*;
import java.awt.*;




//Student information input Frame

 public class studentinfo extends JFrame {

    public studentinfo()
        {

        setTitle("Student Information Details");
        studID ID  = new JLable("Enter ID:",swingConstant.LEFT);
        FirstN NAME= new JLable("Enter First Name:",swingConstant.LEFT);
        SecondN NAME2 = new JLable("Enter Second Name:",swingConstant.LEFT);
        studCourse COURSE = new JLable("Enter Course:",swingConstant.LEFT);
        studLevel LEVEL = new JLable("Enter Level:",swingConstant.LEFT);

        setSize(450,350);
        setVisible(true);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        pane.setBackground(Color.MAGENTA);



 Container pane = getContentPane();
        pane.setLayout(new GridLayout(4,1));

        pane.add(studID);
        pane.add(FirstN);
        pane.add(LastN);
        pane.add(studCourse);
        pane.add(studLevel);


        }




///////////////////////////////////////////////////

//Menu Display

    public String menu()

     {

            String word = " 1: Add new Student Information\n"
                     + "2: Edit Student Information\n"
                     + "3: Search Student Information\n"
                     + "4: Delete Student Information\n"
                     + "5: Exit\n\n"
                     + "Enter Your Choice Letter: ";
            return word;
     }
//////////////////////////////////////////////////////////////////

public class Main {

    char choice;
    LinkList theList = new LinkList();

    public static void main(String[] args) {
        Main main = new Main();
        main.loop();
    }

//Switch with Loop for handling the Menu

public void loop(){

        char id;
        choice = (JOptionPane.showInputDialog(menu()).charAt(0));

        while (choice != '5') 
    {

     switch (choice) 

    {
                case '1':
                    theList.insertFirst();
                    break;
                case '2':
                    id = Integer.parseInt(JOptionPane.showInputDialog(""
                            + "Enter Student ID to Edit"));
                    theList.edit(id);
                    break;
                case '3':
                    id = Integer.parseInt(JOptionPane.showInputDialog(""
                            + "Enter Student ID "));
                    theList.search(id);
                    break;
                case '4':
                    id = Integer.parseInt(JOptionPane.showInputDialog(""
                            + "Enter Student ID to be deleted"));
                    theList.searchAndDelete(id);
                    break;

                default:
                    JOptionPane.showMessageDialog(null, "Option Not Available.Please Enter Valid Option",
                            "Sorry!",JOPtionPane.ERROR_MESSAGE);
                    break;
        }
     }
  }
////////////////////////////////////////////////////////////////////////////////////


class Linking
    {

            public int studID;
        public String FirstN;
        public String LastN;
            public String studcourse;
            public int studLevel;
        public Link next;

    }

//public Link(int studID, String FirstN, String LastN, String studCourse,
           // int studLevel) 
        {
            this.studID = studID;
            this.FirstN = FirstN;
            this.LastN = LastN;
            this.studCourse = studCourse;
            this.studLevel = studLevel;
        }


//////////////////////////////////////////////////////////////////////////////////

//Dislay function

public void displayOutput()
    {
        JOptionPane.showMessageDialog(null, 
          "Student ID : " + studID + "\n"
                + "First Name : " + FirstN + "\n"
                + "Last Name  : " + LastN + "\n"
                + "Level      : " + studLevel);     
    }
}
////////////////////////////////////////////////////////////////////////////

//Creating List

class LinkList 
{

    private Scanner myScanner = new Scanner(System.in);
    private Link first;

      public LinkList() 
    {
            first = null;
        }


      public boolean isEmpty()    
    {
            return (first == null);
        }


    //Search function

      public void search(int id) 
    {
            Link current = first;

            if (isEmpty()) {
            JOptionPane.showMessageDialog(null, "Student Doesn't Exist!","Sorry!",
                        JOptionPane.INFORMATION_MESSAGE);
        } 
    else 
    {
           while (current.studID != id && current.next != null) {
                current = current.next;
            }


            if (current.studID == id) {
                current.displayOutput();
            } 
            else {
                    JOptionPane.showMessageDialog(null, id + " ID Not Found","Sorry!",
                                                        JOptionpPane.INFORMATION_MESSAGE);
                 }
        }
    }       
////////////////////////////////////////////////////////////////////////////////////////


//Insert student info function

public void insertFirst() 
{



    int studID, studLevel;
        String FirstN, LastN, studCourse;

    //  public studentinfo(int studID, String FirstN, String LastN, String studCourse,
      //      int studLevel)

    //***********I need to call the Input Window..How???

        Link newLink = new Link(id, FirstN, LastN, studCourse, studLevel);

        if (isEmpty()) {
            first = newLink;
        } else {
            Link current = first;


            while (current.next != null) {
                current = current.next;
            }

            newLink.next = null;
            current.next = newLink;


        }
        JOptionPane.showMessageDialog(null, "Student Details Added "
                + "successfully\n");
    }

////////////////////////////////////////////////////////////////////////////////////

//Delete function

    public void searchAndDelete(int id) 
{

     if (isEmpty()) 
    {
            JOptionPane.showMessageDialog(null, "Students Record Doesnt Exist","Sorry!",
                            JOptionPane.INFORMATION_MESSAGE);
        } 
    else 
    {
            Link current = first, previous = null;
            while (current.studID != id && current.next != null) {
                previous = current;
                current = current.next;
        }
        if (current.studID == id) {
                previous.next = current.next;

               JOptionPane.showMessageDialog(null, "Student Successfully"
                        + "Deleted",JOptionPane.INFORMATION_MESSAGE);
            } 
            else 
        {
               JOptionPane.showMessageDialog(null, id + " Not found!","Sorry",
                        JOptionPane.INFORMATION_MESSAGE);
            }
        }
    }

////////////////////////////////////////////////////////////////////////////////////////////


// Edit function

public void edit(int id) 
    {

        Link current = first;
        while (current.studID != id && current.next != null) 
    {
            current = current.next;
        }

        if (current.studID == id) 
    {
            String FirstN, LastN, studCourse;
            int studLevel;

            //I need to call the Input Window...how??

            current.studCourse = studCourse;
            current.FirstN = FirstN;
            current.LastN = LastN;
        current.studLevel = studLevel;

            JOptionPane.showMessageDialog(null, "Student Successfully Edited ",
                        JOptionPane.INFORMATION_MESSAGE);
        }
    }

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Please edit your code and surround it with code tags. Or post it again in code tags.
Code tags given by upper right icon.

BTW your code is an application not an Applet.

This article has been dead for over six months. Start a new discussion instead.