docs.dev

UI Components

The owned Swing toolkit and N3Theme design tokens — shared widgets, diagnostic panels, accessibility rules, and test previews for n3Client plugin panels.

Catalog of the Swing toolkit owned by base-api/src/main/java/dev/n3u/model/ui/ and how it binds to the design tokens in the repository root DESIGN.md. Consumers are the n3Client settings/diagnostic panels, the bundled plugin panels, and the standalone manager UI. Source of truth: docs/development/ui-components.md in the n3Client repository.

Token source: DESIGN.md → N3Theme

Root DESIGN.md is the design-token source (colors, typography, radii, spacing, component specs, frontmatter name: n3Client). N3Theme (base-api/src/main/java/dev/n3u/model/ui/N3Theme.java) is the Java mirror; its class javadoc states it is "mirrored from the Storm web identity (web.storm.n3u.dev, apps/web/public/app.css)". Token groups:

GroupConstantsMeaning
Ground/surfacesPAPER 0x090B08, PANEL 0x131711, PANEL_2 0x181D15, WELL 0x060805, RAISE 0x1C2318green-graphite plate hierarchy
StructureRULE, RULE_2, RULE_SOFT, RAISE_RULE, INNER_HIGHLIGHThairline rules and inner highlights
InkINK 0xF5F4EA, INK_2, MUTE, MUTE_2text hierarchy
SignalSIGNAL 0xD9F24E, SIGNAL_INK, SIGNAL_HOVERthe one chartreuse action/live-state color — "action and live state only, never decorative" (source comment)
StatesOK 0x5FE0B0, WARN 0xFFA94D, BAD 0xFF8A93, COOL 0xA8C79A, Tone enum (OK/WARN/BAD/NEUTRAL)state colors — "always paired with a word, never color alone"

Typography follows DESIGN.md §typography through resolved families (Segoe UI Variable Display/Segoe UI for display, Segoe UI Variable Text/Segoe UI for sans, Cascadia Mono/Consolas for mono); resolveFamily falls back to its last candidate, so the display/sans chains end at Dialog and the mono chain at Monospaced (N3Theme.java:117-119,150). N3Theme.brandIcon(int) wraps ClientBranding.icon(size) as an Icon.

When a token is missing, extend both DESIGN.md and N3Theme together; do not hard-code colors in panels.

Shared widgets — model/ui/components/

ClassSurfaceNotes
NFramebase JFrame for owned windowsboth constructors already call setupFrame(String) — subclasses must NOT call it again (the setupFrame javadoc is misleading; a second call re-runs initComponents and registers a second set of window/resize listeners)
NPluginPanelsidebar plugin panel basePANEL_WIDTH = 225, SCROLLBAR_WIDTH = 17, BORDER_OFFSET = 6; wraps content in a scroll pane (wrappedPanel, scrollPane); grid layout via ReflectBuilder on net.runelite.client.ui.DynamicGridLayout
ToggleSliderowned switchexposes AccessibleToggle (AccessibleJPanel implementing AccessibleAction) — this is what gives Space/Enter operation and an exposed checked state
FancyButtonJButton with themed paintingnew FancyButton(String text)
FancyCardtitled cardnew FancyCard(String title, String subText)
FancyDropdowncombo box (generic)custom BasicComboBoxUI, renderer and popup subclasses
FancySpinnerinteger/double spinnertwo public constructors: (String, int, int, int) and (String, double, double, double, double)
FancyDualSpinnerpaired range spinnerused for min/max style inputs
CollapsiblePanelexpandable sectiontoggleExpanded(), setExpanded(boolean), addContent(Component), addVerticalStrut(int)
OptionPaneloptions container panelbase panel for option-style layouts

Owned panels and diagnostic tools — model/ui/

ClassSurfaceNotes
N3ClientOptionsPaneln3Client settings panel (NPluginPanel, singleton via getInstance())owns the client-level switches: headless, packet logging (sent/mouse/server), menu-action logging, name logging, logger visibility, bank cache, mouse-movement send/trajectory record; hosts the transports editor (toggleTransportsEditor()) and listens to menu actions and PacketSent/PacketReceived events
N3ClientInfoPanelclient info sidebar panel (NPluginPanel)status/about surface
PlatformInfoViewerdiagnostic frame (NFrame, singleton)toggle(), postUpdate(Map)
DistanceDebuggerdiagnostic frame (NFrame, singleton)isOn(), getDistanceMode(), per-entity enables (players/NPCs/tile objects/tile items); interaction is through Swing actions — the class holds no event subscriptions

The manager UI reuses the same tokens: ManagerApp imports dev.n3u.model.ui.N3Theme and dev.n3u.util.ClientBranding (manager/src/main/java/dev/n3u/manager/ui/ManagerApp.java:3-4).

Usage rules

  • Build panels from these widgets and N3Theme constants; the shared look (Storm palette + typography across diagnostic tools) is a checked property of the UI audit, not a suggestion — see docs/FEATURES.md §"Desktop controls and UI validation" in the repository and the linked audit evidence.
  • Owned switches must keep their accessibility behavior (Space/Enter, exposed checked state) — ToggleSlider provides it; SharedControlsTest (plugins/src/test/java/dev/n3u/plugins/preview/SharedControlsTest.java) keeps the shared controls honest.

Tests and previews

The plugins test source set renders real panels against the main compile classpath (plugins/build.gradle.kts test dependencies): PluginPanelsPreviewTest, SharedControlsTest, AddLegacyAccountPanelTest. Regenerate visual previews with .\gradlew.bat :plugins:renderUiPreview → build/reports/n3-ui. Synthetic previews and deterministic tests do not establish live/native rendering acceptance; those limits are recorded in docs/development/evidence/UI_UX_AUDIT_2026-11-06.md in the repository.

On this page