//Now bare with me, I'm not the best coder. What I'm trying to do in my coding is create a JOptionPane web. That is what I'm having trouble with, my menus don't quite work right yet. If you could help me or //lead me in the right direction, it would be very much appreciated.
import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import javax.swing.JOptionPane; import java.lang.NumberFormatException; import java.util.LinkedList; public class StudentTester { public static void main(String[] args) throws FileNotFoundException, NumberFormatException { //for (;;) { Scanner in = new Scanner(System.in); JOptionPane mainmenu = new JOptionPane(); //Scanner input = new Scanner(System.in); LinkedList<Student> students = new LinkedList<Student>(); boolean isTrue = false; while (isTrue == false) { int num = 0; while (num != 6) { int input1 = Integer.parseInt(mainmenu.showInputDialog(null,"1 Please type the path to the .txt you wish to import\n2 How would you like to search for your record?\n3 Insert the Students Name\n4 Remove a Student\n5 How would you like to order your report?\n6 View the updated records\n7 Exit\n")); num = input1; if(num == 1){ JOptionPane importFile = new JOptionPane(); Scanner filein= new Scanner(System.in); importFile.showInputDialog(null,"Input File: "); String inputFileName = filein.next(); System.out.println("Hi"); File inputFile = new File(inputFileName); Scanner infile = new Scanner(inputFile); while (infile.hasNext()) { students.add(new Student(infile.nextInt(), infile.next(), infile .nextDouble())); infile.close(); } } else if (num == 2){ int num1 = 0; JOptionPane searchType = new JOptionPane(); while (num1 != 4) { int input2 = Integer.parseInt(searchType.showInputDialog(null,"1 Name\n2 ID\n3 GPA\n4 Back\n")); num1 = input2; if (num1== 1){ JOptionPane lastName = new JOptionPane();// student's // name // search lastName.showInputDialog(null, "Student Name: "); String name = ""; boolean found = false; for (Student s : students) { if (s.getLastName().equals(lastName)) found = true; } if (found) JOptionPane.showMessageDialog(null,"A student was found"); else JOptionPane.showMessageDialog(null,"A student was not found"); } else if (num1==2){ JOptionPane sID = new JOptionPane();// student's ID // search sID.showInputDialog(null, "ID"); int id = Integer.parseInt(JOptionPane.showInputDialog(null, "What in the ID of the Student you are looking for?")); String result = ""; for (Student s : students) { if (s.getId() == id) { result += s; } } } else if (num1==3){ JOptionPane sGPA = new JOptionPane();// students" // GPA // search sGPA.showInputDialog(null, "GPA"); } else if (num1==4){ JOptionPane sMes = new JOptionPane();// back send // back to } // main menu else{ JOptionPane.showMessageDialog(null, "Invalid Choice"); } } } else if (num == 3){ String fullName = ""; String number11 = ""; String number22 = ""; int number1 = 0; double number2 = 0; JOptionPane addStudent = new JOptionPane(); fullName = addStudent.showInputDialog(null, "Name: "); number11 = addStudent.showInputDialog(null, "ID: "); number22 = addStudent.showInputDialog(null, "GPA: "); number1 = Integer.parseInt(number11); number2 = Double.parseDouble(number22); } else if (num == 4){ JOptionPane rStudent = new JOptionPane(); rStudent.showInputDialog(null, "Name"); students.remove(""); } else if (num == 5){ String output = ""; JOptionPane outReport = new JOptionPane(); //output = outReport.showInputDialog("Enter output name"); //PrintWriter out = new PrintWriter(output); } else if (num == 6){ JOptionPane vRoster = new JOptionPane(); vRoster.showMessageDialog(null, students); } else if (num == 7){ JOptionPane mesDefault = new JOptionPane(); mesDefault.showMessageDialog(null, "Exited"); System.exit(0); } else{ JOptionPane.showMessageDialog(null, "Invalid Choice"); } } } } }