Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. public String decode(String a,String b){
  2. CharSequence[] text={"a","b","c","d","e","f","g","h","i","j","k","l","m","n"
  3. ,"o","p","q","r","s","t","u","v","w","x","y","z"};
  4. String[] morze={".-","_...","_._.","_..",".",".._.","__.","...."
  5. ,"..",".___","_._","._..","__","_.","___",".__.","__._","._."
  6. ,"...","-",".._","..._",".__","_.._","_.__","__.."};
  7. for(int i=0;i<text.length;i++){
  8. if(a.contains(text[i])){
  9. b+=morze[i];
  10. }
  11. }
  12. System.out.println(":"+b);
  13. return b;
  14. }
  15. }
  16.  
  17. public void actionPerformed(ActionEvent e) {
  18. String a=textText.getText();
  19. String b1="";
  20. d.decode(a, b1);
  21.  
  22. System.out.println(b1);
  23. morzeText.setText(b1);
  24. s.play();
  25. }
  26.  
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement