Skip to content

Core Concepts

PrinceOfCookies edited this page Jun 5, 2026 · 1 revision

Wrappers, Not a New UI Engine

DervaFX wraps normal JavaFX nodes. Each DervaFX element owns a JavaFX node internally and exposes a chainable API for common UI setup.

DervaElement

DervaElement<T> is the base type for almost everything in the library.

It provides shared helpers such as:

  • position(x, y)
  • size(width, height)
  • minSize(width, height)
  • maxSize(width, height)
  • padding(...)
  • spacing(...)
  • align(...)
  • fillWidth()
  • fillHeight()
  • text(...)
  • visible(...)
  • enabled(...)
  • cssClass(...)
  • style(...)
  • anchorFill()

Root vs Content Node

Each element has:

  • A wrapper root node returned by getNode()
  • An internal content node used by the implementation

This matters for layout and drag behavior. For example, DervaWindow moves its wrapper root rather than the internal VBox.

The Factory Class

DervaFX is the entry point for constructing components:

DervaFX.root();
DervaFX.window("Title");
DervaFX.vbox();
DervaFX.hbox();
DervaFX.panel();
DervaFX.label("Text");
DervaFX.button("Click");

Theme Application

Themes are applied per JavaFX Scene:

DervaFX.applyTheme(scene);

Theme changes can also be pushed globally through:

DervaFX.setTheme(DervaTheme.dark());

Clone this wiki locally