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

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

## 1. Role

### UI.textField()

This method builds the primary amount-entry input used by the currency conversion screen. It creates a new Swing `JTextField`, assigns the visual styling required by the application theme, and returns it as a generic `Component` so the parent panel can add it alongside the other controls.

From a business perspective, the method exists to provide a controlled input surface for monetary values. The field is configured with a large bold font and a fixed size so that the user can easily enter a conversion amount and read the UI consistently. In addition, the method attaches a `NumericFilter` to the underlying `PlainDocument`, which acts as a validation gate and prevents non-numeric input from being entered into the amount field.

The method follows a component factory / initialization pattern: it encapsulates widget construction, formatting, and input restriction in one place so the rest of the screen can simply request the prepared field. It does not perform conversion logic itself; instead, it supports the larger currency-conversion workflow by ensuring that downstream conversion code receives a valid numeric amount. Because the field is reused by the button handlers through `getTextField()`, it also serves as a shared stateful UI component within the screen instance.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START["textField()"]
    STEP1["Create new JTextField instance"]
    STEP2["Set font to Arial Bold 24"]
    STEP3["Set preferred size to 300 x 100"]
    STEP4["Cast document to PlainDocument"]
    STEP5["Apply NumericFilter to document"]
    END_NODE["Return textField component"]
    START --> STEP1
    STEP1 --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 --> STEP5
    STEP5 --> END_NODE
```

**CRITICAL — Constant Resolution:**
This method does not branch on business constants. No constant-driven dispatch is present in the analyzed source.

## 3. Parameter Analysis

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

External state used by this method:
- `textField` instance field is assigned the newly created component and later reused by other UI actions.
- `NumericFilter` is instantiated as an internal validation dependency to constrain user input.

## 4. CRUD Operations / Called Services

This method does not invoke business services, DAOs, or persistence operations. Its calls are limited to Swing component construction and UI configuration, which are non-CRUD presentation-layer actions.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `new JTextField()` | - | - | Create the amount input control for the conversion screen |
| - | `setFont(...)` | - | - | Apply presentation styling to the input field |
| - | `setPreferredSize(...)` | - | - | Define the field's layout footprint within the panel |
| - | `getDocument()` / `setDocumentFilter(...)` | - | - | Attach numeric-only validation to the field document |

## 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 | `UI.panel()` -> `UI.textField()` | `-` |

`UI.panel()` is the direct caller found in the analyzed source. The method is a UI construction helper that is invoked when the screen frame builds its left-side input area.

## 6. Per-Branch Detail Blocks

**Block 1** — [SEQUENCE] `(component initialization)` (L149-L153)

> Creates the amount-entry field and configures its presentation and validation behavior.

| # | Type | Code |
|---|------|------|
| 1 | SET | `textField = new JTextField();` |
| 2 | EXEC | `textField.setFont(new Font("Arial", Font.BOLD, 24));` |
| 3 | EXEC | `textField.setPreferredSize(new Dimension(300, 100));` |
| 4 | EXEC | `((javax.swing.text.PlainDocument) textField.getDocument()).setDocumentFilter(new NumericFilter());` |

**Block 2** — [RETURN] `(return component)` (L155)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return textField;` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|-------------------|
| `textField` | Field / UI control | Amount entry field used to capture the numeric value for currency conversion |
| `NumericFilter` | Technical component | Input validator that allows only numeric characters and a single decimal point |
| `JTextField` | Swing component | Standard single-line text input control |
| `PlainDocument` | Swing document model | Text storage model that supports document-level validation and filtering |
| `Arial` | Font family | Visual font used to make the amount field prominent and readable |
| `Font.BOLD` | UI style flag | Bold text styling for emphasis in the user interface |
| `Dimension(300, 100)` | UI sizing rule | Fixed control size used to standardize screen layout |
| `Component` | Technical return type | Generic Swing base type allowing the caller to add the field to a container |
| `Currency Converter` | Application feature | Screen purpose inferred from the enclosing frame title; converts one currency amount to another |
