javafx.application.Application Java Examples

The following examples show how to use javafx.application.Application. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DesignerStarter.java    From pmd-designer with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@SuppressWarnings("PMD.AvoidCatchingThrowable")
private static void launchGui(String[] args) {
    String message = null;
    if (!isJavaFxAvailable()) {
        message = MISSING_JAVAFX;
    }

    if (message != null) {
        System.err.println(message);
        JOptionPane.showMessageDialog(null, message);
        System.exit(ERROR_EXIT);
    }


    try {
        Application.launch(Designer.class, args);
    } catch (Throwable unrecoverable) {
        unrecoverable.printStackTrace();
        System.exit(ERROR_EXIT);
    }
}
 
Example #2
Source File: UserPrefs.java    From archivo with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Parse command-line arguments into user preferences.
 *
 * @param parameters The Application parameters
 * @return false if an unrecognized parameter was passed
 */
public boolean parseParameters(Application.Parameters parameters) {
    boolean allParsed = true;
    List<String> params = parameters.getUnnamed();
    for (int i = 0; i < params.size(); i++) {
        String param = params.get(i);
        if (param.equalsIgnoreCase("-tooldir")) {
            tooldir = params.get(++i);
            logger.info("Tools in '{}'", tooldir);
        } else {
            logger.error("Unrecognized parameter: {}", param);
            allParsed = false;
        }
    }
    return allParsed;
}
 
Example #3
Source File: JavaFxGameRunner.java    From triplea with GNU General Public License v3.0 5 votes vote down vote up
public static void main(final String[] args) {
  HeadedGameRunner.initializeClientSettingAndLogging();
  HeadedGameRunner.initializeLookAndFeel();
  Interruptibles.await(
      () ->
          SwingAction.invokeAndWait(
              () -> {
                ConsoleConfiguration.initialize();
                ErrorMessage.initialize();
              }));
  HeadedGameRunner.initializeDesktopIntegrations(args);

  Application.launch(TripleA.class, args);
}
 
Example #4
Source File: DesktopApp.java    From FXTutorials with MIT License 5 votes vote down vote up
private Parent createContent() {
    Pane root = new Pane();
    root.setPrefSize(1920, 1080);

    VBox boxIcons = new VBox(25);

    icons.forEach(icon -> {
        icon.setOnMouseClicked(e -> {
            try {
                Application app = icon.appClass.newInstance();

                Stage stage = new Stage();
                app.start(stage);
                stage.close();

                Parent appRoot = stage.getScene().getRoot();
                stage.getScene().setRoot(new Pane());

                DesktopWindow window = new DesktopWindow(appRoot);

                root.getChildren().add(window);

            } catch (Exception error) {
                System.out.println("Error: " + error);
                error.printStackTrace();
            }
        });

        boxIcons.getChildren().add(icon);
    });

    root.getChildren().add(boxIcons);

    return root;
}
 
Example #5
Source File: LogFX.java    From LogFX with GNU General Public License v3.0 5 votes vote down vote up
public static void main( String[] args ) {
    if ( FxUtils.isMac() ) {
        SetupMacTrayIcon.run();
    }

    Font.loadFont( LogFX.class.getResource( "/fonts/fontawesome-webfont.ttf" ).toExternalForm(), 12 );
    Application.launch( LogFX.class );
}
 
Example #6
Source File: MqttListener.java    From diozero with MIT License 5 votes vote down vote up
public static void main(String[] args) {
	if (args.length > 0) {
		if (args[0].startsWith("--" + MQTT_SERVER_OPTION + "=")) {
			mqttServer = args[0].substring(MQTT_SERVER_OPTION.length() + 3);
		}
	}
	
	if (mqttServer == null) {
		System.out.println("Error: Usage MqttListener --" + MQTT_SERVER_OPTION + "=<MQTT Server URL>");
		System.exit(2);
	}
	
	Application.launch(args);
}
 
