Knowledge base of ~80+ markdown files across 14 domains (00-13), Logseq graph, hardware design files (KiCAD), infrastructure configs, and talas-wiki static site. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
44 lines
1.3 KiB
Text
44 lines
1.3 KiB
Text
package com.example.standalone;
|
|
|
|
import javafx.application.Application;
|
|
import javafx.scene.Scene;
|
|
import javafx.scene.control.Button;
|
|
import javafx.scene.control.ListView;
|
|
import javafx.scene.layout.VBox;
|
|
import javafx.stage.Stage;
|
|
|
|
import java.net.http.HttpClient;
|
|
import java.net.http.HttpRequest;
|
|
import java.net.http.HttpResponse;
|
|
import java.net.URI;
|
|
|
|
public class Main extends Application {
|
|
@Override
|
|
public void start(Stage stage) {
|
|
ListView<String> productList = new ListView<>();
|
|
Button loadButton = new Button("Load Products");
|
|
|
|
loadButton.setOnAction(e -> {
|
|
try {
|
|
HttpClient client = HttpClient.newHttpClient();
|
|
HttpRequest request = HttpRequest.newBuilder()
|
|
.uri(URI.create("http://localhost:8080/api/products"))
|
|
.build();
|
|
|
|
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
|
|
productList.getItems().addAll(response.body());
|
|
} catch (Exception ex) {
|
|
ex.printStackTrace();
|
|
}
|
|
});
|
|
|
|
VBox layout = new VBox(10, productList, loadButton);
|
|
stage.setScene(new Scene(layout, 400, 300));
|
|
stage.show();
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
launch();
|
|
}
|
|
}
|
|
|