Guest User

Untitled

a guest
Apr 4th, 2016
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. import javax.swing.*;
  2. import javax.swing.filechooser.FileNameExtensionFilter;
  3. public class ChooseFileForAlarm {
  4. public void ChooseFile(){
  5. JButton b1 = new JButton();
  6. JFileChooser fc = new JFileChooser();
  7. FileNameExtensionFilter filt = new FileNameExtensionFilter("wav", "wav" );
  8.  
  9. fc.addChoosableFileFilter(filt);
  10. fc.setFileFilter(filt);
  11. fc.setCurrentDirectory(new java.io.File("C:/Users/dns/Desktop/воркспэйс/Game"));
  12. fc.setDialogTitle("Hello");
  13.  
  14. fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
  15. if(fc.showOpenDialog(b1)==JFileChooser.APPROVE_OPTION){
  16.  
  17. }
  18. String s = fc.getSelectedFile().getAbsolutePath();
  19. String z = s.replace('\\', '/');
  20. //тут установлю стринг, передающую путь к файлу в Chasi
  21. Chasi ch = new Chasi();
  22. ch.setRe(z);
  23. }
  24.  
  25.  
  26.  
  27. public static void main(String[] args) {
  28.  
  29.  
  30. }
  31.  
  32. }
Add Comment
Please, Sign In to add comment