/Volumes/GoogleDrive/My Drive/IB CS Resources/Final CS IA/20058_Computer_Science_IA/src/coreGUI/CreatePanel.java

  1 package coreGUI;

  2 

  3 //Imports

  4 import java.io.BufferedReader;

  5 import java.io.FileReader;

  6 import java.io.FileWriter;

  7 import java.io.IOException;

  8 import java.util.ArrayList;

  9 import javax.swing.DefaultCellEditor;

 10 import javax.swing.JComboBox;

 11 import javax.swing.table.TableColumn;

 12 import java.awt.event.WindowEvent;

 13 import javax.swing.JOptionPane;

 14 

 15 /*

 16  * To change this license header, choose License Headers in Project Properties.

 17  * To change this template file, choose Tools | Templates

 18  * and open the template in the editor.

 19  */

 20 

 21 /**

 22  *

 23  * @author 20058

 24  */

 25 public class CreatePanel extends javax.swing.JFrame {

 26     int counter = 0;

 27     String notSet = "Not Set";

 28     

 29     //SetOfQs ArrayList Declaration

 30     private ArrayList<SetOfQs> setOfQsArr = new ArrayList<SetOfQs>();

 31     //private NewClass n;

 32     

 33      

 34     /**

 35      * Creates new form addJFrame

 36      */

 37       

 38     //This method allows window to be individually close

 39     private void systemExit(){

 40         WindowEvent windowCloses = new WindowEvent(this, WindowEvent.WINDOW_CLOSING);

 41          windowCloses.getWindow().hide();

 42     }

 43     

 44     

 45     private void loadSetOfQs(){

 46         try{

 47             FileReader fr = new FileReader("setofqsfile.txt");

 48             BufferedReader br = new BufferedReader(fr);

 49             String line=br.readLine();

 50             while(line!=null){

 51                 String[] arr = line.split(";");

 52                 SetOfQs s = new SetOfQs(arr[0],Integer.parseInt(arr[1]),Integer.parseInt(arr[2]),Double.parseDouble(arr[6]),Double.parseDouble(arr[4]),Double.parseDouble(arr[5]),arr[3]);

 53                 setOfQsArr.add(s);

 54                 line = br.readLine();

 55             }

 56         }catch(IOException ex){

 57             

 58         }

 59     }

 60    

 61     //Put JComboBox into the solutionTable

 62     private void createComboBox() {

 63         int nqs = (Integer)numberOfQsSpinner.getValue();

 64         for (int row = 0;row<nqs;row++){

 65             solutionsTable.setValueAt(row+1, row, 0);

 66             solutionsTable.setValueAt(notSet, row, 1);

 67         }

 68         //The strings reflects the maximum amount of six answer choices

 69         String[] allChoices = new String[]{"A.","B.","C.","D.","E.","F."};

 70         

 71         //nchs to declare a new array that only includes the choices that are needed according to the numberOfChoicesSpinner

 72         int nchs = (Integer)numberOfChoicesSpinner.getValue();

 73         String[] choices = new String[nchs];

 74         for(int i = 0;i<nchs;i++){

 75             choices[i] = allChoices[i];

 76         }

 77         

 78         //The ComboBox appears at the right column of solutionsTable

 79         JComboBox<String> choiceList = new JComboBox<>(choices);

 80         TableColumn c1 = solutionsTable.getColumnModel().getColumn(1);

 81         c1.setCellEditor(new DefaultCellEditor(choiceList));

 82     }

 83     

 84     //Add a new line to setofqsfile.txt with attributes of the newly created set of questions and seperate the attributes by a semicolon

 85     public void saveSetOfQs(){

 86         try{

 87             String setOfQsFile = "setofqsfile.txt";

 88             FileWriter fw = new FileWriter(setOfQsFile);

 89             for(int i=0;i<setOfQsArr.size();i++){

 90                 fw.write(setOfQsArr.get(i).getSetOfQsName());

 91                 fw.write(";");

 92                 fw.write(setOfQsArr.get(i).getNumberOfQ()+"");

 93                 fw.write(";");

 94                 fw.write(setOfQsArr.get(i).getNumberOfChoices()+"");

 95                 fw.write(";");

 96                 fw.write(setOfQsArr.get(i).getNotes());

 97                 fw.write(";");

 98                 fw.write(setOfQsArr.get(i).getCorrectAnswerScore() + "");

 99                 fw.write(";");

100                 fw.write(setOfQsArr.get(i).getIncorrectAnswerDeduction() + "");

101                 fw.write(";");

102                 fw.write(setOfQsArr.get(i).getInitialScore() + "");

103                 if(i!=setOfQsArr.size()-1){

104                     fw.write("\n");

105                 }            

106             }

107             fw.close();          

108         } catch(IOException ex){      

109         }

110     }

111     

112     //Solution .txt file for each set of questions will be the name of each set of questions

113     public void saveAnswers(){

114         try{

115             String answersFile = nameTextField.getText() + ".txt"; 

116             FileWriter fw = new FileWriter(answersFile);

117             //Loop through the solution value of solutionsTable

118              for(int i=0;i<(Integer)numberOfQsSpinner.getValue();i++){

119                 //solutions are all in a single line

120                 fw.write(solutionsTable.getValueAt(i,1) + "");

121                  if(i!=(Integer)numberOfQsSpinner.getValue()-1){

122                  //Seperate each solution by a semicolon

123                  fw.write(";");

124                 }

125              

126              }

127              

128              fw.close();

129         } catch(IOException ex){

130             

131         }

132     }

133     

134  

135     public CreatePanel() {

136         initComponents();

137         loadSetOfQs();

138         addButton.setEnabled(false);

139     }

140     

141     

142     public CreatePanel(ArrayList<SetOfQs> setOfQsArr) {

143         this.setOfQsArr = setOfQsArr;

144         initComponents();

145     }

146 





476 

477     private void descriptionTextFieldActionPerformed(java.awt.event.ActionEvent evt) {                                                     

478         // TODO add your handling code here:

479     }                                                    

480 

481     private void renderButtonActionPerformed(java.awt.event.ActionEvent evt) {                                             

482         // TODO add your handling code here:

483     }                                            

484 

485     private void renderButtonMouseReleased(java.awt.event.MouseEvent evt) {                                           

486         // TODO add your handling code here:

487            for(int num = 0; num < setOfQsArr.size(); num++){

488               if(nameTextField.getText().equals(setOfQsArr.get(num).getSetOfQsName())){

489                   JOptionPane.showMessageDialog(this,"Please choose another name for your set of questions.", "Error", JOptionPane.ERROR_MESSAGE);

490               }

491            }

492         if(nameTextField.getText() == null || nameTextField.getText().equals("")){

493         JOptionPane.showMessageDialog(this,"Please name your set of questions.", "Error", JOptionPane.ERROR_MESSAGE);      

494         } else {

495         createComboBox();

496         nameTextField.setEditable(false);

497         descriptionTextField.setEditable(false);

498         numberOfQsSpinner.setEnabled(false);

499         correctAnswerScoreSpinner.setEnabled(false);

500         wrongAnswerDeductionSpinner.setEnabled(false);

501         numberOfChoicesSpinner.setEnabled(false);

502         initialScoreSpinner.setEnabled(false);

503         addButton.setEnabled(true);

504         renderButton.setEnabled(false);

505         }

506     }                                          

507 

508     private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {                                          

509         // TODO add your handling code here:

510     }                                         

511 

512     private void addButtonMouseReleased(java.awt.event.MouseEvent evt) {                                        

513         // TODO add your handling code here:

514   

515         

516         for(int j = 0;j< (Integer)numberOfQsSpinner.getValue(); j++ ){

517             

518             if(notSet.equals(solutionsTable.getValueAt(j, 1))){

519                 JOptionPane.showMessageDialog(this,"Please fill in the remaing solution(s).", "Error", JOptionPane.ERROR_MESSAGE);

520                 break;

521             } else {

522                 counter++;

523             }

524         }

525                 

526                 if(counter==(Integer)numberOfQsSpinner.getValue()){

527                 setOfQsArr.add(new SetOfQs(nameTextField.getText(), (Integer)numberOfQsSpinner.getValue(),(Integer)numberOfChoicesSpinner.getValue(),

528                         (Double)initialScoreSpinner.getValue(),

529                         (Double)correctAnswerScoreSpinner.getValue(), (Double)wrongAnswerDeductionSpinner.getValue(), descriptionTextField.getText()));

530                 saveSetOfQs();

531                 saveAnswers();

532                 loadSetOfQs();

533                 systemExit();

534                 }

535 

536     }                                       

537 

538     private void nameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {                                              

539         // TODO add your handling code here:

540     }                                             

541 

542     private void discardButtonActionPerformed(java.awt.event.ActionEvent evt) {                                              

543         // TODO add your handling code here:

544     }                                             

545 

546     private void discardButtonMouseReleased(java.awt.event.MouseEvent evt) {                                            

547         // TODO add your handling code here:

548          systemExit();

549     }                                           

550 

551     /**

552      * @param args the command line arguments

553      */

554     public static void main(String args[]) {

555         /* Set the Nimbus look and feel */

556         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

557         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

558          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 

559          */

560         try {

561             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

562                 if ("Nimbus".equals(info.getName())) {

563                     javax.swing.UIManager.setLookAndFeel(info.getClassName());

564                     break;

565                 }

566             }

567         } catch (ClassNotFoundException ex) {

568             java.util.logging.Logger.getLogger(CreatePanel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

569         } catch (InstantiationException ex) {

570             java.util.logging.Logger.getLogger(CreatePanel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

571         } catch (IllegalAccessException ex) {

572             java.util.logging.Logger.getLogger(CreatePanel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

573         } catch (javax.swing.UnsupportedLookAndFeelException ex) {

574             java.util.logging.Logger.getLogger(CreatePanel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

575         }

576         //</editor-fold>

577         //</editor-fold>

578         //</editor-fold>

579         //</editor-fold>

580         //</editor-fold>

581         //</editor-fold>

582         //</editor-fold>

583         //</editor-fold>

584         //</editor-fold>

585         //</editor-fold>

586         //</editor-fold>

587         //</editor-fold>

588         //</editor-fold>

589         //</editor-fold>

590         //</editor-fold>

591         //</editor-fold>

592 

593         /* Create and display the form */

594         java.awt.EventQueue.invokeLater(new Runnable() {

595             public void run() {

596                 new CreatePanel().setVisible(true);

597             }

598         });

599     }

600 

601     

602 /*#######################################################################################################################################

##############################NOTE THAT ALL CODE WHICH IS HIGHLIGHTED BY THE GREY BLOCK IS AUTO-GENERATED FROM################# ##################################NETBEANS, (mainly the GUI stuff)#############################################################################

############################################################################################################################################

############################################################################################################################################

############################################################################################################################################

603 */    

147     /**

148      * This method is called from within the constructor to initialize the form.

149      * WARNING: Do NOT modify this code. The content of this method is always

150      * regenerated by the Form Editor.

151      */

152     @SuppressWarnings("unchecked")

153     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          

154     private void initComponents() {

155 

156         cPanel = new javax.swing.JPanel();

157         nameLabel = new javax.swing.JLabel();

158         nameTextField = new javax.swing.JTextField();

159         numberOfQsLabel = new javax.swing.JLabel();

160         numberOfChoicesLabel = new javax.swing.JLabel();

161         initialScoreLabel = new javax.swing.JLabel();

162         initialScoreSpinner = new javax.swing.JSpinner();

163         correctAnswerScoreLabel = new javax.swing.JLabel();

164         correctAnswerScoreSpinner = new javax.swing.JSpinner();

165         wrongAnswerDeductionLabel = new javax.swing.JLabel();

166         wrongAnswerDeductionSpinner = new javax.swing.JSpinner();

167         numberOfQsSpinner = new javax.swing.JSpinner();

168         addButton = new javax.swing.JButton();

169         renderButton = new javax.swing.JButton();

170         descriptionLabel = new javax.swing.JLabel();

171         descriptionTextField = new javax.swing.JTextField();

172         createScrollPane = new javax.swing.JScrollPane();

173         solutionsTable = new javax.swing.JTable();

174         numberOfChoicesSpinner = new javax.swing.JSpinner();

175         discardButton = new javax.swing.JToggleButton();

176 

177         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

178         setResizable(false);

179 

180         nameLabel.setText("Name");

181 

182         nameTextField.addActionListener(new java.awt.event.ActionListener() {

183             public void actionPerformed(java.awt.event.ActionEvent evt) {

184                 nameTextFieldActionPerformed(evt);

185             }

186         });

187 

188         numberOfQsLabel.setText("Number of Questions");

189 

190         numberOfChoicesLabel.setText("Number of Choices");

191 

192         initialScoreLabel.setText("Initial Score");

193 

194         initialScoreSpinner.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, null, 1.0d));

195 

196         correctAnswerScoreLabel.setText("Correct Answer Score");

197 

198         correctAnswerScoreSpinner.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.0d, null, 1.0d));

199 

200         wrongAnswerDeductionLabel.setText("Answer Deduction");

201 

202         wrongAnswerDeductionSpinner.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, null, 1.0d));

