Created
November 3, 2015 21:52
-
-
Save wargio/48f643a3c4b3a7137728 to your computer and use it in GitHub Desktop.
Browser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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