This page is intended to provide information on small chunks of code that are of general use, but are not necessarily fully functional blocks. If you are stuck on a coding problem then search this page for the topic/function/keyword of interest, an index is not provided as the list of contents is expected to grow unwieldy.
Note, if some of the code is not visible in the examples below just copy the code and paste it into a text editor to see it all.
FileChooser Filter, DeferredChooser, FileFilter, FileNameExtensionFilter By monkeyboy
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import se.datadosen.jalbum.DeferredChooser;
DeferredChooser fc = new DeferredChooser(JFileChooser.class);
FileFilter filter = new FileNameExtensionFilter("JPEG file", new String[] {"jpg", "jpeg"});
fc.setFileFilter(filter);
ui.fc.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int fcReturn = fc.showOpenDialog(window);
if (fcReturn == JFileChooser.APPROVE_OPTION) {
//Your code
}
}
});