203 

204         numberOfQsSpinner.setModel(new javax.swing.SpinnerNumberModel(1, 1, 100, 1));

205 

206         addButton.setText("Add");

207         addButton.addMouseListener(new java.awt.event.MouseAdapter() {

208             public void mouseReleased(java.awt.event.MouseEvent evt) {

209                 addButtonMouseReleased(evt);

210             }

211         });

212         addButton.addActionListener(new java.awt.event.ActionListener() {

213             public void actionPerformed(java.awt.event.ActionEvent evt) {

214                 addButtonActionPerformed(evt);

215             }

216         });

217 

218         renderButton.setText("Render");

219         renderButton.addMouseListener(new java.awt.event.MouseAdapter() {

220             public void mouseReleased(java.awt.event.MouseEvent evt) {

221                 renderButtonMouseReleased(evt);

222             }

223         });

224         renderButton.addActionListener(new java.awt.event.ActionListener() {

225             public void actionPerformed(java.awt.event.ActionEvent evt) {

226                 renderButtonActionPerformed(evt);

227             }

228         });

229 

230         descriptionLabel.setText("Notes:");

231 

232         descriptionTextField.addActionListener(new java.awt.event.ActionListener() {

233             public void actionPerformed(java.awt.event.ActionEvent evt) {

234                 descriptionTextFieldActionPerformed(evt);

235             }

236         });

