updates
This commit is contained in:
@@ -1,26 +1,47 @@
|
||||
package edu.inventorym;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.web.WebEvent;
|
||||
import javafx.scene.web.WebView;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class ApplicationView extends Application {
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
|
||||
private void createWebView(Stage primaryStage, final String page) {
|
||||
// create the JavaFX webview
|
||||
final WebView webView = new WebView();
|
||||
|
||||
// show "alert" Javascript messages in stdout (useful to debug)
|
||||
webView.getEngine().setOnAlert(new EventHandler<WebEvent<String>>() {
|
||||
@Override
|
||||
public void handle(WebEvent<String> arg0) {
|
||||
System.err.println("alertwb1: " + arg0.getData());
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
primaryStage.setTitle("Lodge ReservationSystem");
|
||||
Parent root = FXMLLoader.load(getClass().getClassLoader().getResource("mainViewModel.fxml"));
|
||||
Scene scene = new Scene(root, 800, 600);
|
||||
|
||||
webView.getEngine().load(
|
||||
getClass().getResource(page).toExternalForm());
|
||||
|
||||
primaryStage.setTitle("Inventory Manager");
|
||||
Scene scene = new Scene(webView, 800, 600);
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
final String PAGE = "/index.html";
|
||||
createWebView(primaryStage, PAGE);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
body {
|
||||
margin: 10px;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Inventory HTML File</title>
|
||||
|
||||
<link rel="stylesheet" href="/css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Java desktop app with Web-based UI</h1>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user