# (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 and configures the primary amount-entry field used by the currency converter screen. It creates a new `JTextField`, applies the visual presentation expected by the UI design, and attaches a `NumericFilter` so the user can enter only valid numeric content. In business terms, this is the input control for the conversion amount, which is the first prerequisite before any exchange-rate calculation can be executed.

The method follows a small factory-style setup pattern: it instantiates the component, standardizes its appearance, and applies input-validation behavior before returning the finished component to the caller. It does not branch by business type or route to multiple downstream services; instead, it centralizes a shared UI rule for safe amount entry. Within the larger system, it acts as a reusable screen-construction helper invoked from the panel assembly logic so the text field is always created with the same size, font, and validation policy.

## 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 to 300x100"])
    DOC(["Get PlainDocument from text field"])
    FILTER(["Set NumericFilter on document"])
    RETURN_NODE(["Return textField"])

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

**CRITICAL — Constant Resolution:**
No business constants are referenced in this method. The behavior is entirely driven by literal UI configuration values and the `NumericFilter` helper.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method has no parameters. It builds the amount-entry field using only local UI configuration and instance state. |

**Instance fields / external state read by the method:**
- `textField` instance field: populated with the newly created `JTextField` and returned to the caller.
- `NumericFilter` class: attached to the field’s document to enforce numeric-only entry.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `getDocument()` | - | Swing `Document` | Retrieves the underlying document model from the text field so a document filter can be attached. |
| U | `setFont(Font)` | - | Swing component state | Updates the visual font of the text field to the application’s standard bold 24-point style. |
| U | `setPreferredSize(Dimension)` | - | Swing component state | Updates the layout size so the input field occupies the designed screen space. |
| U | `setDocumentFilter(NumericFilter)` | - | Swing document state | Updates the document behavior by installing numeric-only validation on user input. |
| C | `new JTextField()` | - | Swing `JTextField` | Creates the amount input component used by the currency conversion screen. |

## 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: -

Trace who calls this method and what this method ultimately calls.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen/UI constructor path | `UI.panel()` -> `panelFramePanel1.add(textField())` -> `UI.textField()` | `NumericFilter [U] Swing document state` |

## 6. Per-Branch Detail Blocks

**Block 1** — [SEQUENTIAL] `(textField creation and configuration)` (L149-L153)

> Builds the amount input control and applies all UI and validation settings before returning it.

| # | Type | Code |
|---|------|------|
| 1 | SET | `textField = new JTextField();` // create the amount-entry field |
| 2 | EXEC | `textField.setFont(new Font("Arial", Font.BOLD, 24));` // apply the screen font style |
| 3 | EXEC | `textField.setPreferredSize(new Dimension(300, 100));` // reserve the designed input area |
| 4 | EXEC | `((javax.swing.text.PlainDocument) textField.getDocument()).setDocumentFilter(new NumericFilter());` // attach numeric-only validation |

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

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `textField` | Field | Amount input field used by the currency converter screen. |
| `JTextField` | Technical term | Swing text-entry component that accepts user input. |
| `NumericFilter` | Technical term | Document filter that allows only numeric characters and a single decimal point. |
| `PlainDocument` | Technical term | Default Swing document model backing the text field. |
| `DocumentFilter` | Technical term | Swing mechanism used to validate or reject edits before they are applied. |
| `Font.BOLD` | Technical term | Font style constant indicating bold text. |
| `Dimension` | Technical term | Swing size descriptor used to define width and height. |
| `Arial` | Technical term | Font family chosen for the UI field presentation. |
| `Currency Converter` | Business term | Application domain represented by the screen; converts values between currencies. |
