# Com / Github / Blaxk3 / Converter

## Overview

This package serves as the application entry point for the Currency Converter desktop application. It contains the `main` method that bootstraps the Java Swing GUI using `SwingUtilities.invokeLater`, ensuring the UI is constructed on the Event Dispatch Thread.

## Key Classes

### CurrencyConverter

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

A thin launcher class. Its sole responsibility is to start the application.

**Method: `main(String[] args)`**

- **Purpose**: Entry point for the application.
- **Parameters**: `String[] args` — command-line arguments (unused).
- **Behavior**: Delegates to `SwingUtilities.invokeLater(UI::new)`, which schedules the `UI` component constructor to run on the Swing Event Dispatch Thread (EDT). This is the correct pattern for Java Swing applications, as all UI interactions must occur on the EDT to avoid thread-safety issues.

```java
public static void main(String[] args) {
    SwingUtilities.invokeLater(UI::new);
}
```

## How It Works

The module follows a standard Java Swing application startup pattern:

1. The JVM invokes `CurrencyConverter.main(String[])`.
2. `SwingUtilities.invokeLater(Runnable)` queues a task to instantiate the `UI` class.
3. The Swing toolkit processes the queued task on the EDT, creating and showing the GUI.

Because this module is a single entry point, there is no internal request/response flow to document. The actual conversion logic and UI rendering are handled by the `com.github.blaxk3.ui.UI` class.

## Dependencies and Integration

This package depends on:

- **`javax.swing.SwingUtilities`** — from the Java Standard Edition runtime, used to schedule UI initialization on the correct thread.
- **`com.github.blaxk3.ui.UI`** — the internal UI module that implements the graphical interface.

```mermaid
flowchart TD
    Main["CurrencyConverter.main"] --> Launch["SwingUtilities.invokeLater"]
    Launch --> UI["UI"]
    UI --> Swing["javax.swing"]
```

## Notes for Developers

- The launcher is intentionally minimal. All application logic lives in `UI` (in the `com.github.blaxk3.ui` package), so new features should be added there rather than in this class.
- The `main` method does not parse or validate `args`. If you need command-line configuration (e.g., a currency pair to pre-select), consider adding argument parsing here before the `invokeLater` call.
- Because `UI` is instantiated via a method reference (`UI::new`), the `UI` constructor must be public and take no arguments.
