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

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

## 1. Role

### UI.textField()

This method constructs the primary amount-entry control for the currency conversion screen. It creates a Swing `JTextField`, applies the visual styling required by the application, and returns it as a generic `Component` so the surrounding panel builder can place it into the form layout. Business-wise, this field is the user’s input channel for the conversion amount, and it is the first gate in the conversion workflow because the downstream conversion action depends on a valid numeric value being present.

The method also enforces a numeric input policy by attaching the `NumericFilter` document filter to the field’s underlying document. This implements a defensive UI validation pattern: invalid characters are blocked before the value reaches the conversion logic, reducing the chance of runtime parsing errors and preserving a clean business rule that only numeric amounts and a single decimal point may be entered. In the larger system, this method acts as a reusable UI factory method used by the screen assembly logic to keep component creation centralized and consistent.

There are no business branches in this method. Its control flow is linear: instantiate the field, configure display attributes, attach the input filter, and return the prepared component.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["textField()"])
    CREATE["Create new JTextField"]
    FONT["Set font to Arial Bold 24"]
    SIZE["Set preferred size 300x100"]
    DOC["Get PlainDocument from text field"]
    FILTER["Set NumericFilter on document"]
    END_NODE(["Return textField component"])

    START --> CREATE
    CREATE --> FONT
    FONT --> SIZE
    SIZE --> DOC
    DOC --> FILTER
    FILTER --> END_NODE
```

**CRITICAL — Constant Resolution:**
This method does not branch on project constants and does not reference any constant-driven business code path.

## 3. Parameter Analysis

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

This method has no parameters. It uses the class-level `textField` field as mutable UI state and returns the constructed Swing component. External state read by the method is limited to the `UI` instance field `textField` itself after assignment, and the method also depends on the nested `NumericFilter` class when attaching input validation.

## 4. CRUD Operations / Called Services

This method does not perform CRUD operations against persistent data stores. It only creates and configures an in-memory Swing component and attaches a local document filter.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `new JTextField()` | - | - | Instantiate the amount input control used by the currency converter form |
| - | `setFont(...)` | - | - | Apply presentation styling for the amount field |
| - | `setPreferredSize(...)` | - | - | Define the screen layout footprint of the amount field |
| - | `setDocumentFilter(new NumericFilter())` | - | - | Attach client-side validation so the amount field accepts only numeric characters and one decimal separator |

## 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 | `UI` | `UI.panel()` -> `UI.textField()` | `setDocumentFilter(new NumericFilter()) [R] -` |

The only direct caller found in the same class is `panel()`, which assembles the main UI container and adds the text field into the top panel. No external screen or batch entry point was identified in the provided search scope.

## 6. Per-Branch Detail Blocks

**Block 1** — [SEQUENTIAL] `(method initialization)` (L149)

> Builds the amount input field used by the conversion form.

| # | 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());` |
| 5 | RETURN | `return textField;` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `textField` | Field / UI control | Amount input field where the user enters the currency value to convert |
| `JTextField` | Technical term | Swing text input component used for free-form user entry |
| `Component` | Technical term | Base UI type returned so the field can be embedded in the screen layout |
| `DocumentFilter` | Technical term | Swing validation hook that controls which text changes are allowed in a field |
| `PlainDocument` | Technical term | Standard Swing text document implementation that stores the field contents |
| `NumericFilter` | Technical term | Local validation filter that permits only numeric characters and a single decimal point |
| `Arial` | UI style term | Font family used to match the screen’s visual design |
| `BOLD` | UI style term | Font weight used to emphasize the amount input field |
| `Currency Converter` | Business term | Application screen that converts one currency amount into another |
| `amount` | Business term | Numeric value entered by the user for conversion |
| `decimal point` | Business term | Separator used to enter fractional currency amounts |
| `UI` | Class | Screen assembly class that builds the converter user interface |