Example #7
Source File: DesktopApp.java    From FXTutorials with MIT License 5 votes vote down vote up
DesktopIcon(String name, Class<? extends Application> appClass) {
    this.name = name;
    this.appClass = appClass;

    Rectangle bg = new Rectangle(100, 100, null);
    bg.setStroke(Color.BLACK);
    bg.setStrokeWidth(2.5);

    Text text = new Text(name);

    getChildren().addAll(bg, text);
}
 
Example #8
Source File: JavaFXElementTest.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static void startApplication() {
    new Thread(new Runnable() {
        @Override
        public void run() {
            Application.launch(ApplicationHelper.class);
        }
    }).start();
}
 
Example #9
Source File: ChoiceBoxTreeTableSampleApp.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
    Application.launch(args);
}
 
Example #10
Source File: OscilloscopeAxisSample.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
/**
 * @param args the command line arguments
 */
public static void main(final String[] args) {
    Application.launch(args);
}
 
Example #11
Source File: ScatterAndBubbleRendererSample.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
/**
 * @param args the command line arguments
 */
public static void main(final String[] args) {
    Application.launch(args);
}
 
Example #12
Source File: JFXApplicationLauncher.java    From tuxguitar with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void launch() {
	Application.launch(JFXApplicationLauncher.class);
}
 
Example #13
Source File: Demo.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
    Application.launch(args);
}
 
Example #14
Source File: Demo.java    From JFX8CustomControls with Apache License 2.0 4 votes vote down vote up
public static void main(final String[] args) {
    Application.launch(args);
}
 
Example #15
Source File: DotLayoutExample.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
public static void main(String[] args) {
	Application.launch(args);
}
 
Example #16
Source File: MZmineMain.java    From old-mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String args[]) {

    /*
     * In the beginning, set the default locale to English, to avoid problems with conversion of
     * numbers etc. (e.g. decimal separator may be . or , depending on the locale)
     */
    Locale.setDefault(new Locale("en", "US"));

    /*
     * Configure the logging properties before we start logging
     */
    MZmineLogging.configureLogging();

    /*
     * Report current working directory
     */
    String cwd = Paths.get(".").toAbsolutePath().normalize().toString();
    logger.info("MZmine " + MZmineCore.getMZmineVersion() + " starting");
    logger.debug("Working directory is " + cwd);

    /*
     * Cleanup old temporary files on a new thread
     */
    TmpFileCleanup cleanupClass = new TmpFileCleanup();
    Thread cleanupThread = new Thread(cleanupClass);
    cleanupThread.setPriority(Thread.MIN_PRIORITY);
    cleanupThread.start();

    /*
     * Register shutdown hook
     */
    ShutDownHook shutDownHook = new ShutDownHook();
    Thread shutDownThread = new Thread(shutDownHook);
    Runtime.getRuntime().addShutdownHook(shutDownThread);

    /*
     * Load modules on a new thread after the GUI has started
     */
    MZmineModuleStarter moduleStarter = new MZmineModuleStarter();
    Thread moduleStarterThread = new Thread(moduleStarter);
    moduleStarterThread.setPriority(Thread.MIN_PRIORITY);
    moduleStarterThread.start();

    /*
     * Usage Tracker
     */
    GoogleAnalyticsTracker GAT =
        new GoogleAnalyticsTracker("MZmine Loaded (GUI mode)", "/JAVA/Main/GUI");
    Thread gatThread = new Thread(GAT);
    gatThread.setPriority(Thread.MIN_PRIORITY);
    gatThread.start();

    /*
     * Start the JavaFX GUI
     */
    logger.info("Starting MZmine GUI");
    Application.launch(MZmineGUI.class, args);

  }
 
Example #17
Source File: SimpleListViewScrollSample.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
    Application.launch(SimpleListViewScrollSampleApp.class, args);
}
 
