• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ExtensionFileFilter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: actionPerformed

import weka.gui.ExtensionFileFilter; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent ae) {
  JFileChooser fc = new JFileChooser(System.getProperty("user.dir"));
  ExtensionFileFilter ef1 = new ExtensionFileFilter(".arff", "ARFF files");
  ExtensionFileFilter ef2 = new ExtensionFileFilter(".xml", "XML BIF files");
  fc.addChoosableFileFilter(ef1);
  fc.addChoosableFileFilter(ef2);
  fc.setDialogTitle("Load Graph");
  int rval = fc.showOpenDialog(GUI.this);

  if (rval == JFileChooser.APPROVE_OPTION) {
    String sFileName = fc.getSelectedFile().toString();
    if (sFileName.endsWith(ef1.getExtensions()[0])) {
      initFromArffFile(sFileName);
    } else {
      try {
        readBIFFromFile(sFileName);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    m_jStatusBar.setText("Loaded " + sFileName);
    updateStatus();
  }
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:26,代码来源:GUI.java


示例2: checkExtension

import weka.gui.ExtensionFileFilter; //导入依赖的package包/类
/**
 * Checks whether the extension of the file is a known one.
 * 
 * @param file the file to check
 * @return true if the exetnsion is known
 */
protected boolean checkExtension(File file) {
  boolean result;
  int i;
  int n;
  ExtensionFileFilter[] filters;
  String[] exts;

  result = false;
  filters = getFilters();
  for (i = 0; i < filters.length; i++) {
    exts = filters[i].getExtensions();
    for (n = 0; n < exts.length; n++) {
      if (file.getName().endsWith(exts[n])) {
        result = true;
        break;
      }
    }
    if (result) {
      break;
    }
  }

  return result;
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:31,代码来源:Script.java


示例3: actionPerformed

import weka.gui.ExtensionFileFilter; //导入依赖的package包/类
public void actionPerformed(ActionEvent ae) {
	JFileChooser fc = new JFileChooser(System.getProperty("user.dir"));
	ExtensionFileFilter ef1 = new ExtensionFileFilter(".arff", "ARFF files");
	ExtensionFileFilter ef2 = new ExtensionFileFilter(".xml", "XML BIF files");
	fc.addChoosableFileFilter(ef1);
	fc.addChoosableFileFilter(ef2);
	fc.setDialogTitle("Load Graph");
	int rval = fc.showOpenDialog(GUI.this);

	if (rval == JFileChooser.APPROVE_OPTION) {
		String sFileName = fc.getSelectedFile().toString();
		if (sFileName.endsWith(ef1.getExtensions()[0])) {
			initFromArffFile(sFileName);
		} else {
			try {
				readBIFFromFile(sFileName);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	    m_jStatusBar.setText("Loaded " + sFileName);
	    updateStatus();
	}
}
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:25,代码来源:GUI.java


示例4: checkExtension

import weka.gui.ExtensionFileFilter; //导入依赖的package包/类
/**
  * Checks whether the extension of the file is a known one.
  * 
  * @param file	the file to check
  * @return		true if the exetnsion is known
  */
 protected boolean checkExtension(File file) {
   boolean			result;
   int				i;
   int				n;
   ExtensionFileFilter[]	filters;
   String[]			exts;

   result = false;
   filters  = getFilters();
   for (i = 0; i < filters.length; i++) {
     exts = filters[i].getExtensions();
     for (n = 0; n < exts.length; n++) {
if (file.getName().endsWith(exts[n])) {
  result = true;
  break;
}
     }
     if (result)
break;
   }
   
   return result;
 }
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:30,代码来源:Script.java


示例5: getFilters

import weka.gui.ExtensionFileFilter; //导入依赖的package包/类
/**
 * Returns the extension filters for this type of script.
 * 
 * @return		the filters
 */
public ExtensionFileFilter[] getFilters() {
  ExtensionFileFilter[]	result;
  
  result = new ExtensionFileFilter[1];
  result[0] = new ExtensionFileFilter(getDefaultExtension(), "Groovy script (*" + getDefaultExtension() + ")");
  
  return result;
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:14,代码来源:GroovyScript.java


示例6: getFilters

import weka.gui.ExtensionFileFilter; //导入依赖的package包/类
/**
 * Returns the extension filters for this type of script.
 * 
 * @return the filters
 */
@Override
public ExtensionFileFilter[] getFilters() {
  ExtensionFileFilter[] result;

  result = new ExtensionFileFilter[1];
  result[0] = new ExtensionFileFilter(getDefaultExtension(),
    "Jython script (*" + getDefaultExtension() + ")");

  return result;
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:16,代码来源:JythonScript.java


示例7: initFinish

import weka.gui.ExtensionFileFilter; //导入依赖的package包/类
/**
 * Finishes up after initializing members and setting up the GUI.
 */
protected void initFinish() {
  ExtensionFileFilter[]	filters;
  int				i;
  
  super.initFinish();
  
  m_Script = newScript(m_TextCode.getDocument());
  m_Script.addScriptFinishedListener(this);
  filters  = m_Script.getFilters();
  for (i = filters.length - 1; i >= 0; i--)
    m_FileChooser.addChoosableFileFilter(filters[i]);
  
  m_Actions = createActionTable(m_TextCode);

  // file
  m_NewAction         = new NewAction();
  m_OpenAction        = new OpenAction();
  m_SaveAction        = new SaveAction("Save", false);
  m_SaveAsAction      = new SaveAction("Save As...", true);
  m_PrintAction       = new PrintAction();
  m_ClearOutputAction = new ClearOutputAction();
  m_ExitAction        = new ExitAction();
  
  // edit
  m_UndoAction        = new UndoAction();
  m_RedoAction        = new RedoAction();
  m_CutAction         = updateAction(m_Actions.get(DefaultEditorKit.cutAction), "Cut", "cut.gif", "ctrl X", 'C');
  m_CopyAction        = updateAction(m_Actions.get(DefaultEditorKit.copyAction), "Copy", "copy.gif", "ctrl C", 'o');
  m_PasteAction       = updateAction(m_Actions.get(DefaultEditorKit.pasteAction), "Paste", "paste.gif", "ctrl V", 'P');
  
  // script
  m_StartAction       = new StartAction();
  m_StopAction        = new StopAction();
  m_ArgsAction        = new CommandlineArgsAction();
  
  // help
  m_AboutAction       = new AboutAction();
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:42,代码来源:FileScriptingPanel.java


示例8: saveModel

import weka.gui.ExtensionFileFilter; //导入依赖的package包/类
public void saveModel() {
  try {
    if (m_fileChooser == null) {
      // i.e. after de-serialization
      m_fileChooser = new JFileChooser(new File(
        System.getProperty("user.dir")));
      ExtensionFileFilter ef = new ExtensionFileFilter("model",
        "Serialized weka clusterer");
      m_fileChooser.setFileFilter(ef);
    }
    int returnVal = m_fileChooser.showSaveDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
      File saveTo = m_fileChooser.getSelectedFile();
      String fn = saveTo.getAbsolutePath();
      if (!fn.endsWith(".model")) {
        fn += ".model";
        saveTo = new File(fn);
      }
      ObjectOutputStream os = new ObjectOutputStream(
        new BufferedOutputStream(new FileOutputStream(saveTo)));
      os.writeObject(m_Clusterer);
      if (m_trainingSet != null) {
        Instances header = new Instances(m_trainingSet, 0);
        os.writeObject(header);
      }
      os.close();
      if (m_log != null) {
        m_log.logMessage("[Clusterer] Saved clusterer " + getCustomName());
      }
    }
  } catch (Exception ex) {
    JOptionPane.showMessageDialog(Clusterer.this,
      "Problem saving clusterer.\n", "Save Model", JOptionPane.ERROR_MESSAGE);
    if (m_log != null) {
      m_log.logMessage("[Clusterer] Problem saving clusterer. "
        + getCustomName() + ex.getMessage());
    }
  }
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:40,代码来源:Clusterer.java


示例9: ConnectionPanel

import weka.gui.ExtensionFileFilter; //导入依赖的package包/类
/**
 * initializes the panel.
 * 
 * @param parent the parent of this panel
 */
public ConnectionPanel(JFrame parent) {
  super();

  m_Parent = parent;
  m_ConnectionListeners = new HashSet<ConnectionListener>();
  m_HistoryChangedListeners = new HashSet<HistoryChangedListener>();
  m_SetupFileChooser = new JFileChooser();
  m_SetupFileChooser.setDialogTitle("Switch database setup");
  m_SetupFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
  m_SetupFileChooser.setMultiSelectionEnabled(false);
  m_SetupFileChooser.setAcceptAllFileFilterUsed(true);
  ExtensionFileFilter filter = new ExtensionFileFilter(".props",
    "Properties file");
  m_SetupFileChooser.addChoosableFileFilter(filter);
  m_SetupFileChooser.setFileFilter(filter);

  try {
    m_DbUtils = new DbUtils();
    m_URL = m_DbUtils.getDatabaseURL();
    m_User = m_DbUtils.getUsername();
    m_Password = m_DbUtils.getPassword();
  } catch (Exception e) {
    e.printStackTrace();
    m_URL = "";
    m_User = "";
    m_Password = "";
  }

  createPanel();
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:36,代码来源:ConnectionPanel.java


示例10: getFilters

import weka.gui.ExtensionFileFilter; //导入依赖的package包/类
/**
 * Returns the extension filters for this type of script.
 * 
 * @return		the filters
 */
public ExtensionFileFilter[] getFilters() {
  ExtensionFileFilter[]	result;
  
  result = new ExtensionFileFilter[1];
  result[0] = new ExtensionFileFilter(getDefaultExtension(), "Jython script (*" + getDefaultExtension() + ")");
  
  return result;
}
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:14,代码来源:JythonScript.java


示例11: ConnectionPanel

import weka.gui.ExtensionFileFilter; //导入依赖的package包/类
/**
 * initializes the panel.
 * 
 * @param parent      the parent of this panel
 */
public ConnectionPanel(JFrame parent) {
  super();
  
  m_Parent                  = parent;
  m_ConnectionListeners     = new HashSet();
  m_HistoryChangedListeners = new HashSet();
  m_SetupFileChooser        = new JFileChooser();
  m_SetupFileChooser.setDialogTitle("Switch database setup");
  m_SetupFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
  m_SetupFileChooser.setMultiSelectionEnabled(false);
  m_SetupFileChooser.setAcceptAllFileFilterUsed(true);
  ExtensionFileFilter filter = new ExtensionFileFilter(".props", "Properties file");
  m_SetupFileChooser.addChoosableFileFilter(filter);
  m_SetupFileChooser.setFileFilter(filter);
  
  try {
    m_DbUtils   = new DbUtils();
    m_URL       = m_DbUtils.getDatabaseURL();
    m_User      = m_DbUtils.getUsername();
    m_Password  = m_DbUtils.getPassword();
  }
  catch (Exception e) {
    e.printStackTrace();
    m_URL      = "";
    m_User     = "";
    m_Password = "";
  }
  
  createPanel();
}
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:36,代码来源:ConnectionPanel.java


示例12: saveModel

import weka.gui.ExtensionFileFilter; //导入依赖的package包/类
public void saveModel() {
  try {
    if (m_fileChooser == null) {
      // i.e. after de-serialization
      m_fileChooser = 
        new JFileChooser(new File(System.getProperty("user.dir")));
      ExtensionFileFilter ef = new ExtensionFileFilter("model", "Serialized weka clusterer");
    m_fileChooser.setFileFilter(ef);
    }
    int returnVal = m_fileChooser.showSaveDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
      File saveTo = m_fileChooser.getSelectedFile();
      String fn = saveTo.getAbsolutePath();
      if (!fn.endsWith(".model")) {
        fn += ".model";
        saveTo = new File(fn);
      }
      ObjectOutputStream os = 
        new ObjectOutputStream(new BufferedOutputStream(
                                                        new FileOutputStream(saveTo)));
      os.writeObject(m_Clusterer);
      if (m_trainingSet != null) {
        Instances header = new Instances(m_trainingSet, 0);
        os.writeObject(header);
      }
      os.close();
      if (m_log != null) {
        m_log.logMessage("[Clusterer] Saved clusterer " + getCustomName());
      }
    }
  } catch (Exception ex) {
    JOptionPane.showMessageDialog(Clusterer.this,
                                  "Problem saving clusterer.\n",
                                  "Save Model",
                                  JOptionPane.ERROR_MESSAGE);
    if (m_log != null) {
      m_log.logMessage("[Clusterer] Problem saving clusterer. " 
          + getCustomName() + ex.getMessage());
    }
  }
}
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:42,代码来源:Clusterer.java


示例13: saveModel

import weka.gui.ExtensionFileFilter; //导入依赖的package包/类
public void saveModel() {
  try {
    if (m_fileChooser == null) {
      // i.e. after de-serialization
      m_fileChooser = 
        new JFileChooser(new File(System.getProperty("user.dir")));
      ExtensionFileFilter ef = new ExtensionFileFilter("model", "Serialized weka clusterer");
    m_fileChooser.setFileFilter(ef);
    }
    int returnVal = m_fileChooser.showSaveDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
      File saveTo = m_fileChooser.getSelectedFile();
      String fn = saveTo.getAbsolutePath();
      if (!fn.endsWith(".model")) {
        fn += ".model";
        saveTo = new File(fn);
      }
      ObjectOutputStream os = 
        new ObjectOutputStream(new BufferedOutputStream(
                                                        new FileOutputStream(saveTo)));
      os.writeObject(m_Clusterer);
      if (m_trainingSet != null) {
        Instances header = new Instances(m_trainingSet, 0);
        os.writeObject(header);
      }
      os.close();
      if (m_log != null) {
        m_log.logMessage(Messages.getInstance().getString("Clusterer_SaveModel_LogMessage_Text_Fourth") + getCustomName());
      }
    }
  } catch (Exception ex) {
    JOptionPane.showMessageDialog(Clusterer.this,
  		  Messages.getInstance().getString("Clusterer_SaveModel_JOptionPane_ShowMessageDialog_Text_First"),
  		  Messages.getInstance().getString("Clusterer_SaveModel_JOptionPane_ShowMessageDialog_Text_Second"),
                                  JOptionPane.ERROR_MESSAGE);
    if (m_log != null) {
      m_log.logMessage(Messages.getInstance().getString("Clusterer_SaveModel_LogMessage_Text_Fifth") 
          + getCustomName() + ex.getMessage());
    }
  }
}
 
开发者ID:williamClanton,项目名称:jbossBA,代码行数:42,代码来源:Clusterer.java


示例14: setUpFile

import weka.gui.ExtensionFileFilter; //导入依赖的package包/类
public void setUpFile() {
   removeAll();

   File tmp = ((FileSourcedConverter)m_dsLoader.getLoader()).retrieveFile();
   tmp = new File(tmp.getAbsolutePath());
   if (tmp.isDirectory()) {
     m_fileChooser.setCurrentDirectory(tmp);
   } else {
     m_fileChooser.setSelectedFile(tmp);
   }
   FileSourcedConverter loader = (FileSourcedConverter) m_dsLoader.getLoader();
   String[] ext = loader.getFileExtensions();
   ExtensionFileFilter firstFilter = null;
   for (int i = 0; i < ext.length; i++) {
     ExtensionFileFilter ff =
new ExtensionFileFilter(
    ext[i], loader.getFileDescription() + " (*" + ext[i] + ")");
     if (i == 0)
firstFilter = ff;
     m_fileChooser.addChoosableFileFilter(ff);
   }
   if (firstFilter != null)
     m_fileChooser.setFileFilter(firstFilter);
   JPanel about = m_LoaderEditor.getAboutPanel();
   if (about != null) {
     add(about, BorderLayout.NORTH);
   }
   add(m_fileChooser, BorderLayout.CENTER);

   m_relativeFilePath = new JCheckBox(Messages.getInstance().getString("LoaderCustomizer_SetUpDatabase_RelativeFilePath_JCheckBox_Text"));
   m_relativeFilePath.
     setSelected(((FileSourcedConverter)m_dsLoader.getLoader()).getUseRelativePath());

   m_relativeFilePath.addActionListener(new ActionListener() {
       public void actionPerformed(ActionEvent e) {
         ((FileSourcedConverter)m_dsLoader.getLoader()).
           setUseRelativePath(m_relativeFilePath.isSelected());
       }
     });
   JPanel holderPanel = new JPanel();
   holderPanel.setLayout(new FlowLayout());
   holderPanel.add(m_relativeFilePath);
   add(holderPanel, BorderLayout.SOUTH);
 }
 
开发者ID:williamClanton,项目名称:jbossBA,代码行数:45,代码来源:LoaderCustomizer.java


示例15: getFilters

import weka.gui.ExtensionFileFilter; //导入依赖的package包/类
/**
 * Returns the extension filters for this type of script.
 * 
 * @return the filters
 */
public abstract ExtensionFileFilter[] getFilters();
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:7,代码来源:Script.java


示例16: getFilters

import weka.gui.ExtensionFileFilter; //导入依赖的package包/类
/**
 * Returns the extension filters for this type of script.
 * 
 * @return		the filters
 */
public abstract ExtensionFileFilter[] getFilters();
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:7,代码来源:Script.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PlayerPickupXpEvent类代码示例发布时间:2022-05-23
下一篇:
Java ReceiveStreamEvent类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap