This is a continuous crawling for a lipster beginner on Clojure and Java. I have this code to select a file, but I would like to filter the files' extensions that I am looking for.
(import javax.swing.JFileChooser)
(defn tlt-get-file [ ]
(let [ filechooser (JFileChooser. "C:/")
retval (.showOpenDialog filechooser nil) ]
(if (= retval JFileChooser/APPROVE_OPTION)
(do
(println (.getSelectedFile filechooser))
(.getSelectedFile filechooser))
"")))
Your help always much appreciated.
(choose-file :dir "C:/" :filters [["Images" ["png" "jpeg"]]])
. Welcome to Clojure :) – Neolamarckism