List of utility methods to do JFileChooser
void | setSelectedFile(JFileChooser chooser, File file) Set starting dir and file for a chooser. if (file.isDirectory()) chooser.setCurrentDirectory(file); else chooser.setSelectedFile(file); |
JFileChooser | SHOW_JFILECHOOSER(String title, String approvetext, int fileselectionmode, boolean multiselection) SHOJFILECHOOSER JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle(title); chooser.setApproveButtonText(approvetext); chooser.setFileSelectionMode(fileselectionmode); chooser.setMultiSelectionEnabled(multiselection); return chooser; |
int | showFileChooserLoop(Component parentComponent, JFileChooser chooser) show File Chooser Loop for (;;) { int option = chooser.showOpenDialog(parentComponent); if (option != JFileChooser.APPROVE_OPTION) { return JOptionPane.CANCEL_OPTION; File file = chooser.getSelectedFile(); if (file.exists()) { int op2 = showReplaceExistingFileConfirmDialog(parentComponent, file); ... |
void | write(File file, String text) write write(file.toPath(), text); |
void | writeOnFile(String row) write On File writeOnFile(getFileFromChooser().getAbsolutePath(), row); |
void | writeStringToFile(String output) write String To File final JFileChooser fc = new JFileChooser(); int returnVal = fc.showSaveDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { try { BufferedWriter bwriter = new BufferedWriter(new FileWriter(fc.getSelectedFile())); bwriter.write(output, 0, output.length()); bwriter.close(); } catch (IOException e) { ... |