Changeset 2328
- Timestamp:
- 10/11/07 21:28:09 (11 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Trunk/SpeechSubmission/VFSpeechSubmission/java/src/speechrecorder/CapturePlayback.java
r2327 r2328 65 65 import speechrecorder.License; 66 66 import speechrecorder.Prompts; 67 import java.util.regex.Matcher; 68 import java.util.regex.Pattern; 67 69 // !!!!!! 68 70 … … 266 268 267 269 public static final String pleaseSelect = "Please Select"; 270 public static final String notApplicable = "unknown"; 268 271 269 272 JComboBox ageRangeChooser; … … 271 274 public static final String adult = "Adult"; 272 275 public static final String senior = "Senior"; 273 String ageRange = adult;276 String ageRange = notApplicable; 274 277 275 278 JComboBox genderChooser; 276 279 public static final String male = "Male"; 277 280 public static final String female = "Female"; 278 String gender = male;281 String gender = notApplicable; 279 282 280 283 JComboBox dialectChooser; … … 287 290 public static final String southafrican = "South African English"; 288 291 public static final String otherDialect = "Other"; 289 String dialect = american;292 String dialect = notApplicable; 290 293 291 294 JComboBox microphoneChooser; … … 296 299 public static final String studio = "Studio mic"; 297 300 public static final String otherMic = "Other"; 298 String microphone = headset;301 String microphone = notApplicable; 299 302 // !!!!!! 300 303 String fileFieldName; … … 481 484 //p2.setBorder(sbb); 482 485 p2.setLayout(new BoxLayout(p2, BoxLayout.Y_AXIS)); 483 // ###########################################################484 486 // ############ User name #################################### 485 487 // userName is read when user clicks Upload … … 488 490 usernamePanel.add(new JLabel("Username:")); 489 491 usernamePanel.add(usernameTextField = new JTextField(20)); 490 usernamePanel.add(new JLabel("(leave blank to submit anonymously)")); 492 usernamePanel.add(new JLabel("(leave blank to submit anonymously)")); 493 491 494 p2.add(usernamePanel); 492 495 // ############ Gender #################################### … … 506 509 gender = (female); 507 510 }else if(choice.equals(pleaseSelect)){ 508 gender = ("n/a"); 511 gender = (notApplicable); 512 }else { 513 gender = (notApplicable); 509 514 } 510 515 } … … 529 534 ageRange = (senior); 530 535 }else if(choice.equals(pleaseSelect)){ 531 ageRange = ("n/a"); 536 ageRange = (notApplicable); 537 }else { 538 ageRange = (notApplicable); 532 539 } 533 540 } … … 561 568 dialect = (otherDialect); 562 569 }else if(choice.equals(pleaseSelect)){ 563 dialect = ("n/a"); 570 dialect = (notApplicable); 571 }else { 572 dialect = (notApplicable); 564 573 } 565 574 } 566 575 }); 576 dialectPanel.add(new JLabel("(mother tongue)")); 567 577 p2.add(dialectPanel); 568 578 … … 591 601 microphone = (otherMic); 592 602 }else if(choice.equals(pleaseSelect)){ 593 microphone = ("n/a"); 603 microphone = (notApplicable); 604 }else { 605 microphone = (notApplicable); 594 606 } 595 607 } … … 739 751 //progBar.setVisible(false); 740 752 p2.add(progBar); 741 742 753 // ############ More Information Button #################################### 743 754 JPanel moreInfoButtonPanel = new JPanel(); … … 754 765 +"This program comes with ABSOLUTELY NO WARRANTY; without even the implied<br> " 755 766 +"warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For<br>" 756 +" details click the \"About\" button:";767 +"more details click the \"About\" button:"; 757 768 DisclaimerInnerPanel.add(new JLabel(DisclaimerText)); 758 769 aboutB = addButton("About", DisclaimerInnerPanel, true); … … 761 772 DisclaimerPanel.add(DisclaimerInnerPanel); 762 773 p2.add(DisclaimerPanel); 763 // #########################################################################774 //######################################################################### 764 775 add(p2); 765 776 } … … 1326 1337 aboutB.setEnabled(true); 1327 1338 capt8.setEnabled(true); 1328 1329 1330 1339 } 1331 1340 } … … 1505 1514 1506 1515 uploadB.setEnabled(false); 1507 // !!!!!!1508 1516 try { 1509 1517 usernameTextField.selectAll(); … … 1511 1519 if (userName.length() == 0 ) { 1512 1520 userName = "anonymous"; 1521 } else { 1522 // !!!!!! 1523 // see java.util.regex.Pattern 1524 // \w A word character: [a-zA-Z_0-9] 1525 // \W A non-word character: [^\w] 1526 userName = (usernameTextField.getText().replaceAll("\\W","")).substring(0,25); 1513 1527 } 1528 // !!!!!! 1514 1529 } catch (NullPointerException ex) { 1515 1530 userName = "anonymous"; … … 1517 1532 convertAndUpload.start(); 1518 1533 } 1534 // ################### More Information ####################################### 1519 1535 else if (obj.equals(moreInfoB)) { 1520 1536 JTextArea textArea = new JTextArea(license); … … 1529 1545 "More info on Copyright and GPL license", JOptionPane.PLAIN_MESSAGE); 1530 1546 } 1547 // ################### About ####################################### 1531 1548 else if (obj.equals(aboutB)) { 1532 1549 JTextArea textArea = new JTextArea(VFlicense); … … 2222 2239 out_readme.write("Sample rate format: " + samplingRateFormat + System.getProperty("line.separator")); 2223 2240 out_readme.write("Number of channels: " + numberChannels + System.getProperty("line.separator")); 2224 out_readme.write(System.getProperty("line.separator"));2225 2226 out_readme.write("License Info:" + System.getProperty("line.separator"));2227 out_readme.write(System.getProperty("line.separator"));2228 out_readme.write("Copyright name: " + copyrightName + System.getProperty("line.separator"));2229 out_readme.write("Accepted that speech be covered by the GPL license: " + gplAccepted + System.getProperty("line.separator"));2230 2241 2231 2242 out_readme.close();