# Com / Github / Blaxk3 / Converter

## Overview

The `com.github.blaxk3.converter` package appears to be the application entry point for a Swing-based currency converter. It does not contain business logic itself; instead, it bootstraps the UI on the Swing event dispatch thread and hands control to `com.github.blaxk3.ui.UI`. In practice, this module exists to start the desktop application in the correct way for Swing applications.

## Key Classes and Interfaces

### `CurrencyConverter`

- **Code:** [src/main/java/com/github/blaxk3/converter/CurrencyConverter.java](src/main/java/com/github/blaxk3/converter/CurrencyConverter.java:7)
- **Role:** Application launcher / startup wrapper.

`CurrencyConverter` is a minimal class whose only responsibility is to provide a `main` method. That makes it the JVM entry point for running the app from the command line, from an IDE, or from a packaged desktop distribution. It does not construct UI components directly on the calling thread; instead, it defers UI creation to Swing's event dispatch thread, which is the standard pattern for thread-safe Swing initialization.

#### `main(String[] args)`

- **Code:** [CurrencyConverter.main(String[] args)](src/main/java/com/github/blaxk3/converter/CurrencyConverter.java:8)
- **Parameters:**
  - `args` — command-line arguments passed to the application. The method does not inspect them.
- **Returns:** `void`
- **Behavior:** Calls `SwingUtilities.invokeLater(UI::new)` to schedule creation of a new `UI` instance on the Swing event dispatch thread.
- **Side effects:** Starts the desktop UI startup sequence. The actual application window and any related initialization happen inside `com.github.blaxk3.ui.UI`.

This class is intentionally small. Its design keeps startup concerns separate from UI implementation details, which makes it easier to change the interface without touching the application launcher.

## How It Works

The startup flow is straightforward:

1. The JVM calls `CurrencyConverter.main(...)`.
2. The method registers a task with `SwingUtilities.invokeLater(...)`.
3. When Swing is ready, the task runs and constructs a new `UI` instance.
4. `UI` then owns the rest of the application startup and user interaction.

This pattern ensures the UI is created on the correct thread and avoids common Swing threading problems.

## Dependencies and Integration

### Internal dependency

- **`com.github.blaxk3.ui.UI`** — the launcher depends on the UI class for actual application construction and behavior.
  - **Code link:** [src/main/java/com/github/blaxk3/ui/UI.java](src/main/java/com/github/blaxk3/ui/UI.java)

### Platform dependency

- **`javax.swing.SwingUtilities`** — used to schedule UI creation on the Swing event dispatch thread.

### Relationship diagram

```mermaid
flowchart TD
A["CurrencyConverter"] --> B["SwingUtilities.invokeLater"]
B --> C["UI"]
```

## Notes for Developers

- This module is a launcher, not a feature-rich domain package. If you are looking for currency conversion behavior, it is likely implemented in `com.github.blaxk3.ui.UI` or classes it uses.
- The `main` method ignores command-line arguments. If you need configuration via CLI flags, this is the place to add parsing and startup decisions.
- Keeping UI creation inside `invokeLater` is important for Swing correctness. If you add startup logic here, preserve that threading model.
- Because the launcher only creates `UI`, it is a good place for future enhancements such as logging startup errors, reading configuration, or selecting an alternate initial screen.
