# (DD03) Business Logic — UI.textField() [8 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.github.blaxk3.ui.UI` |
| Layer | Utility / Presentation Component |
| Module | `ui` (Package: `com.github.blaxk3.ui`) |

## 1. Role

### UI.textField()

This method constructs the primary amount-entry control used by the currency conversion screen. It creates a fresh `JTextField`, assigns the visual style required by the UI theme, and constrains the input behavior so the field accepts only numeric content through a `DocumentFilter`. In business terms, the method prepares the user-facing input area where the customer enters the amount to be converted, ensuring that only valid monetary input can be typed before the conversion workflow runs.

The method implements a small builder-style UI factory pattern: it initializes the component, applies presentation settings, attaches validation logic, and returns the configured component to the parent panel builder. Its role in the larger system is foundational rather than transactional — it is a reusable screen-construction helper invoked when the main frame assembles the input section of the currency converter. The only branch-like behavior in the broader input flow comes from the attached numeric filter, which later governs whether typed characters are accepted or rejected.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["textField()"])
    N1["Create new JTextField instance"]
    N2["Set font to Arial Bold 24"]
    N3["Set preferred size to 300x100"]
    N4["Cast document to PlainDocument"]
    N5["Apply NumericFilter to document"]
    END_NODE(["Return configured textField component"])

    START --> N1
    N1 --> N2
    N2 --> N3
    N3 --> N4
    N4 --> N5
    N5 --> END_NODE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | - |

External state read by this method:
- `textField` instance field: stores the created input component for later use by the Convert, Swap, and Clear button handlers.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `getDocument()` | - | Swing document model | Reads the field's underlying document so a filter can be attached to the live input buffer. |
| U | `setDocumentFilter(new NumericFilter())` | - | Swing text input behavior | Updates the text field's validation policy so only numeric characters can be entered. |

This method does not call any application SC/CBS service or database repository. Its dependencies are limited to Swing component state and local UI validation behavior.

## 5. Dependency Trace

### Pre-computed evidence from code analysis graph:

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: -

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen/UI builder: `UI.panel()` | `UI.panel()` -> `UI.textField()` | `setDocumentFilter(new NumericFilter())` [U] Swing text input behavior |

## 6. Per-Branch Detail Blocks

**Block 1** — [SEQUENCE] `(method entry)` (L149)

> Creates the editable amount field used by the converter screen.

| # | Type | Code |
|---|------|------|
| 1 | SET | `textField = new JTextField();` // instantiate the amount input component |
| 2 | EXEC | `textField.setFont(new Font("Arial", Font.BOLD, 24));` // apply bold display style |
| 3 | EXEC | `textField.setPreferredSize(new Dimension(300, 100));` // reserve space for user input |
| 4 | EXEC | `((javax.swing.text.PlainDocument) textField.getDocument()).setDocumentFilter(new NumericFilter());` // enforce numeric-only entry |
| 5 | RETURN | `return textField;` // expose the configured component to the panel builder |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `textField` | Field | The currency amount input box displayed on the converter screen. |
| `JTextField` | Technical term | Swing text input component used for freeform user entry. |
| `Document` | Technical term | Swing text model that stores and validates the characters typed into the field. |
| `PlainDocument` | Technical term | Swing document implementation that supports attaching a `DocumentFilter`. |
| `DocumentFilter` | Technical term | Input control hook that can accept or reject edits before they are committed. |
| `NumericFilter` | Technical term | Custom validator that allows digits and a single decimal point only. |
| `Currency Converter` | Business term | The application screen where one currency amount is converted into another. |
| `Arial Bold 24` | UI style | Large bold typography used to emphasize user-entered monetary values. |
| `Dimension(300, 100)` | UI layout term | The fixed size reserved for the amount entry field in the layout. |
