Skip to content

Instantly share code, notes, and snippets.

@wargio
Created November 3, 2015 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wargio/48f643a3c4b3a7137728 to your computer and use it in GitHub Desktop.
Save wargio/48f643a3c4b3a7137728 to your computer and use it in GitHub Desktop.
Browser.java
import java.io.IOException;
import java.util.Set;
import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.layout.StackPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import javafx.collections.ListChangeListener;
import javafx.collections.ListChangeListener.Change;
public class Browser extends Application {
final private String title = "Browser";
final private boolean allowResize = false;
static private String url = "";
@Override
public void start(Stage stage) throws Exception {
StackPane root = new StackPane();
WebView view = new WebView();
WebEngine engine = view.getEngine();
engine.load(this.url);
root.getChildren().add(view);
Scene scene = new Scene(root, 800, 600);
stage.setTitle(title);
stage.setResizable(allowResize);
stage.setScene(scene);
stage.show();
}
public static void main(String[] argv) throws IOException {
if(argv.length == 1){
url = argv[0];
String[] args = new String[0];
Application.launch(args);
}else
throw new IOException();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment