當前位置: 首頁>>代碼示例>>Java>>正文


Java FileDialog.setMultipleMode方法代碼示例

本文整理匯總了Java中java.awt.FileDialog.setMultipleMode方法的典型用法代碼示例。如果您正苦於以下問題:Java FileDialog.setMultipleMode方法的具體用法?Java FileDialog.setMultipleMode怎麽用?Java FileDialog.setMultipleMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.FileDialog的用法示例。


在下文中一共展示了FileDialog.setMultipleMode方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: actionPerformed

import java.awt.FileDialog; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent e) {
    FileDialog fileDialog = new FileDialog(ImageViewerGui.getMainFrame(), "Choose a file", FileDialog.LOAD);
    // does not work on Windows
    fileDialog.setFilenameFilter(new AllFilenameFilter());
    fileDialog.setMultipleMode(true);
    fileDialog.setDirectory(Settings.getSingletonInstance().getProperty("default.local.path"));
    fileDialog.setVisible(true);

    String directory = fileDialog.getDirectory();
    File[] fileNames = fileDialog.getFiles();
    if (fileNames.length > 0 && directory != null) {
        // remember the current directory for future
        Settings.getSingletonInstance().setProperty("default.local.path", directory);
        Settings.getSingletonInstance().save("default.local.path");
        for (File fileName : fileNames) {
            if (fileName.isFile())
                Load.image.get(fileName.toURI());
        }
    }
}
 
開發者ID:Helioviewer-Project,項目名稱:JHelioviewer-SWHV,代碼行數:22,代碼來源:OpenLocalFileAction.java

示例2: actionPerformed

import java.awt.FileDialog; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent e) {
    FileDialog fileDialog = new FileDialog(ImageViewerGui.getMainFrame(), "Choose a file", FileDialog.LOAD);
    // does not work on Windows
    fileDialog.setFilenameFilter(new JsonFilenameFilter());
    fileDialog.setMultipleMode(true);
    fileDialog.setDirectory(Settings.getSingletonInstance().getProperty("default.local.path"));
    fileDialog.setVisible(true);

    String directory = fileDialog.getDirectory();
    File[] fileNames = fileDialog.getFiles();
    if (fileNames.length > 0 && directory != null) {
        // remember the current directory for future
        Settings.getSingletonInstance().setProperty("default.local.path", directory);
        Settings.getSingletonInstance().save("default.local.path");
        for (File fileName : fileNames) {
            if (fileName.isFile())
                Load.timeline.get(fileName.toURI());
        }
    }
}
 
開發者ID:Helioviewer-Project,項目名稱:JHelioviewer-SWHV,代碼行數:22,代碼來源:OpenLocalFileAction.java

示例3: requestAddNewPlugin

import java.awt.FileDialog; //導入方法依賴的package包/類
private void requestAddNewPlugin() {
	FileDialog fileChooser = new FileDialog((java.awt.Frame) null);
	fileChooser.setFilenameFilter(new FilenameFilter() {

		@Override
		public boolean accept(File dir, String name) {
			return name.endsWith(".jar") ? true : false;
		}
	});
	fileChooser.setDirectory(System.getProperty("user.home"));
	fileChooser.setMultipleMode(false);
	fileChooser.setVisible(true);
	String directory = fileChooser.getDirectory();
	String file = fileChooser.getFile();
	final File selected = new File(directory + "/" + file);
	SwingWorker<String, Object> worker = new SwingWorker<String, Object>() {

		@Override
		protected String doInBackground() throws Exception {
			if (!requestRunning) {
				requestRunning = true;
				pluginModel.installPlugin(selected);
			}
			return "done";
		}
	};
	setBussyMouse(true);
	worker.execute();
}
 
開發者ID:CollapsedDom,項目名稱:Stud.IP-Client,代碼行數:30,代碼來源:PluginView.java

示例4: opendialog

