/* * NewJFrame.java * * Created on October 27, 2007, 7:49 PM */ /** * * @author william */ public class TestEditor extends javax.swing.JFrame { /** Creates new form NewJFrame */ public TestEditor() { initComponents(); } /** This method is called from within the constructor to * initialize the form. */ private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); newTestWizard = new javax.swing.JMenuItem(); jMenuItem2 = new javax.swing.JMenuItem(); jMenuItem3 = new javax.swing.JMenuItem(); jMenuItem4 = new javax.swing.JMenuItem(); print = new javax.swing.JMenuItem("Print..."); jMenu2 = new javax.swing.JMenu(); jMenuItem5 = new javax.swing.JMenuItem(); jMenuItem6 = new javax.swing.JMenuItem(); jMenu4 = new javax.swing.JMenu(); addQuestion = new javax.swing.JMenuItem(); replaceQuestion = new javax.swing.JMenuItem(); removeQuestion = new javax.swing.JMenuItem(); jSeparator2 = new javax.swing.JSeparator(); jMenuItem1 = new javax.swing.JMenuItem(); jMenuItem12 = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE); setTitle("Test Builder"); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { /*{"1", "Can a variable's type be changed?", null, "CSC 101", "True/False", "9", "2", "Easy", "1/1/2001", "Variables", "A. Teacher", "10"}, {"2", "When delcaring a variable, do you give the name first, or the type first?", null, "CSC 101", "Multiple Choice", "9", "1", "Easy", "1/1/2001", "Variables", "A. Teacher", "10"}, {"3", "What is the difference between a while loop and a for loop?", null, "CSC 101", "Short Answer", "9", "3", "Easy", "1/1/2001", "Loops", "A. Teacher", "10"}, {"4", "List two of the integer types in C.", null, "CSC 101", "Short Answer", "9", "2", "Medium", "1/1/2001", "Variables", "A. Teacher", "10"}, {"5", "When does a loop stop repeating?", null, "CSC 101", "Short Answer", "9", "3", "Easy", "1/1/2001", "Loops", "A. Teacher", "10"}, {"6", "Explain the parts of a for loop.", null, "CSC 101", "Short Answer", "9", "3", "Hard", "1/1/2001", "Loops", "A. Teacher", "10"}, {"7", "If nothing is assigned to a variable, what is its value?", null, "CSC 101", "Short Answer", "9", "2", "Easy", "1/1/2001", "Variables", "A. Teacher", "10"}, {"8", "What happens if the conditional expression of a loop is never false?", null, "CSC 101", "Short Answer", "9", "2", "Easy", "1/1/2001", "Loops", "A. Teacher", "10"}, {"9", "When is a for loop useful?", null, "CSC 101", "Short Answer", "9", "3", "Medium", "1/1/2001", "Loops", "A. Teacher", "10"}, {"10", "What happens when a variable is assigned a value that is too large?", null, "CSC 101", "Short Answer", "9", "2", "Medium", "1/1/2001", "Variables", "A. Teacher", "10"}*/ /* {"1", "Create sentience.", null, "CSC 101", "Code", "30", "9", "Hard", "1/1/2001", "AI, Variables", "A. Teacher", "10"}, {"2", "Write a program that proves Fermat's Last Theorem.", null, "CSC 101", "Code", "30", "8", "Hard", "1/1/2001", "Math, Pain, Variables", "A. Teacher", "10"}, {"3", "Which of these is a keyword in C?", null, "CSC 101", "Multiple Choice", "5", "1", "Easy", "1/1/2001", "C, Keywords", "A. Teacher", "10"}, {"4", "Which of these is not a legal variable name in C?", null, "CSC 101", "Multiple Choice", "5", "2", "Medium", "1/1/2001", "Variables", "A. Teacher", "10"}, {"5", "main() takes two arguments, one of type int, and one of type char**.", null, "CSC 101", "True/Flase", "3", "1", "Easy", "1/1/2001", "C, Variables, Functions", "A. Teacher", "10"}, {"6", "int can hold a wider range of values than char.", null, "CSC 101", "True/False", "2", "1", "Easy", "1/1/2001", "Variables", "A. Teacher", "10"}, {"7", "char cannot hold numbers.", null, "CSC 101", "True/False", "2", "2", "Easy", "1/1/2001", "Variables", "A. Teacher", "10"}, {"8", "A variable whose value has not been set is always zero.", null, "CSC 101", "True/False", "3", "2", "Easy", "1/1/2001", "Variables", "A. Teacher", "10"}, {"9", "Why is the halting problem unsolvable?", null, "CSC 101", "Short Answer", "20", "11", "Hard", "1/1/2001", "Pain, Loops", "A. Teacher", "10"}, {"10", "How would you prove the existence of God?", null, "CSC 101", "Short Answer", "20", "11", "Hard", "1/1/2001", "Pain, Variables", "A. Teacher", "10"}*/ {"1", "Create a function that takes an int as a parameter and outputs \"This in in binary is ... in hex is ... and decimal is ...\"", null, "CSC 101", "Code", "5", "1", "Medium", "1/1/2001", "Functions", "A. Teacher", "20"}, {"2", "The order of operations in C is:", null, "CSC 101", "Multiple Choice", "3", "1", "Medium", "1/1/2001", "Operations", "A. Teacher", "20"}, {"3", "In a C program, the first things generally present are a list of ... followed by int main(... argc, ...argv).", null, "CSC 101", "Short Answer", "10", "1", "Easy", "1/1/2001", "Variables", "A. Teacher", "20"}, {"4", "True/False: A program will still compile and run when it contains more than 10 warnings.", null, "CSC 101", "True/False", "20", "1", "Medium", "1/1/2001", "Compiling", "A. Teacher", "20"}, {"5", "Match primitive with size in bytes.", null, "CSC 101", "Short Answer", "15", "1", "Hard", "1/1/2001", "Variables", "A. Teacher", "20"}, }, new String [] { "Number", "Question", "Answer", "Class", "Type", "Length", "Week", "Difficulty", "Last Used", "Keywords", "Author", "Points" } )); jScrollPane1.setViewportView(jTable1); jMenu1.setText("File"); newTestWizard.setText("New..."); newTestWizard.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newTestWizardActionPerformed(evt); } }); jMenu1.add(newTestWizard); jMenuItem2.setText("Open..."); jMenu1.add(jMenuItem2); jMenuItem3.setText("Save"); jMenu1.add(jMenuItem3); jMenuItem4.setText("Save as..."); jMenu1.add(jMenuItem4); jMenu1.add(print); print.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { java.awt.print.PrinterJob.getPrinterJob().printDialog(); } }); jMenuBar1.add(jMenu1); jMenu2.setText("Edit"); jMenuItem5.setText("Undo"); jMenu2.add(jMenuItem5); jMenuItem6.setText("Redo"); jMenu2.add(jMenuItem6); jMenuBar1.add(jMenu2); jMenu4.setText("Question"); addQuestion.setText("Add question..."); jMenu4.add(addQuestion); replaceQuestion.setText("Replace Question..."); replaceQuestion.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { replaceQuestionActionPerformed(evt); } }); jMenu4.add(replaceQuestion); removeQuestion.setText("Remove question"); jMenu4.add(removeQuestion); jMenu4.add(jSeparator2); jMenuItem1.setText("Move up"); jMenu4.add(jMenuItem1); jMenuItem12.setText("Move down"); jMenu4.add(jMenuItem12); jMenuBar1.add(jMenu4); setJMenuBar(jMenuBar1); getContentPane().setLayout(new java.awt.BorderLayout()); getContentPane().add(jScrollPane1); pack(); } private void replaceQuestionActionPerformed(java.awt.event.ActionEvent evt) { javax.swing.JDialog d = new ReplaceQuestionDialog(this, false); d.setVisible(true); } private void newTestWizardActionPerformed(java.awt.event.ActionEvent evt) { javax.swing.JDialog d = new NewTestDialog(this, false); d.setVisible(true); } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new TestEditor().setVisible(true); } }); } private javax.swing.JMenuItem addQuestion; private javax.swing.JMenu jMenu1; private javax.swing.JMenu jMenu2; private javax.swing.JMenu jMenu4; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JMenuItem jMenuItem12; private javax.swing.JMenuItem jMenuItem2; private javax.swing.JMenuItem jMenuItem3; private javax.swing.JMenuItem jMenuItem4; private javax.swing.JMenuItem print; private javax.swing.JMenuItem jMenuItem5; private javax.swing.JMenuItem jMenuItem6; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JSeparator jSeparator2; private javax.swing.JTable jTable1; private javax.swing.JMenuItem newTestWizard; private javax.swing.JMenuItem removeQuestion; private javax.swing.JMenuItem replaceQuestion; }