当前位置: 首页>>代码示例>>Java>>正文


Java ExtensionFileFilter类代码示例

本文整理汇总了Java中org.jfree.ui.ExtensionFileFilter的典型用法代码示例。如果您正苦于以下问题:Java ExtensionFileFilter类的具体用法?Java ExtensionFileFilter怎么用?Java ExtensionFileFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExtensionFileFilter类属于org.jfree.ui包,在下文中一共展示了ExtensionFileFilter类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doSaveAs

import org.jfree.ui.ExtensionFileFilter; //导入依赖的package包/类
/**
 * Opens a file chooser and gives the user an opportunity to save the chart in PNG format.
 * 
 * @throws IOException
 *             if there is an I/O error.
 */

@Override
public void doSaveAs() throws IOException {

	JFileChooser fileChooser = new JFileChooser();
	fileChooser.setCurrentDirectory(this.defaultDirectoryForSaveAs);
	ExtensionFileFilter filter = new ExtensionFileFilter(localizationResources.getString("PNG_Image_Files"), ".png");
	fileChooser.addChoosableFileFilter(filter);

	int option = fileChooser.showSaveDialog(this);
	if (option == JFileChooser.APPROVE_OPTION) {
		String filename = fileChooser.getSelectedFile().getPath();
		if (isEnforceFileExtensions()) {
			if (!filename.endsWith(".png")) {
				filename = filename + ".png";
			}
		}
		ChartUtilities.saveChartAsPNG(new File(filename), this.chart, getWidth(), getHeight());
	}

}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:28,代码来源:AbstractChartPanel.java

示例2: doSaveAs

import org.jfree.ui.ExtensionFileFilter; //导入依赖的package包/类
/**
 * Opens a file chooser and gives the user an opportunity to save the chart
 * in PNG format.
 *
 * @throws IOException if there is an I/O error.
 */