237 

238         solutionsTable.setModel(new javax.swing.table.DefaultTableModel(

239             new Object [][] {

240                 {null, null},

241                 {null, null},

242                 {null, null},

243                 {null, null},

244                 {null, null},

245                 {null, null},

246                 {null, null},

247                 {null, null},

248                 {null, null},

249                 {null, null},

250                 {null, null},

251                 {null, null},

252                 {null, null},

253                 {null, null},

254                 {null, null},

255                 {null, null},

256                 {null, null},

257                 {null, null},

258                 {null, null},

259                 {null, null},

260                 {null, null},

261                 {null, null},

262                 {null, null},

263                 {null, null},

264                 {null, null},

265                 {null, null},

266                 {null, null},

267                 {null, null},

268                 {null, null},

269                 {null, null},

270                 {null, null},

271                 {null, null},

272                 {null, null},

273                 {null, null},

274                 {null, null},

275                 {null, null},

276                 {null, null},

277                 {null, null},

278                 {null, null},

279                 {null, null},

280                 {null, null},

281                 {null, null},

282                 {null, null},

283                 {null, null},

284                 {null, null},

285                 {null, null},

286                 {null, null},

287                 {null, null},

288                 {null, null},

289                 {null, null},

290                 {null, null},

291                 {null, null},

292                 {null, null},

293                 {null, null},

294                 {null, null},

295                 {null, null},

296                 {null, null},

297                 {null, null},

298                 {null, null},

299                 {null, null},

300                 {null, null},

301                 {null, null},

302                 {null, null},

303                 {null, null},

304                 {null, null},

305                 {null, null},

306                 {null, null},

307                 {null, null},

308                 {null, null},

309                 {null, null},

310                 {null, null},

311                 {null, null},

312                 {null, null},

313                 {null, null},

314                 {null, null},

315                 {null, null},

316                 {null, null},

317                 {null, null},

318                 {null, null},

319                 {null, null},

320                 {null, null},

321                 {null, null},

322                 {null, null},

323                 {null, null},

324                 {null, null},

325                 {null, null},

326                 {null, null},

327                 {null, null},

328                 {null, null},

329                 {null, null},

330                 {null, null},

331                 {null, null},

332                 {null, null},

333                 {null, null},

334                 {null, null},

335                 {null, null},

336                 {null, null},

337                 {null, null},

338                 {null, null},

339                 {null, null}

340             },

341             new String [] {

342                 "Question ", "Solution"

343             }

344         ) {

345             Class[] types = new Class [] {

346                 java.lang.Integer.class, java.lang.Integer.class

347             };

348 

349             public Class getColumnClass(int columnIndex) {

350                 return types [columnIndex];

351             }

352         });

