# Com / Github / Blaxk3 / Converter

## Overview

`com.github.blaxk3.converter` is the application entry-point package for the currency converter. It contains a single bootstrap class that starts the Swing UI on the Event Dispatch Thread, which is the standard way to launch desktop UI code safely in Java.

This module appears to exist primarily as a thin startup layer: it does not implement conversion logic itself, but instead delegates immediately to the UI package. That makes it the launch point for the application while keeping presentation and interaction concerns separated from startup code.

## Key Classes and Interfaces

### [`CurrencyConverter`](src/main/java/com/github/blaxk3/converter/CurrencyConverter.java:7)

`CurrencyConverter` is the only class in this package and serves as the executable entry point.

#### Responsibility
- Provides the `main` method used to start the application.
- Defers UI creation to `com.github.blaxk3.ui.UI`.
- Ensures the UI is instantiated on the Swing Event Dispatch Thread via `SwingUtilities.invokeLater`.

#### Key method

##### [`CurrencyConverter.main(String[] args)`](src/main/java/com/github/blaxk3/converter/CurrencyConverter.java:8)

- **Purpose:** Starts the application.
- **Parameters:** `String[] args`, the standard Java command-line arguments. They are accepted but not used in this implementation.
- **Returns:** `void`.
- **Behavior:** Calls `SwingUtilities.invokeLater(UI::new)` so that `UI` construction happens asynchronously on the Swing UI thread.
- **Side effects:** Creates the application UI when the queued task runs.

## How It Works

The startup flow is straightforward:

1. The JVM invokes `CurrencyConverter.main(...)`.
2. `main` schedules a task on the Swing Event Dispatch Thread.
3. That task constructs a new `UI` instance.
4. Control returns immediately to the caller while the UI is initialized in the proper Swing context.

This pattern avoids creating Swing components on the wrong thread, which is important for stability and responsiveness in desktop applications.

### Relationship diagram

```mermaid
flowchart TD
    MainEntry["CurrencyConverter.main"] --> SwingInvoke["SwingUtilities.invokeLater"]
    SwingInvoke --> UIConstructor["com.github.blaxk3.ui.UI"]
```

## Data Model

There is no local data model in this package. The converter package does not define domain objects, DTOs, or configuration types. Any conversion state or user input handling is likely owned by the UI layer that this module launches.

## Dependencies and Integration

### Direct dependency
- [`com.github.blaxk3.ui.UI`](src/main/java/com/github/blaxk3/ui/UI.java)

`CurrencyConverter` imports `UI` and instantiates it indirectly through a method reference. This package therefore acts as the bridge between the application launcher and the user interface layer.

### Platform dependency
- `javax.swing.SwingUtilities`

The use of `SwingUtilities.invokeLater` indicates that this is a Swing desktop application and that UI startup follows Swing threading rules.

## Notes for Developers

- `main` is intentionally minimal. If you need startup behavior such as logging, argument parsing, or configuration loading, this is the place to add it before the UI is scheduled.
- Because `UI` is created through `invokeLater`, any initialization logic inside `UI` should remain safe to run on the Event Dispatch Thread and should avoid long blocking work.
- The `args` parameter is currently unused. If you add command-line options later, `main` will need to parse them before scheduling the UI.
- This package has no internal abstractions, so any functional expansion will likely happen in sibling packages rather than here.
