public void testShow() {
new JFrame().setVisible(true); // otherwise no panel
NSOpenPanel panel = NSOpenPanel.CLASS.openPanel();
// Keep this reference!
ObjCObject ocProxy = Rococoa.proxy(new Object() {
@SuppressWarnings("unused")
public boolean panel_shouldShowFilename(ID panel, String filename) {
char initialChar = new File(filename).getName().toLowerCase().charAt(0);
return initialChar % 2 == 0;
}
});
panel.setDelegate(ocProxy.id());
int button = panel.runModalForTypes(null);
// or, eg
// NSArray.CLASS.arrayWithObjects(
// NSString.stringWithString("txt"), null));
NSString filenameAsNSString = panel.filename();