import javafx.application.Application;
import javafx.application.HostServices;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class ShowDocumentBug extends Application {

    //private static String url = "file:///tmp/README.txt";
    private static String url = "http://www.oracle.com/";

    private void showDocument(String url) {
        HostServices hostServices = this.getHostServices();
        hostServices.showDocument(url); 
    }

    @Override public void start(Stage stage) {
        stage.setTitle("HostServices.showDocument test");

        final TextField urlBox = new TextField();
        urlBox.setText(url);
        urlBox.setOnAction(e -> showDocument(urlBox.getText()));
        HBox.setHgrow(urlBox, Priority.ALWAYS);

        Button showButton = new Button("Show");
        showButton.setOnAction(e -> showDocument(urlBox.getText()));

        HBox naviBar = new HBox();
        naviBar.getChildren().addAll(urlBox, showButton);

        StackPane root = new StackPane();
        root.getChildren().addAll(naviBar);

        Scene scene = new Scene(root, 400, 200);
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        Application.launch(args);
    }
}
