# (DD02) Business Logic — UI.panel() [24 LOC]

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

## 1. Role

### UI.panel()

This method builds the main content area of the UI by composing a two-row Swing panel structure. The first row groups an input field and the first selection control, while the second row groups a label, the second selection control, and three action buttons. In business terms, it acts as a screen layout assembler rather than a data processor: it prepares the visible form controls that users interact with before any downstream business action is triggered.

The method follows a simple composition / assembly pattern. It creates a root container, applies a vertical box layout, and then injects two horizontally aligned sub-panels to separate input and action areas. There are no conditional branches, loops, or data transformations inside this method; its only responsibility is to arrange existing component factories into a consistent screen structure.

Within the broader system, `panel()` serves as a shared UI construction point for the `UI` screen class. It centralizes the visual arrangement so the caller only needs to request one component tree rather than manually assemble each section. The method depends on sibling helper methods such as `textField()`, `comboBox1()`, `label()`, `comboBox2()`, and `button()` to provide the actual controls.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["panel()"])
    N1["Create root JPanel framePanel"]
    N2["Set root layout to BoxLayout Y_AXIS"]
    N3["Create top section panelFramePanel1"]
    N4["Set top section background to DARK_GRAY"]
    N5["Set top section layout to FlowLayout CENTER"]
    N6["Add textField() component"]
    N7["Add comboBox1() component"]
    N8["Create bottom section panelFramePanel2"]
    N9["Set bottom section layout to FlowLayout CENTER"]
    N10["Add label() component"]
    N11["Add comboBox2() component"]
    N12["Set bottom section background to DARK_GRAY"]
    N13["Add button()[0]"]
    N14["Add button()[1]"]
    N15["Add button()[2]"]
    N16["Add panelFramePanel1 to framePanel"]
    N17["Add panelFramePanel2 to framePanel"]
    END(["Return framePanel"])
    START --> N1
    N1 --> N2
    N2 --> N3
    N3 --> N4
    N4 --> N5
    N5 --> N6
    N6 --> N7
    N7 --> N8
    N8 --> N9
    N9 --> N10
    N10 --> N11
    N11 --> N12
    N12 --> N13
    N13 --> N14
    N14 --> N15
    N15 --> N16
    N16 --> N17
    N17 --> END
```

**CRITICAL — Constant Resolution:**
No project-specific constants are referenced in this method. The only literal styling values are `Color.DARK_GRAY` and `FlowLayout.CENTER`, both standard Java Swing constants.

## 3. Parameter Analysis

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

This method does not accept parameters. Its behavior is driven entirely by internal component construction and the instance-level helper methods it invokes. External state read by the method is limited to the `UI` class's private component-building methods.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `UI.button` | UI | - | Calls `button` in `UI` |
| - | `UI.comboBox1` | UI | - | Calls `comboBox1` in `UI` |
| - | `UI.comboBox2` | UI | - | Calls `comboBox2` in `UI` |
| - | `UI.label` | UI | - | Calls `label` in `UI` |
| - | `UI.textField` | UI | - | Calls `textField` in `UI` |

The method only performs UI composition and does not execute database CRUD. All called helpers are local component builders, so they are classified as internal UI construction calls rather than SC/CBS operations.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `textField()` | UI | - | Builds the text input component used by the top input row |
| - | `comboBox1()` | UI | - | Builds the first selection control for the top input row |
| - | `label()` | UI | - | Builds the label shown in the bottom action row |
| - | `comboBox2()` | UI | - | Builds the second selection control shown in the bottom row |
| - | `button()` | UI | - | Builds the three action buttons and returns them as an array |

## 5. Dependency Trace

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 | `UI` constructor / screen initialization | `UI.add(panel())` -> `UI.panel()` | `textField() [ - ]`, `comboBox1() [ - ]`, `label() [ - ]`, `comboBox2() [ - ]`, `button() [ - ]` |

This method is called from within the same UI class during component assembly. The terminal endpoints are not external service calls; they are local helper methods that produce Swing components for the screen layout.

## 6. Per-Branch Detail Blocks

There are no conditional branches, loops, or exception blocks in this method.

**Block 1** — SEQUENCE `(panel construction)` (L70)

> Builds the root panel container and prepares the vertical arrangement for the screen body.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JPanel framePanel = new JPanel();` |
| 2 | EXEC | `framePanel.setLayout(new javax.swing.BoxLayout(framePanel, javax.swing.BoxLayout.Y_AXIS));` |

**Block 2** — SEQUENCE `(top input section construction)` (L73)

> Creates the top row that captures user input and the first selection value.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JPanel panelFramePanel1 = new JPanel();` |
| 2 | EXEC | `panelFramePanel1.setBackground(Color.DARK_GRAY);` |
| 3 | EXEC | `panelFramePanel1.setLayout(new FlowLayout(FlowLayout.CENTER));` |
| 4 | CALL | `panelFramePanel1.add(textField());` |
| 5 | CALL | `panelFramePanel1.add(comboBox1());` |

**Block 3** — SEQUENCE `(bottom action section construction)` (L79)

> Creates the second row that presents the label, the second selection control, and the action buttons.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JPanel panelFramePanel2 = new JPanel();` |
| 2 | EXEC | `panelFramePanel2.setLayout(new FlowLayout(FlowLayout.CENTER));` |
| 3 | CALL | `panelFramePanel2.add(label());` |
| 4 | CALL | `panelFramePanel2.add(comboBox2());` |
| 5 | EXEC | `panelFramePanel2.setBackground(Color.DARK_GRAY);` |
| 6 | CALL | `panelFramePanel2.add(button()[0]);` |
| 7 | CALL | `panelFramePanel2.add(button()[1]);` |
| 8 | CALL | `panelFramePanel2.add(button()[2]);` |

**Block 4** — SEQUENCE `(assemble root layout)` (L89)

> Adds both sections to the root container in display order.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `framePanel.add(panelFramePanel1);` |
| 2 | CALL | `framePanel.add(panelFramePanel2);` |

**Block 5** — RETURN `(end of method)` (L92)

> Returns the fully assembled component tree to the caller.

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|-------------------|
| `panel()` | Method | Builds the main UI container for the screen content |
| `framePanel` | Variable | Root panel that holds the complete two-section layout |
| `panelFramePanel1` | Variable | Top input section of the screen |
| `panelFramePanel2` | Variable | Bottom action section of the screen |
| `textField()` | Method | Builds the primary text input control |
| `comboBox1()` | Method | Builds the first dropdown selection control |
| `label()` | Method | Builds the descriptive label shown in the action row |
| `comboBox2()` | Method | Builds the second dropdown selection control |
| `button()` | Method | Builds the set of action buttons shown on the screen |
| `BoxLayout.Y_AXIS` | Swing layout constant | Vertically stacks child components from top to bottom |
| `FlowLayout.CENTER` | Swing layout constant | Horizontally centers child components within a row |
| `Color.DARK_GRAY` | Swing color constant | Dark background styling used to visually separate the sections |
| `Component` | Swing type | Common UI abstraction returned so the caller can embed the panel |
| UI | Acronym / Layer | User interface layer responsible for screen composition |
