updates
This commit is contained in:
17
.vscode/launch.json
vendored
Normal file
17
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"name": "ApplicationView",
|
||||||
|
"request": "launch",
|
||||||
|
"mainClass": "edu.inventorym.ApplicationView",
|
||||||
|
"projectName": "UiView",
|
||||||
|
"vmArgs": " --module-path /home/sherwinp/workspace/javafx-sdk/lib --add-modules ALL-MODULE-PATH --enable-native-access=javafx.web,javafx.controls,javafx.graphics -Dcom.sun.management.jmxremote=false -Djava.awt.headless=true -XX:+DisableAttachMechanism"
|
||||||
|
},
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -32,7 +32,7 @@ sourceSets {
|
|||||||
srcDirs = ['src/main/java']
|
srcDirs = ['src/main/java']
|
||||||
}
|
}
|
||||||
resources {
|
resources {
|
||||||
srcDirs = ['src/resources/media']
|
srcDirs = ['src/resources']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
test {
|
test {
|
||||||
@@ -64,6 +64,10 @@ dependencies {
|
|||||||
implementation 'org.openjfx:javafx-web:25.0.1'
|
implementation 'org.openjfx:javafx-web:25.0.1'
|
||||||
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.17'
|
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.17'
|
||||||
implementation group: 'org.slf4j', name: 'slf4j-simple', version: '2.0.17'
|
implementation group: 'org.slf4j', name: 'slf4j-simple', version: '2.0.17'
|
||||||
|
|
||||||
|
implementation project(':Model')
|
||||||
|
implementation project(':Api')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
@@ -71,7 +75,6 @@ jar {
|
|||||||
attributes 'Main-Class': application.mainClass
|
attributes 'Main-Class': application.mainClass
|
||||||
}
|
}
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named('jar') {
|
tasks.named('jar') {
|
||||||
@@ -79,6 +82,6 @@ tasks.named('jar') {
|
|||||||
attributes('Implementation-Title': 'edu.inventorym.UiView',
|
attributes('Implementation-Title': 'edu.inventorym.UiView',
|
||||||
'Implementation-Version': 1.0,
|
'Implementation-Version': 1.0,
|
||||||
'Main-Class': application.mainClass,
|
'Main-Class': application.mainClass,
|
||||||
'Class-Path': 'lodge.reservationsystem javafx.base javafx.fxml javafx.controls javafx.graphics javafx.web com.google.gson .' )
|
'Class-Path': 'edu.inventorym.ApplicationView javafx.base javafx.controls javafx.graphics javafx.web .' )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,33 @@
|
|||||||
package edu.inventorym;
|
package edu.inventorym;
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.event.EventHandler;
|
||||||
import javafx.scene.Parent;
|
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.web.WebEvent;
|
||||||
|
import javafx.scene.web.WebView;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
public class ApplicationView extends Application {
|
public class ApplicationView extends Application {
|
||||||
|
|
||||||
|
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
|
@Override
|
||||||
public void start(Stage primaryStage) {
|
public void handle(WebEvent<String> arg0) {
|
||||||
|
System.err.println("alertwb1: " + arg0.getData());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
primaryStage.setTitle("Lodge ReservationSystem");
|
|
||||||
Parent root = FXMLLoader.load(getClass().getClassLoader().getResource("mainViewModel.fxml"));
|
webView.getEngine().load(
|
||||||
Scene scene = new Scene(root, 800, 600);
|
getClass().getResource(page).toExternalForm());
|
||||||
|
|
||||||
|
primaryStage.setTitle("Inventory Manager");
|
||||||
|
Scene scene = new Scene(webView, 800, 600);
|
||||||
primaryStage.setScene(scene);
|
primaryStage.setScene(scene);
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
|
|
||||||
@@ -21,6 +36,12 @@ public class ApplicationView extends Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage) {
|
||||||
|
final String PAGE = "/index.html";
|
||||||
|
createWebView(primaryStage, PAGE);
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
launch(args);
|
launch(args);
|
||||||
}
|
}
|
||||||
|
|||||||
3
UiView/src/resources/css/style.css
Normal file
3
UiView/src/resources/css/style.css
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
body {
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
12
UiView/src/resources/index.html
Normal file
12
UiView/src/resources/index.html
Normal file
@@ -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