---
# (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 amount-entry field used by the currency conversion screen. Its business purpose is to provide a controlled input area for user-entered monetary values, ensuring that the UI only accepts numeric text that can later be converted into a decimal amount. The method is part of the shared screen-building logic for the `UI` window and is invoked while assembling the converter form, so it acts as a reusable UI factory method rather than a business service in itself.

From a design perspective, the method follows a simple factory / initialization pattern: it creates the Swing component, applies presentation settings, and attaches input validation behavior before returning the component as a generic `Component`. The validation is delegated to `NumericFilter`, which means this method participates in the broader input-protection strategy of the application by preventing invalid currency characters from being entered into the text box. There are no conditional branches in this method; its behavior is linear and always produces the same type of component with the same styling and filter.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
START(["textField()"])
CREATE["Create new JTextField"]
FONT["Set font Arial Bold 24"]
SIZE["Set preferred size 300x100"]
FILTER["Cast document to PlainDocument and set NumericFilter"]
END_NODE(["Return textField as Component"])
START --> CREATE
CREATE --> FONT
FONT --> SIZE
SIZE --> FILTER
FILTER --> END_NODE
```

## 3. Parameter Analysis

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

**External state read by this method:** `textField` instance field is assigned and returned; the method also uses `NumericFilter` to attach numeric-only validation behavior.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `NumericFilter` | - | - | Reads the document state indirectly through the Swing document model in order to validate user input. |

This method does not call database services, SC/CBS components, or repository methods. Its only non-trivial behavior is UI component construction and document-level validation wiring.

## 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()` | `NumericFilter [R] Swing Document` |

The method is called from the panel-construction path inside `UI`, specifically when assembling the input row for the currency converter. No external screens, batches, or controller entry points were found in the available codebase search.

## 6. Per-Branch Detail Blocks

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

> Builds the amount input field and attaches numeric-only validation.

| # | 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 box where the user enters the currency value to convert. |
| `Component` | Technical type | Generic Swing UI element returned so the caller can add the field to a container. |
| `JTextField` | Technical type | Single-line text input control used for manual numeric entry. |
| `PlainDocument` | Technical type | Default text document model behind the input field; accessed so a filter can be attached. |
| `DocumentFilter` | Technical type | Swing validation hook that controls what text may be inserted or replaced. |
| `NumericFilter` | Class | Custom input validator that allows only numeric characters and one decimal point. |
| `Currency Converter` | Business term | The application screen that converts one currency amount into another. |
| `Arial Bold 24` | UI style | Large bold font used for prominent form input display. |
| `preferred size 300x100` | UI layout setting | Fixed visual sizing used to keep the input field consistent within the form. |