Example #18
Source File: UserView.java    From NLIDB with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
	try {
	Application.launch(args);
	} catch (Exception e) { e.printStackTrace(); }
}
 
Example #19
Source File: Console.java    From dm3270 with Apache License 2.0 4 votes vote down vote up
public static void main (final String[] arguments)
{
  Application.launch (arguments);
}
 
Example #20
Source File: ShowAccountDialogTest.java    From oim-fx with MIT License 4 votes vote down vote up
/**
 * @param args the command line arguments
 */
public static void main(String[] args) {
    Application.launch(ShowAccountDialogTest.class, args);
}
 
Example #21
Source File: TextFieldTreeTableSampleApp.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
    Application.launch(args);
}
 
Example #22
Source File: DownloadPreplannedMapSample.java    From arcgis-runtime-samples-java with Apache License 2.0 4 votes vote down vote up
/**
 * Opens and runs application.
 * @param args arguments passed to this application
 */
public static void main(String[] args) {

  Application.launch(args);
}
 
Example #23
Source File: DataViewerSample.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
public static void main(final String[] args) {
    Application.launch(args);
}
 
Example #24
Source File: ZoomerSample.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
/**
 * @param args the command line arguments
 */
public static void main(final String[] args) {
    Application.launch(args);
}
 
Example #25
Source File: WaterfallPerformanceSample.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
/**
 * @param args the command line arguments
 */
public static void main(final String[] args) {
    Application.launch(args);
}
 
Example #26
Source File: Gui.java    From ARMStrong with Mozilla Public License 2.0 4 votes vote down vote up
@Override
public void start(Stage primaryStage) {
	this.simulator = new ArmSimulator();
	this.executionMode = false;
	this.running = new AtomicBoolean(false);
	this.interfaceBeingUpdated = new AtomicBoolean(false);

	this.stage = primaryStage;

	primaryStage.setTitle("#@RMStrong");
	Image applicationIcon = new Image(Gui.class.getResource("/resources/logo.png").toExternalForm());
	primaryStage.getIcons().add(applicationIcon);
	
	this.dockPane = new DockPane();

	// load an image to caption the dock nodes
	// Image dockImage = new
	// Image(Gui.class.getResource("docknode.png").toExternalForm());

	// creating the nodes
	this.registersViews = new ArrayList<>();
	this.ramViews = new ArrayList<>();
	this.ledViews = new ArrayList<>();
	this.eightSegmentDisplays = new ArrayList<>();
	
	this.codeEditor = new CodeEditor(simulator);
	this.codeEditor.getNode().dock(dockPane, DockPos.LEFT);

	this.registersViews.add(new RegistersView(this.simulator));
	this.registersViews.get(0).getNode().setMaxWidth(220);
	this.registersViews.get(0).getNode().dock(dockPane, DockPos.LEFT);

	this.ramViews.add(new RamView(simulator));
	this.ramViews.get(0).getNode().dock(dockPane, DockPos.RIGHT);


	this.consoleView = new ConsoleView();
	this.consoleView.getNode().dock(dockPane, DockPos.BOTTOM);

	this.consoleView.redirectToConsole();
	
	this.simulator.setConsoleView(this.consoleView);
	
	this.interpreter = new Interpreter(this.simulator);
	this.isInterpreterMode = false;
	
	this.armMenuBar = new ArmMenuBar(this.getHostServices());
	this.armToolBar = new ArmToolBar();

	VBox vbox = new VBox();
	vbox.getChildren().addAll(this.armMenuBar.getNode(), this.armToolBar.getNode(), dockPane);
	VBox.setVgrow(dockPane, Priority.ALWAYS);

	this.scene = new Scene(vbox, 1000, 1000);
	this.stage.setMaximized(true);
	this.stage.setResizable(true);

	primaryStage.setScene(this.scene);
	primaryStage.sizeToScene();

	setButtonEvents();
	setExecutionMode();

	Application.setUserAgentStylesheet(Application.STYLESHEET_MODENA);

	newUpdateThread(this.running);
	
	primaryStage.show();
	primaryStage.setOnCloseRequest((WindowEvent event) -> System.exit(0));
	DockPane.initializeDefaultUserAgentStylesheet();
	
	vbox.getStylesheets().add("/resources/style.css");
	
	System.out.println("Welcome to #@RMStrong Simulator made proudly at the Institute of Technology of Valence in 2018-2019 by fellow students under the guidance of Dr. Philippe Objois!");
	System.out.println("Licensed under the MPL 2.0 License");
	System.out.println("Copyright (c) 2018-2019 Valentin D'Emmanuele, Gilles Mertens, Dylan Fraisse, Hugo Chemarin, Nicolas Gervasi");
}
 
