/** Method to toggle the file chooser's visibilty. */ public void toggleFileChooser() { if (!windowShown) { // this.setVisible(true); // this.sendToFront(); window.setVisible(true); window.sendToFront(); } else // this.setVisible(false); window.setVisible(false); windowShown = !windowShown; }
/** Method to show file chooser with the specified file filter applied. */ public void toggleFileChooser(String filter) { if (filter == "image") { setSelectedFileFilter(imagesFilter); setFileFilter(imagesFilter); refreshDirectory(); } if (filter == "movie") { setSelectedFileFilter(videosFilter); setFileFilter(videosFilter); refreshDirectory(); } if (filter == "xml") { setSelectedFileFilter(XMLFilter); setFileFilter(XMLFilter); refreshDirectory(); } if (filter == "pdf") { setSelectedFileFilter(PDFFilter); setFileFilter(PDFFilter); refreshDirectory(); } if (filter == "slideshow") { setSelectedFileFilter(allFilter); setFileFilter(allFilter); refreshDirectory(); } if (!windowShown) { this.setVisible(true); this.sendToFront(); window.setVisible(true); window.sendToFront(); } windowShown = true; }