Example usage for javafx.application HostServices resolveURI

List of usage examples for javafx.application HostServices resolveURI

Introduction

In this page you can find the example usage for javafx.application HostServices resolveURI.

Prototype

public final String resolveURI(String base, String rel) 

Source Link

Document

Resolves the specified relative URI against the base URI and returns the resolved URI.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {

    Button openURLButton = new Button("Go!");
    openURLButton.setOnAction(e -> {/*from   ww  w . j av  a2 s  .  c o  m*/
        HostServices host = this.getHostServices();

        System.out.println("CodeBase:" + host.getCodeBase());

        System.out.println("DocumentBase:" + host.getDocumentBase());

        System.out.println("Environment:" + host.getWebContext());

        System.out.println("Splash Image URI" + host.resolveURI(host.getDocumentBase(), "splash.jpg"));
    });

    Scene scene = new Scene(openURLButton);
    stage.setScene(scene);
    stage.setTitle("Knowing the Host");
    stage.show();
}