Esempio n. 1
0
  /** Creates new form NewJFrame */
  public GraderUI() {
    initComponents();
    listModel = new DefaultListModel();
    listModel2 = new DefaultListModel();
    listModel3 = new DefaultListModel();
    listModel4 = new DefaultListModel();
    names.add("Kevin Pham");
    names.add("RJ Almada");
    names.add("Alvin Lam");
    names.add("Neil Nordhof");
    names.add("Grant Pickett");
    names.add("Yuliya Levitskaya");
    answers.add(kevinAns);
    answers.add(RJAns);
    answers.add(alvinAns);
    answers.add(neilAns);
    answers.add(grantAns);
    answers.add(yuliyaAns);

    questions.add("True or False: A function cannot be defined inside another function. (2 pts)");
    questions.add("True or False: Functions cannot return more than one value at a time. (2 pts)");
    questions.add(
        "True or False: If return type for a function is not specified, it defaults to int. (2 pts)");
    questions.add("True or False: Functions can be called either by value or reference. (2 pts)");
    questions.add(
        "True or False: A function may have any number of return statements each returning different values. (2 pts)");

    for (int i = 0; i < names.size(); i++) {
      listModel.addElement(names.get(i));
    }
    for (int i = 0; i < 5; i++) {
      listModel2.addElement("Question " + (i + 1));
    }
    listOfNames.setModel(listModel);
    listOfQuestions.setModel(listModel2);
    listOfNames.setSelectedIndex(0);
    listOfQuestions.setSelectedIndex(0);
    setVisible(true);
  }