353         createScrollPane.setViewportView(solutionsTable);

354 

355         numberOfChoicesSpinner.setModel(new javax.swing.SpinnerNumberModel(4, 2, 6, 1));

356 

357         discardButton.setText("Discard");

358         discardButton.addMouseListener(new java.awt.event.MouseAdapter() {

359             public void mouseReleased(java.awt.event.MouseEvent evt) {

360                 discardButtonMouseReleased(evt);

361             }

362         });

363         discardButton.addActionListener(new java.awt.event.ActionListener() {

364             public void actionPerformed(java.awt.event.ActionEvent evt) {

365                 discardButtonActionPerformed(evt);

366             }

367         });

368 

369         javax.swing.GroupLayout cPanelLayout = new javax.swing.GroupLayout(cPanel);

370         cPanel.setLayout(cPanelLayout);

371         cPanelLayout.setHorizontalGroup(

372             cPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

373             .addGroup(cPanelLayout.createSequentialGroup()

374                 .addGap(25, 25, 25)

375                 .addGroup(cPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

376                     .addGroup(cPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

377                         .addGroup(cPanelLayout.createSequentialGroup()

378                             .addGroup(cPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

379                                 .addGroup(cPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

380                                     .addGroup(cPanelLayout.createSequentialGroup()

381                                         .addComponent(numberOfQsLabel)

382                                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))

383                                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, cPanelLayout.createSequentialGroup()

384                                         .addComponent(numberOfChoicesLabel)

385                                         .addGap(39, 39, 39)))

386                                 .addGroup(cPanelLayout.createSequentialGroup()

387                                     .addComponent(correctAnswerScoreLabel)

388                                     .addGap(26, 26, 26)))

389                             .addGroup(cPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

390                                 .addComponent(correctAnswerScoreSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)

391                                 .addGroup(cPanelLayout.createSequentialGroup()

392                                     .addComponent(numberOfQsSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)

393                                     .addGap(26, 26, 26)

394                                     .addComponent(initialScoreLabel))

395                                 .addGroup(cPanelLayout.createSequentialGroup()

396                                     .addComponent(numberOfChoicesSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)

397                                     .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

398                                     .addComponent(wrongAnswerDeductionLabel)))

399                             .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

400                             .addGroup(cPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

401                                 .addComponent(wrongAnswerDeductionSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)

402                                 .addComponent(initialScoreSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)))

403                         .addGroup(cPanelLayout.createSequentialGroup()

404                             .addComponent(nameLabel)

405                             .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

406                             .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 331, javax.swing.GroupLayout.PREFERRED_SIZE)))

