• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java FileOpenService类的典型用法和代码示例

java 2次浏览

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

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

示例1: open

点赞 3

import javax.jnlp.FileOpenService; //导入依赖的package包/类
/**
 * Shows a dialog to select a file.
 *
 * @return InputStream
 * @throws FileChooserException
 */
public NamedInputStream open() throws FileChooserException {
    try {
        FileOpenService fos = (FileOpenService) ServiceManager.lookup(FileOpenService.class.getName());
        FileContents fc = null;
        if ((fc = fos.openFileDialog(getUserDirectory(), null)) != null) {
            logger.info("Loaded: " + fc.getName());
            return new NamedInputStream(fc.getName(), fc.getInputStream());
        } else {
            return null;
        }
    } catch (Exception e) {
        String message = "Failed open: " + e.getMessage();
        logger.warning(message);
        throw new FileChooserException(message);
    }
}
 

开发者ID:YcheCourseProject,
项目名称:DIA-Umpire-Maven,
代码行数:23,
代码来源:FileChooserJNLP.java

示例2: open

点赞 3

import javax.jnlp.FileOpenService; //导入依赖的package包/类
/**
 * Shows a dialog to select a file.
 * 
 * @return InputStream
 * @throws FileChooserException
 */
public NamedInputStream open() throws FileChooserException {
	try {
	    FileOpenService fos = (FileOpenService) ServiceManager.lookup(FileOpenService.class.getName());
		FileContents fc = null;
		if ((fc = fos.openFileDialog(getUserDirectory(), null)) != null) {
		    logger.info("Loaded: " + fc.getName());
			return new NamedInputStream(fc.getName(), fc.getInputStream());
		} else {
			return null;
		}
	} catch (Exception e) {
	    String message = "Failed open: " + e.getMessage();
	    logger.warning(message);
	    throw new FileChooserException(message);
	}
}
 

开发者ID:ahmedmoustafa,
项目名称:JAligner,
代码行数:23,
代码来源:FileChooserJNLP.java

示例3: load

点赞 2

import javax.jnlp.FileOpenService; //导入依赖的package包/类
private void load() throws IOException, XMLException {
    FileOpenService fos = null;
    try {
        fos = PhetServiceManager.getFileOpenService( module.getSimulationPanel() );
    }
    catch( UnavailableServiceException e ) {
        e.printStackTrace();
    }
    FileContents open = fos.openFileDialog( null, null );
    if ( open == null ) {
        return;
    }
    InputStreamReader isr = new InputStreamReader( open.getInputStream() );
    BufferedReader br = new BufferedReader( isr );
    String str = "";
    while ( br.ready() ) {
        String read = br.readLine();
        System.out.println( "read = " + read );
        str += read;
    }
    IXMLParser parser = new StdXMLParser();
    parser.setReader( new StdXMLReader( new StringReader( patchString( str ) ) ) );
    parser.setBuilder( new StdXMLBuilder() );
    parser.setValidator( new NonValidator() );

    IXMLElement parsed = (IXMLElement) parser.parse();
    Circuit circuit = CircuitXML.parseXML( parsed, module.getCircuitChangeListener(), module );
    if ( isOldVersionCCK( str ) ) {
        flipY( circuit );
        PhetOptionPane.showMessageDialog( this, "<html>The file you loaded is from an earlier version of this program, <br>and some " +
                                                "parts of the circuit may be oriented incorrectly.  <br><br>Manually correct any problems, and be sure to save the new circuit.</html>" );
    }
    module.setCircuit( circuit );
}
 

开发者ID:mleoking,
项目名称:PhET,
代码行数:35,
代码来源:CCKControlPanel.java

示例4: getFileOpenService

点赞 2

import javax.jnlp.FileOpenService; //导入依赖的package包/类
public static FileOpenService getFileOpenService( Component owner ) throws UnavailableServiceException {
    if ( isJavaWebStart() ) {
        return (FileOpenService) ServiceManager.lookup( "javax.jnlp.FileOpenService" );
    }
    else {
        return new LocalFileOpenService( owner );
    }
}
 

开发者ID:mleoking,
项目名称:PhET,
代码行数:9,
代码来源:PhetServiceManager.java

示例5: getFileOpenService

点赞 1

import javax.jnlp.FileOpenService; //导入依赖的package包/类
/**
 * @return the FileOpenService reference, or null if the service is
 * unavailable.
 */
public static FileOpenService getFileOpenService() {
    return (FileOpenService) getService("javax.jnlp.FileOpenService");
}
 

开发者ID:GITNE,
项目名称:icedtea-web,
代码行数:8,
代码来源:ServiceUtil.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)