import java.awt.FileDialog; //導入方法依賴的package包/類
public synchronized void opendialog() throws IOException {

        FileDialog fd = new FileDialog(this, "open djvu file", FileDialog.LOAD);
        fd.setMultipleMode(true);
        fd.show();
        if (fd.getDirectory() != null) {
            File files[] = fd.getFiles();
            for (File file : files) {
                FileSavePath.save(file.getPath());

                String url;
                url = "" + file.toURI().toURL();
                url = url.substring(5, url.length());
                String name = file.getName();
                if (!curropen.contains(name)) {
                    name_url.put(name, url);
                    url_name.put(url, name);
                    curropen.add(name);
                    bookList.add(url);
                    openBookInNewTab(url, name);

                } else {
                    tabbedPane.setSelectedIndex(tabbedPane.indexOfTab(name));
                }
            }

        } else {
        }

    }
 
開發者ID:DJVUpp,項目名稱:Desktop,代碼行數:31,代碼來源:DjvuStart.java

示例5: exportButtonActionPerformed

import java.awt.FileDialog; //導入方法依賴的package包/類
private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed

        File saveFile = null;

        String contents;
        String path;

//        JFileChooser chooser = new JFileChooser(lastPath);
//
//        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
//        chooser.setDialogTitle("Select a name to export the file");
//
//        CSVFileFilter filter = new CSVFileFilter();
//        filter.addExtension("csv");
//        filter.setFilterName("CSV Files");
//        chooser.setFileFilter(filter);
//        chooser.setAcceptAllFileFilterUsed(true);
//
//        int returnVal = chooser.showSaveDialog(this);
//        if (returnVal == JFileChooser.APPROVE_OPTION) {
//            saveFile = chooser.getSelectedFile();
//            lastPath=chooser.getSelectedFile().getParent();
//        } else {
//            return;
//        }
        
        FileDialog chooser2 = new FileDialog(this,lastPath,FileDialog.SAVE);
        chooser2.setTitle("Select a name to export the file");
        chooser2.setFilenameFilter(new FilenameFilter() {
            @Override public boolean accept(File dir, String name) {
                return name.endsWith(".csv");
            }
        });
        chooser2.setMultipleMode(false);
        chooser2.setVisible(true);
        
        if(chooser2.getFile() != null){
            saveFile = new File(chooser2.getDirectory()+chooser2.getFile());
            lastPath=saveFile.getParent();
        }else return;

        try {
            path = saveFile.getCanonicalPath();
        } catch (IOException ex) {
            JOptionPane.showMessageDialog(this, "Error exporting data:\n" + ex.getLocalizedMessage(), "Error", JOptionPane.ERROR_MESSAGE);
            return;
        }

        if (!path.endsWith(".csv")) {
            path += ".csv";
        }

        contents = model.generateCSVOutput();

        Files.writeFile(path, contents);

        JOptionPane.showMessageDialog(this, "Data succesfully exported to " + path + " file.", "Export data", JOptionPane.INFORMATION_MESSAGE);
}
 
開發者ID:SCI2SUGR,項目名稱:KEEL,代碼行數:59,代碼來源:StatisticalF.java

示例6: images2djVuActionPerformed

