File Select Dialog with GP4

edited October 2013 in Library Questions

@quark I'm wanting to use your library to make a file select dialog. I did see the demo on your website, but I have a couple of questions. I am fine with using the java format (non-native). I want to allow multi-selecting of files and I want to be able to filter to a specific file extension (.png or .svg, or whatever). I'm not sure how to do that. I have code for swing to allow multi-selecting, but I don't want to use swing. Can you give me an example of how to do that with your library?

I'd also like to be able to see a thumbnail of the selected image (as shown here: docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html with the FileChooserDemo2) Is that possible?

Thanks.

Answers

  • Answer ✓

    Processing has always had file/folder selection dialogs. In 1.5.1 they where 'blocking' dialogs, in other words the program stopped until the file chooser closed. In 2.0 these dialogs are opened in a secondary thread leaving the main program running while the user uses the dialog box.

    This caused some of my existing sketches to crash out. Since G4P was going through many changes trying to keep up with the beta releases of Processing 2 I decided that I would reintroduce 1.5.1 style file dialogs for others in the same predicament.

    OK so that the history, the first thing to say is that both G4P's and Processing's dialog boxes are based on either Java awt or Swing depending on the value of PApplet.useNativeSelect

    G4P dialogs do not support multi-select but it does support filtering on file types see here

    If you want multi-select and icons etc then you will have to use Java Swing.

  • Okay, thanks. I'll just have to mess around with the demo to see if I can make it work.

Sign In or Register to comment.