# Repository Overview

Welcome to this repository. This appears to be a small desktop currency converter built in Java, with a Swing user interface and a thin API client for exchange-rate lookups. The code is organized into a launcher, a UI layer, and an API layer, so the application flow is fairly easy to follow once you know where to start. If you are new here, think of this project as a simple example of a desktop app that fetches live currency data and presents it in a form-based interface.

## Overview

This repository appears to implement a currency conversion tool for the desktop. The application starts from a small launcher, opens a Swing window, loads currency codes from a remote exchange-rate service, and converts amounts between selected currencies. Most of the business behavior lives in the UI and API packages, with the launcher acting only as the entry point.

The main runtime flow appears to be:

1. Start the application from `CurrencyConverter`.
2. Create the Swing `UI` on the event dispatch thread.
3. Load supported currency codes in the background.
4. Convert an entered amount using the remote API.
5. Display the formatted result in the interface.

## Technology Stack

This project appears to use a plain Java desktop stack rather than a full application framework.

- **Java / JDK APIs** - core language, networking, collections, and numeric types such as `BigDecimal`
- **Swing / AWT** - desktop UI components, layout managers, and event handling
- **Gson** - JSON parsing for responses from the exchange-rate service
- **SLF4J** - logging for error reporting and background worker failures
- **HttpURLConnection** - HTTP access to the remote currency service
- **ExchangeRate-API** - external service used for live currency rates and conversion results

## Architecture

The architecture is intentionally small and layered. The launcher depends on the UI package, and the UI depends on the API package for live data. The API package in turn depends on configuration and the external exchange-rate service.

```mermaid
flowchart LR
Overview["Overview"] --> Converter["com.github.blaxk3.converter"]
Overview --> UI["com.github.blaxk3.ui"]
Overview --> API["com.github.blaxk3.api"]
Converter --> UI
UI --> API
API --> ExternalAPI["ExchangeRate-API service"]
UI --> Swing["Swing and AWT"]
Converter --> Swing
```

## Module Guide

### `com.github.blaxk3.converter`

This appears to be the application entry module. The key class is [`CurrencyConverter`](src/main/java/com/github/blaxk3/converter/CurrencyConverter.java:7), which provides the `main` method and schedules UI startup on the Swing event dispatch thread. It does not contain conversion logic itself; instead, it hands control to the UI layer.

### `com.github.blaxk3.ui`

This appears to be the presentation layer and the main user-facing part of the application. The central class is [`UI`](src/main/java/com/github/blaxk3/ui/UI.java:30), which builds the window, wires up the input field, combo boxes, and buttons, and calls into the API layer when the user requests a conversion. Two helper classes live alongside it in the same file: [`NumericFilter`](src/main/java/com/github/blaxk3/ui/UI.java:167), which restricts text input to numeric values, and [`CurrencyCode`](src/main/java/com/github/blaxk3/ui/UI.java:214), which loads currency codes in the background so the interface stays responsive.

### `com.github.blaxk3.api`

This appears to be the integration layer for the external exchange-rate service. The key class is [`CurrencyRateAPI`](src/main/java/com/github/blaxk3/api/CurrencyRateAPI.java:19), which reads the API key from configuration, builds request URLs, performs HTTP calls, parses JSON, and exposes convenience methods for listing supported currency codes and converting amounts.

## Getting Started

If you are exploring the code for the first time, a good reading order is:

1. [`CurrencyConverter`](src/main/java/com/github/blaxk3/converter/CurrencyConverter.java:7) - start here to see how the application launches.
2. [`UI`](src/main/java/com/github/blaxk3/ui/UI.java:30) - read next to understand the window layout, button actions, and user flow.
3. [`CurrencyCode`](src/main/java/com/github/blaxk3/ui/UI.java:214) and [`NumericFilter`](src/main/java/com/github/blaxk3/ui/UI.java:167) - these helpers explain how the UI stays responsive and validates input.
4. [`CurrencyRateAPI`](src/main/java/com/github/blaxk3/api/CurrencyRateAPI.java:19) - finish here to see how live exchange-rate data is fetched and converted.

A few practical notes for a new developer:

- The UI is created on the Swing event dispatch thread, so keep that threading model in mind if you change startup behavior.
- The application appears to depend on a `config.properties` file for the API key.
- Currency codes are fetched asynchronously, so the combo boxes may populate shortly after the window opens.
- The convert action is a thin wrapper over the remote service, so network or configuration failures may surface as logs or `null`-style failures rather than polished user messages.

For a deeper dive, the package-level pages for `api`, `converter`, and `ui` are the best next references.