import java.awt.FileDialog; //導入方法依賴的package包/類
private void images2djVuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_images2djVuActionPerformed
    // TODO add your handling code here:

    Djvust.setVisible(true);

    FileDialog imagestoconvert2djvu = new FileDialog(new java.awt.Frame(), "Select Images", FileDialog.LOAD);
    imagestoconvert2djvu.setMultipleMode(true);
    imagestoconvert2djvu.setVisible(true);
    String t = imagestoconvert2djvu.getDirectory();
    openimgs = imagestoconvert2djvu.getDirectory();
    boolean ch = true;
    try {
        if (t != null) {
            imagess = imagestoconvert2djvu.getFiles();
            imageNAME = new String[imagess.length];
            for (int i = 0; i < imagess.length; i++) {
                imageNAME[i] = imagess[i].getName();
                System.out.println("Images name"+imageNAME[i].toString());
                String sn = imageNAME[i].substring(imageNAME[i].lastIndexOf("."));
                sn = sn.toLowerCase();
                if (sn.equals(".jpg") | sn.equals(".jpeg") | sn.equals(".tif") | sn.equals(".png")) {

                } else {
                    JOptionPane.showMessageDialog(null, "File selected not image\nPlease select image");
                    t = null;
                    ch = false;
                    break;
                }

            }
            if (ch) {
                FileDialog SaveDjVu = new FileDialog(new java.awt.Frame(), "Save DjVu", FileDialog.SAVE);
                SaveDjVu.setVisible(true);
                String djvu_path = SaveDjVu.getDirectory() + SaveDjVu.getFile();
                
                String path ="/home/"+System.getProperty("user.name")+"/.Image2Djvu/output.pdf";
                System.out.println("djvu_path :"+"/home/essam/Desktop/file");
                
                System.out.println("System User Path"+path);
                System.out.println("Openining images paths :it must have all images in a string :"+openimgs);
                IMAGEStoPDF.convertToIMG(imageNAME, path, openimgs, 2);
                
                System.out.println("Convert Images To Pdf OK ");
                
                PDF2DjVu.PDF2DjVu( path, djvu_path, 2);
                
                System.out.println("Convert Pdf To Djvu File Is Also Oka");
               
                File open = new File(djvu_path + ".djvu");
                String url;
                url = "" + open.toURI();
                url = url.substring(5, url.length());
                String name = open.getName();
                if (!curropen.contains(name)) {
                    name_url.put(name, url);
                    url_name.put(url, name);
                    curropen.add(name);
                    DjvuStart.unsavedbook.add(url);
                    DjvuStart.openBookInNewTab(url, name);
                    System.out.println("Book Opend Successfully");
                
                       } else if (curropen.contains(name)) {
                    tabbedPane.setSelectedIndex(tabbedPane.indexOfTab(name));
                } else {
                }

            }
        }
    } catch (Exception e) {
    } finally {
        Djvust.setVisible(false);

        File tf = new File("/home/"+System.getProperty("user.name")+"/.Image2Djvu/output.pdf");
        if (tf.exists()) {
            tf.delete();
        }
    }


}
 
開發者ID:DJVUpp,項目名稱:Desktop,代碼行數:81,代碼來源:Images2DjVuPanel.java

示例7: pdfstatActionPerformed

import java.awt.FileDialog; //導入方法依賴的package包/類
private void pdfstatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pdfstatActionPerformed
    // TODO add your handling code here:
    Imagesstate.setVisible(true);

    FileDialog openIMGS = new FileDialog(new java.awt.Frame(), "Select Images", FileDialog.LOAD);
    openIMGS.setMultipleMode(true);
    openIMGS.setVisible(true);
    try {
        openimg = openIMGS.getDirectory();

        File files[] = openIMGS.getFiles();
        imagesname = new String[files.length];
        boolean ch = true;
        if (openIMGS.getFile() != null) {
            for (int i = 0; i < files.length; i++) {
                imagesname[i] = files[i].getName();
                //PDFFullPath = "C:\\DjVu++Task\\ImagestoPDF\\" + imagesname[i].substring(0, imagesname[i].lastIndexOf(".")) + ".pdf";
                String sn = imagesname[i].substring(imagesname[i].lastIndexOf("."));
                sn = sn.toLowerCase();
                if (sn.equals(".jpg") | sn.equals(".jpeg") | sn.equals(".tif") | sn.equals(".png")) {

                } else {
                    JOptionPane.showMessageDialog(null, "File is selected is not image\nPlease select image");
                    openimg = null;
                    ch = false;
                    break;
                }
            }
            if (ch) {
                FileDialog SaveDjVu = new FileDialog(new java.awt.Frame(), "Save Pdf", FileDialog.SAVE);
                SaveDjVu.setVisible(true);
                String path = SaveDjVu.getDirectory() + SaveDjVu.getFile();
                if (path != null && SaveDjVu.getFile() != null) {
                    IMAGEStoPDF.convertToIMG(imagesname, path + ".pdf", openimg, 1);
                }
            }
        } else {
            Imagesstate.setVisible(false);
        }
    } catch (Exception t) {
    } finally {
        Imagesstate.setVisible(false);
    }
}
 
開發者ID:DJVUpp,項目名稱:Desktop,代碼行數:45,代碼來源:Image2PDFpanel.java


注:本文中的java.awt.FileDialog.setMultipleMode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。