Skip to content

Commit

Permalink
Play pronunciation from WordExistsDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
berk76 committed Oct 30, 2020
1 parent e1ff2f3 commit 5aea904
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/cz/webstones/words/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -902,16 +902,22 @@ private void addWord() {

if ((wOld = dict.findDuplicity(w)) != null) {
wordExistsDialog.showDialog(w, wOld);
if (!wordExistsDialog.isCancelled())
play(w);
return;
}

if ((wOld = dict.findDuplicity(w.getCz())) != null) {
wordExistsDialog.showDialog(w, wOld);
if (!wordExistsDialog.isCancelled())
play(w);
return;
}

if ((wOld = dict.findDuplicity(w.getEn())) != null) {
wordExistsDialog.showDialog(w, wOld);
if (!wordExistsDialog.isCancelled())
play(w);
return;
}

Expand Down
10 changes: 10 additions & 0 deletions src/main/java/cz/webstones/words/WordExistsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class WordExistsDialog extends JEscapeableDialog {
private IDictionary dict;
private WordDto newWord;
private WordDto oldWord;
private boolean cancelled;
/**
* Creates new form WordExistsDialog
*/
Expand All @@ -33,6 +34,7 @@ public WordExistsDialog(java.awt.Frame parent, boolean modal, IDictionary dictio
public void showDialog(WordDto newWord, WordDto oldWord) {
this.newWord = newWord;
this.oldWord = oldWord;
this.cancelled = false;

this.jLabel3.setText(oldWord.getCz());
this.jLabel5.setText(oldWord.getEn());
Expand Down Expand Up @@ -194,6 +196,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// cancel
cancelled = true;
this.setVisible(false);
}//GEN-LAST:event_jButton3ActionPerformed

Expand Down Expand Up @@ -228,4 +231,11 @@ private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
// End of variables declaration//GEN-END:variables

/**
* @return the play
*/
public boolean isCancelled() {
return cancelled;
}
}

0 comments on commit 5aea904

Please sign in to comment.