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


Java Application.Parameters方法代码示例

本文整理汇总了Java中javafx.application.Application.Parameters方法的典型用法代码示例。如果您正苦于以下问题:Java Application.Parameters方法的具体用法?Java Application.Parameters怎么用?Java Application.Parameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.application.Application的用法示例。


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

示例1: start

import javafx.application.Application; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
	try {
		final SplashScreen splash = SplashScreen.getSplashScreen();

        // Determine if we passed anything on the cmd line
        parseCmdLine();

        // Define our controllers
        SpeedGuideViewController viewController = loadFXMLController("view/SpeedGuideView.fxml");
        SpeedGuideConnection connectionController = loadFXMLController("view/ConnectionDialog.fxml");

		// Wire up our Model/View/Controllers
		viewController.setConnectionViewController(connectionController);
		viewController.setDebug(m_debug);
		viewController.defineControlBindings(m_consumer);

		// Notify our consumer some setup information
        m_consumer.setDebug(m_debug);
        m_consumer.setViewController(viewController);

		// Define the main viewing scene,
        AnchorPane layout = viewController.getLayout();
		Scene scene = new Scene(layout, layout.getPrefWidth(), layout.getPrefHeight());

		// Prevent the user from resizing the window too small
		primaryStage.setMinHeight(layout.getMinHeight());
		primaryStage.setMinWidth(layout.getMinWidth());

		// Assign to our main stage and show the application to the end user
		primaryStage.setTitle("Speed Guide");
		primaryStage.setScene(scene);
		primaryStage.show();

		// Set up our EMA Consumer and launch a thread to run...
        Thread t = new Thread(m_consumer);
        t.start();

    	Application.Parameters params = getParameters();
    	connectionController.initialize(params.getNamed().get(HOST_PARAM),
    						  			params.getNamed().get(SERVICE_PARAM),
    						  			params.getNamed().get(USER_PARAM),
    						  			m_consumer);

        // Attempt to Connect into Elektron
		if ( splash != null )
			splash.close();
        connectionController.connect();
	} catch  (Exception e) {
		System.out.print("Exception in Application Start: ");
		e.printStackTrace();
		stop();
	}
}
 
开发者ID:TR-API-Samples,项目名称:Example.EMA.Java.SpeedGuide,代码行数:55,代码来源:SpeedGuide.java

示例2: parseCmdLine

import javafx.application.Application; //导入方法依赖的package包/类
private void parseCmdLine() throws Exception
 {
 	Application.Parameters params = getParameters();
 	if ( params.getRaw().contains("--h") || params.getRaw().contains("--help") ||
 		 params.getNamed().containsKey("h") || params.getNamed().containsKey("help"))
 	{
 		System.out.println(NEWLINE+"Syntax:"+NEWLINE);
 		System.out.println("  > java -jar SpeedGuide.jar [options]  or"+NEWLINE);
 		System.out.println("  > SpeedGuide.exe [options] <Windows only>"+NEWLINE);
 		System.out.println("Options:"+NEWLINE);
 		System.out.println("  --host=hostname:port    Server address/hostname and port of your Market Data server.");
 		System.out.println("                          Syntax: <host/ip>:<port>.  Eg: elektron:14002 or 192.168.1.1:14002");
System.out.println("  --service=serviceName   Service Name providing market data content.");
System.out.println("                          Eg: ELEKTRON_AD.");
System.out.println("  --user=userName         User name required if authentication is enabled on server.");
System.out.println("                          Note: if no user name is provided, the utility will use your desktop login");
System.out.println("  --d[ebug]               Debug Mode.  Display verbose messages to the console");
System.out.println("  --h[elp]                Prints this screen"+NEWLINE);
System.out.println("If neither the --host nor --service is not provided, the utility will prompt the user to enter these values."+NEWLINE);
System.out.println("Example:");
System.out.println("  > SpeedGuide.exe --host=elektron:14002 --service=ELEKTRON_AD -user=testuser");
 		stop();
 	}

 	m_debug = params.getRaw().contains("--d") || params.getRaw().contains("--debug") ||
 			 params.getNamed().containsKey("d") || params.getNamed().containsKey("debug");
 }
 
开发者ID:TR-API-Samples,项目名称:Example.EMA.Java.SpeedGuide,代码行数:28,代码来源:SpeedGuide.java


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