Example #27
Source File: TreeViewSample.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
    Application.launch(args);
}
 
Example #28
Source File: FoxEatsDemoView.java    From htm.java-examples with GNU Affero General Public License v3.0 4 votes vote down vote up
public FoxEatsDemoView(FoxEatsDemo demo, Application.Parameters params) {
    this.demo = demo;
    
    // Extract api key from arguments
    apiKey = params.getUnnamed().get(0).substring(2).trim();
    
    setBackground(new Background(new BackgroundFill(Color.WHITE, null, null)));
    
    // LeftMargin And RightMargin
    HBox h = new HBox();
    h.prefWidthProperty().bind(widthProperty().divide(20));
    h.setFillHeight(true);
    HBox h2 = new HBox();
    h2.prefWidthProperty().bind(widthProperty().divide(20));
    h2.setFillHeight(true);
    
    // StackPane: Center panel, z:0 CorticalLogoPane, z:1 VBox w/main content
    StackPane stack = new StackPane();
    stack.prefWidthProperty().bind(widthProperty().multiply(9.0/10.0));
    stack.prefHeightProperty().bind(heightProperty());
    
    //////////////////////////////
    //    Z:0 background logo   //
    //////////////////////////////
    CorticalLogoBackground backGround = new CorticalLogoBackground(stack);
    backGround.setOpacity(0.2);
    
    //////////////////////////////
    // Z:1 Main Content in VBox //
    //////////////////////////////
    VBox vBox = new VBox();
    vBox.setSpacing(20);
    vBox.prefWidthProperty().bind(stack.widthProperty());
    vBox.prefHeightProperty().bind(new SimpleDoubleProperty(100.0));
    
    LogoTitlePane header = new LogoTitlePane();
    header.setTitleText("What Does A Fox Eat?");
    header.setSubTitleText("an example of using Numenta's Hierarchical Temporal Memory with Cortical.io's Semantic Folding...");
    
    HBox buttonBar = createSegmentedButtonBar();
    
    LabelledRadiusPane inputPane = getDisplayPane();
    vBox.getChildren().addAll(header, buttonBar, inputPane);
    
    stack.getChildren().addAll(backGround, vBox);
    
    // Main Layout: 3 columns, 1 row
    add(h, 0, 0);
    add(stack, 1, 0);
    add(h2, 2, 0);
    
    Platform.runLater(() -> {
        Thread t = new Thread() {
            public void run() { try{ 
                Thread.sleep(100);}catch(Exception e) {}
                Platform.runLater(() -> {
                    getScene().getWindow().setWidth(getScene().getWindow().getWidth() + 10);
                    vBox.layoutBoundsProperty().addListener((v, o, n) -> {
                        inputPane.setPrefHeight(vBox.getLayoutBounds().getHeight() - inputPane.getLayoutY() - 50);
                    });                       
                });
            }
        };
        t.start();
    });
   
}
 
Example #29
Source File: MetaDataRendererSample.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
/**
 * @param args the command line arguments
 */
public static void main(final String[] args) {
    Application.launch(args);
}
 
Example #30
Source File: SidesPaneSample.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
public static void main(final String[] args) {
    Application.launch(args);
}