-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapDisplayApp.java
More file actions
32 lines (26 loc) · 1018 Bytes
/
Copy pathMapDisplayApp.java
File metadata and controls
32 lines (26 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import javax.swing.*;
public class MapDisplayApp extends Application {
@Override
public void start(Stage primaryStage) {
// Create a WebView to show the map
WebView webView = new WebView();
WebEngine webEngine = webView.getEngine();
// Google Maps embed URL with a specific location (e.g., New York)
String googleMapsUrl = "https://www.google.com/maps/embed/v1/place?key=YOUR_API_KEY&q=New+York";
// Load the Google Maps URL
webEngine.load(googleMapsUrl);
// Create a scene and add the WebView
Scene scene = new Scene(webView, 800, 600);
primaryStage.setTitle("Google Map Example");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}