public void doSaveAs() throws IOException {

    JFileChooser fileChooser = new JFileChooser();
    ExtensionFileFilter filter = 
        new ExtensionFileFilter(localizationResources.getString("PNG_Image_Files"), ".png");
    fileChooser.addChoosableFileFilter(filter);
    fileChooser.addChoosableFileFilter(new ExtensionFileFilter("All files", ""));

    int option = fileChooser.showSaveDialog(this);
    if (option == JFileChooser.APPROVE_OPTION) {
        String filename = fileChooser.getSelectedFile().getPath();
        if (isEnforceFileExtensions()) {
            if (!filename.endsWith(".png")) {
                filename = filename + ".png";
            }
        }
        ChartUtilities.saveChartAsPNG(new File(filename), this.chart, getWidth(), getHeight());
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:27,代码来源:ChartPanel.java

示例3: doSaveAs

import org.jfree.ui.ExtensionFileFilter; //导入依赖的package包/类
/**
 * Opens a file chooser and gives the user an opportunity to save the chart
 * in PNG format.
 *
 * @throws IOException if there is an I/O error.
 */
public void doSaveAs() throws IOException {

    JFileChooser fileChooser = new JFileChooser();
    ExtensionFileFilter filter = new ExtensionFileFilter(
            localizationResources.getString("PNG_Image_Files"), ".png");
    fileChooser.addChoosableFileFilter(filter);

    int option = fileChooser.showSaveDialog(this);
    if (option == JFileChooser.APPROVE_OPTION) {
        String filename = fileChooser.getSelectedFile().getPath();
        if (isEnforceFileExtensions()) {
            if (!filename.endsWith(".png")) {
                filename = filename + ".png";
            }
        }
        ChartUtilities.saveChartAsPNG(new File(filename), this.chart, 
                getWidth(), getHeight());
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:27,代码来源:ChartPanel.java

示例4: doSaveAs

import org.jfree.ui.ExtensionFileFilter; //导入依赖的package包/类
/**
 * Opens a file chooser and gives the user an opportunity to save the chart
 * in PNG format.
 *
 * @throws IOException if there is an I/O error.
 */
public void doSaveAs() throws IOException {

    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setCurrentDirectory(this.defaultDirectoryForSaveAs);
    ExtensionFileFilter filter = new ExtensionFileFilter(
            localizationResources.getString("PNG_Image_Files"), ".png");
    fileChooser.addChoosableFileFilter(filter);

    int option = fileChooser.showSaveDialog(this);
    if (option == JFileChooser.APPROVE_OPTION) {
        String filename = fileChooser.getSelectedFile().getPath();
        if (isEnforceFileExtensions()) {
            if (!filename.endsWith(".png")) {
                filename = filename + ".png";
            }
        }
        ChartUtilities.saveChartAsPNG(new File(filename), this.chart,
                getWidth(), getHeight());
    }

}
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:28,代码来源:ChartPanel.java

示例5: save

import org.jfree.ui.ExtensionFileFilter; //导入依赖的package包/类
private void save() throws IOException {
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setCurrentDirectory(super.defaultDirectoryForSaveAs);
    ExtensionFileFilter filter = new ExtensionFileFilter("BED Binary Files", ".bed");
    fileChooser.addChoosableFileFilter(filter);

    int option = fileChooser.showSaveDialog(this);
    if (option == JFileChooser.APPROVE_OPTION) {
        String filename = fileChooser.getSelectedFile().getPath();
        if (isEnforceFileExtensions()) {
            if (!filename.endsWith(".bed")) {
                filename = filename + ".bed";
            }
        }
        try {
            BEDFileWriter bfw = new BEDFileWriter(new File(filename));
        }
        catch (IOException ex) {
            throw new IOException("Could not write file.");
        }
    }
}
 
开发者ID:wtsi-medical-genomics,项目名称:evoker,代码行数:23,代码来源:EvokerChartPanel.java

示例6: save

import org.jfree.ui.ExtensionFileFilter; //导入依赖的package包/类
private void save(String collection, String filename) throws FileNotFoundException, IOException {        
    JFileChooser fileChooser = new JFileChooser();
    ExtensionFileFilter filter = new ExtensionFileFilter("BED Binary Files", ".bed");
    fileChooser.addChoosableFileFilter(filter);

    if (filename == null){
        int option = fileChooser.showSaveDialog(this);
        if (option == JFileChooser.APPROVE_OPTION) {
            filename = fileChooser.getSelectedFile().getAbsolutePath();
        }else{
            return;
        }
    }
    //TP CHANGED THIS
    BEDFileChanger bfc = new BEDFileChanger(db.getMarkerData().collectionIndices.get(collection),
                collection, db.getDisplayName(), db.samplesByCollection.get(collection).inds,
                db.getMarkerData().snpsPerCollection.get(collection), db.getMarkerData().getMarkerTable(),
                db.changesByCollection.get(collection), filename, db, saveBedBimFamFiles);
    
}
 
开发者ID:wtsi-medical-genomics,项目名称:evoker,代码行数:21,代码来源:Genoplot.java

示例7: createFileChooser

import org.jfree.ui.ExtensionFileFilter; //导入依赖的package包/类
/**
 * Creates the file chooser.
 *
 * @return the initialized file chooser.
 */
protected JFileChooser createFileChooser() {
    final JFileChooser fc = new JFileChooser();
    fc.addChoosableFileFilter(
        new ExtensionFileFilter(getFileDescription(), getFileExtension())
    );
    fc.setMultiSelectionEnabled(false);
    fc.setCurrentDirectory(getCurrentDirectory());
    return fc;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:15,代码来源:AbstractFileSelectionAction.java

示例8: initialize

import org.jfree.ui.ExtensionFileFilter; //导入依赖的package包/类
/**
 * Método de inicializacao
 */
private void initialize() {
    setSize(430, 245);
    initComponents();
    gFFBackup.getFileChooser().setFileFilter(new ExtensionFileFilter("Backup Yap", "byap"));
    gFFRestore.getFileChooser().setFileFilter(new ExtensionFileFilter("Backup Yap", "byap"));
}
 
开发者ID:kacianoghelere,项目名称:OD-Controler,代码行数:10,代码来源:BackupDialog.java

示例9: doSaveAs

import org.jfree.ui.ExtensionFileFilter; //导入依赖的package包/类
@Override
public final void doSaveAs() throws IOException {
    String directory = gui.getPreferences().get("lastSaveDirectory", "./");
    String filename = validateSaveFileName(null);
    File chartFile = new File(directory, filename);

    GUIFileChooser fileChooser = new GUIFileChooser(gui, "Select Save Location");
    fileChooser.setSelectedFile(chartFile);

    ExtensionFileFilter filter = new ExtensionFileFilter(localizationResources.getString("PNG_Image_Files"),
            ".png");
    fileChooser.addChoosableFileFilter(filter);

    if (fileChooser.showDialog(this, "Save") == JFileChooser.APPROVE_OPTION) {
        chartFile = fileChooser.getSelectedFile();

        if (isEnforceFileExtensions()) {
            if (!chartFile.getName().endsWith(".png")) {
                chartFile = new File(chartFile.getAbsolutePath() + ".png");
            }
        }

        if (chartFile.exists()) {
            int result = JOptionPane.showConfirmDialog(gui.getMainFrame(),
                    "File '" + chartFile.getName() + "' already exists.\nDo you want to overwrite it?",
                    "Overwrite?", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);

            if (result != JOptionPane.OK_OPTION) {
                return;
            }
        }

        ChartUtilities.saveChartAsPNG(chartFile, getChart(), saveWidth, saveHeight);
    }

    // save the last directory whether or not the file is actually saved
    gui.getPreferences().put("lastSaveDirectory", chartFile.getParentFile().getAbsolutePath());
}
 
开发者ID:nmonvisualizer,项目名称:nmonvisualizer,代码行数:39,代码来源:BaseChartPanel.java

示例10: createChartPrintPostScriptJob

import org.jfree.ui.ExtensionFileFilter; //导入依赖的package包/类
private void createChartPrintPostScriptJob() {
// Use the pre-defined flavor for a Printable from an InputStream 
	DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;

		// Specify the type of the output stream 
	String psMimeType = DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMimeType();

	// Locate factory which can export a GIF image stream as Postscript 
	StreamPrintServiceFactory[] factories =
	StreamPrintServiceFactory.lookupStreamPrintServiceFactories(
				flavor, psMimeType);
	if (factories.length == 0) {
		System.err.println("No suitable factories");
		System.exit(0); // FIXME too
	}
               // Obtain file name from user
               JFileChooser fileChooser = new JFileChooser();
               ExtensionFileFilter filter = new ExtensionFileFilter(
                       localizationResources.getString("PostScript_Files"), ".eps");
               fileChooser.addChoosableFileFilter(filter);
               String filename="";
               int option = fileChooser.showSaveDialog(this);
               if (option == JFileChooser.APPROVE_OPTION) {
                  filename = fileChooser.getSelectedFile().getPath();
                  if (isEnforceFileExtensions()) {
                     if (!filename.endsWith(".eps")) {
                        filename = filename + ".eps";
                     }
                  } else
                     return;
               }

	try {
		// Create a file for the exported postscript
		FileOutputStream fos = new FileOutputStream(filename);

		// Create a Stream printer for Postscript 
		StreamPrintService sps = factories[0].getPrintService(fos);

		// Create and call a Print Job 
		DocPrintJob pj = sps.createPrintJob();
		PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();

		Doc doc = new SimpleDoc(this, flavor, null);

		pj.print(doc, aset);
		fos.close();

	} catch (PrintException pe) { 
		System.err.println(pe);
	} catch (IOException ie) { 
		System.err.println(ie);
	}

  }
 
开发者ID:opensim-org,项目名称:opensim-gui,代码行数:56,代码来源:ChartPanel.java

示例11: print

import org.jfree.ui.ExtensionFileFilter; //导入依赖的package包/类
/**
 * Prints the chart on a single page.
 *
 * @param g  the graphics context.
 * @param pf  the page format to use.
 * @param pageIndex  the index of the page. If not <code>0</code>, nothing 
 *                   gets print.
 *
 * @return The result of printing.
 */
public int print(Graphics g, PageFormat pf, int pageIndex) {

   if (pageIndex != 0) {
      return NO_SUCH_PAGE;
   }
   /** this works but the curve is made of little pieces */
   Graphics2D g2 = (Graphics2D) g;
   double x = pf.getImageableX();
   double y = pf.getImageableY();
   double w = pf.getImageableWidth();
   double h = pf.getImageableHeight();
   this.chart.draw(g2, new Rectangle2D.Double(x, y, w, h), this.anchor,
           null);
   
   if (printToPrinter)  return PAGE_EXISTS;
   // The rest should be moved up to the export eps action listener so it's not done per page'
   // Show export dialog
   JFileChooser fileChooser = new JFileChooser();
   ExtensionFileFilter filter = new ExtensionFileFilter(
           localizationResources.getString("PostScript_Files"), ".eps");
   fileChooser.addChoosableFileFilter(filter);
   String filename="";
   int option = fileChooser.showSaveDialog(this);
   if (option == JFileChooser.APPROVE_OPTION) {
      filename = fileChooser.getSelectedFile().getPath();
      if (isEnforceFileExtensions()) {
         if (!filename.endsWith(".eps") || !filename.endsWith(".ps")) {
            filename = filename + ".eps";
         }
      } else
         return NO_SUCH_PAGE;
   }
    
   try {
      OutputStream out = new java.io.FileOutputStream(new File(filename));
      out = new java.io.BufferedOutputStream(out);

      //Instantiate the EPSDocumentGraphics2D instance
      EPSDocumentGraphics2D g2dps = new EPSDocumentGraphics2D(false);
      g2dps.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext());
      //Set up the document size
      g2dps.setupDocument(out, (int)w, (int)h+200);

      //Paint a bounding box
      g2dps.drawRect((int)x, (int)y, (int)w, (int)h);
      this.chart.draw(g2dps, new Rectangle2D.Double(x, y, w, h), this.anchor,
              null);


      //A few rectangles rotated and with different color

      //Cleanup
      g2dps.finish();
      out.flush();
      out.close();
   }
   catch(java.io.IOException e){
      return NO_SUCH_PAGE;
   }
   return PAGE_EXISTS;
   
}
 
开发者ID:opensim-org,项目名称:opensim-gui,代码行数:73,代码来源:ChartPanel.java

示例12: actionPerformed

import org.jfree.ui.ExtensionFileFilter; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    File projectPath = frame.getPath();

    if (projectPath == null) {
        JOptionPane.showMessageDialog(frame, "Can not open graph before project has been opened.");
        return;
    }
    final File networkPath = new File(projectPath + File.separator + ProjectConstants.networkDirName);
    JFileChooser chooser = new JFileChooser();
    chooser.setDialogTitle("Select a graphml file to load into your project");
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

    chooser.setFileFilter(new ExtensionFileFilter("Graphml File chooser", "graphml"));

    chooser.setMultiSelectionEnabled(false);
    int result = chooser.showOpenDialog(frame);
    if (result == JFileChooser.APPROVE_OPTION) {
        File fileResult = chooser.getSelectedFile();



        if(fileResult.exists()){
            System.out.println(fileResult);
            File version = autolabel(projectPath.getAbsolutePath());

            File graphmlDir = new File(version, ProjectConstants.undirectedGraphmlDirName);
            graphmlDir.mkdir();

            try {
                File outputFile = new File(graphmlDir, ProjectConstants.networkGraphmlFileName);
                FileCopyUtils.copy(fileResult,outputFile);
                JOptionPane.showMessageDialog(frame, "Graph file successfully imported in "+ version.getName() + " of your current project!");

                frame.doOpenGraph(outputFile);

            } catch (IOException e1) {
                e1.printStackTrace();
            }

        }
    }

}
 
开发者ID:iTransformers,项目名称:netTransformer,代码行数:45,代码来源:AddGraphMenuHandler.java


注:本文中的org.jfree.ui.ExtensionFileFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。