407                     .addGroup(cPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

408                         .addComponent(renderButton, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)

409                         .addGroup(cPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

410                             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, cPanelLayout.createSequentialGroup()

411                                 .addComponent(discardButton)

412                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

413                                 .addComponent(addButton))

414                             .addComponent(createScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 373, Short.MAX_VALUE)

415                             .addComponent(descriptionTextField)))

416                     .addComponent(descriptionLabel))

417                 .addGap(0, 0, Short.MAX_VALUE))

418         );

419         cPanelLayout.setVerticalGroup(

420             cPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

421             .addGroup(cPanelLayout.createSequentialGroup()

422                 .addGap(10, 10, 10)

423                 .addGroup(cPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

424                     .addComponent(nameLabel)

425                     .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

426                 .addGap(18, 18, 18)

427                 .addGroup(cPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

428                     .addComponent(numberOfQsLabel)

429                     .addComponent(numberOfQsSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

430                     .addComponent(initialScoreLabel)

431                     .addComponent(initialScoreSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

432                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

433                 .addGroup(cPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

434                     .addComponent(wrongAnswerDeductionSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

435                     .addComponent(wrongAnswerDeductionLabel)

436                     .addComponent(numberOfChoicesLabel)

437                     .addComponent(numberOfChoicesSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

438                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

439                 .addGroup(cPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

440                     .addComponent(correctAnswerScoreSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

441                     .addComponent(correctAnswerScoreLabel))

442                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)

443                 .addComponent(descriptionLabel)

444                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

445                 .addComponent(descriptionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)

446                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

447                 .addComponent(renderButton)

448                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

449                 .addComponent(createScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 187, javax.swing.GroupLayout.PREFERRED_SIZE)

450                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

451                 .addGroup(cPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

452                     .addComponent(addButton)

453                     .addComponent(discardButton))

454                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

455         );

456 

457         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

458         getContentPane().setLayout(layout);

459         layout.setHorizontalGroup(

460             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

461             .addGroup(layout.createSequentialGroup()

462                 .addGap(25, 25, 25)

463                 .addComponent(cPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

464                 .addContainerGap(55, Short.MAX_VALUE))

465         );

466         layout.setVerticalGroup(

467             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

468             .addGroup(layout.createSequentialGroup()

469                 .addContainerGap()

470                 .addComponent(cPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

471                 .addContainerGap())

472         );

473 

474         pack();

475     }// </editor-fold>                        


604     

605     // Variables declaration - do not modify                     

606     private javax.swing.JButton addButton;

607     private javax.swing.JPanel cPanel;

608     private javax.swing.JLabel correctAnswerScoreLabel;

609     private javax.swing.JSpinner correctAnswerScoreSpinner;

610     private javax.swing.JScrollPane createScrollPane;

611     private javax.swing.JLabel descriptionLabel;

612     private javax.swing.JTextField descriptionTextField;

613     private javax.swing.JToggleButton discardButton;

614     private javax.swing.JLabel initialScoreLabel;

615     private javax.swing.JSpinner initialScoreSpinner;

616     private javax.swing.JLabel nameLabel;

617     private javax.swing.JTextField nameTextField;

618     private javax.swing.JLabel numberOfChoicesLabel;

619     private javax.swing.JSpinner numberOfChoicesSpinner;

620     private javax.swing.JLabel numberOfQsLabel;

621     private javax.swing.JSpinner numberOfQsSpinner;

622     private javax.swing.JButton renderButton;

623     private javax.swing.JTable solutionsTable;

624     private javax.swing.JLabel wrongAnswerDeductionLabel;

625     private javax.swing.JSpinner wrongAnswerDeductionSpinner;

626     // End of variables declaration                   

627 

628   

629 }

630