59 60 @Override 61 public native void toFront(); 62 63 @Override 64 public native void setBounds(int x, int y, int width, int height, int op); 65 66 /** 67 * Called exclusively by the native C code. 68 */ 69 private void setFileInternal(String directory, String[] filenames) { 70 AWTAccessor.FileDialogAccessor accessor = AWTAccessor 71 .getFileDialogAccessor(); 72 73 if (filenames == null) { 74 accessor.setDirectory(fd, null); 75 accessor.setFile(fd, null); 76 accessor.setFiles(fd, null, null); 77 } else { 78 // Fix 6987233: add the trailing slash if it's absent 79 accessor.setDirectory(fd, directory + 80 (directory.endsWith(File.separator) ? 81 "" : File.separator)); 82 accessor.setFile(fd, filenames[0]); 83 accessor.setFiles(fd, directory, filenames); 84 } 85 } 86 87 /** 88 * Called exclusively by the native C code. 89 */ 90 private boolean filenameFilterCallback(String fullname) { 91 if (fd.getFilenameFilter() == null) { 92 // no filter, accept all. 93 return true; 94 } 95 96 File filen = new File(fullname); 97 return fd.getFilenameFilter().accept(new File(filen.getParent()), 98 filen.getName()); 99 } 100 101 @Override | 59 60 @Override 61 public native void toFront(); 62 63 @Override 64 public native void setBounds(int x, int y, int width, int height, int op); 65 66 /** 67 * Called exclusively by the native C code. 68 */ 69 private void setFileInternal(String directory, String[] filenames) { 70 AWTAccessor.FileDialogAccessor accessor = AWTAccessor 71 .getFileDialogAccessor(); 72 73 if (filenames == null) { 74 accessor.setDirectory(fd, null); 75 accessor.setFile(fd, null); 76 accessor.setFiles(fd, null, null); 77 } else { 78 // Fix 6987233: add the trailing slash if it's absent 79 String with_separator = directory; 80 if (directory != null) { 81 with_separator = directory.endsWith(File.separator) ? 82 directory : (directory + File.separator); 83 } 84 accessor.setDirectory(fd, with_separator); 85 accessor.setFile(fd, filenames[0]); 86 accessor.setFiles(fd, directory, filenames); 87 } 88 } 89 90 /** 91 * Called exclusively by the native C code. 92 */ 93 private boolean filenameFilterCallback(String fullname) { 94 if (fd.getFilenameFilter() == null) { 95 // no filter, accept all. 96 return true; 97 } 98 99 File filen = new File(fullname); 100 return fd.getFilenameFilter().accept(new File(filen.getParent()), 101 filen.getName()); 102 } 103 104 @Override |