Desktop
Window look and placement
Set size, icon, theme and start position of a window, and draw your own title bar with frameless windows.
The operating system draws the icon and title bar, so you set them from Java, at creation or later.
Window options
WindowOptions options = WindowOptions.defaults()
.withSize(1200, 780)
.withMinSize(600, 400) // smallest size the user can drag to
.withIcon(iconBytes) // multi-size .ico (best) or PNG
.withTitleBarScheme(ColorScheme.DARK)
.withBackgroundColor(0x0F1117) // behind the page until it paints: no white flash
.withMaximized(false)
.withCentered(true) // the default
.withVisible(false); // call window.show() when the page is ready
window.setTitleBarColors(0xF4F5FA, 0x1A1D29); // exact colours, Windows 11 only
window.maximize(); window.restore(); window.isMaximized();- Use an
.icowith 16, 24, 32, 48 and 256 px images: Windows picks the matching size instead of scaling one bitmap. On Linux the largest image is used. - Start hidden and call
show()when the page sends "ready", so the window appears with its content already drawn. - On Wayland the compositor decides placement, so
withCenteredis ignored and the icon comes from the app's.desktopfile. Jolt names the process after your app id, which is what lets the compositor find it. AppOptions.of(id).withQuietNativeLogs(true)hides GTK's known harmless warnings on Linux.
Frameless windows
Available since 0.3.0. WindowOptions.defaults().withFrameless(true) removes the operating system's title bar and border, so the page draws its own:
<header data-jolt-drag> <!-- drag here to move the window; double-click maximizes or restores -->
<span>Parsel</span>
<button onclick="jolt.frame.minimize()">–</button>
<button onclick="jolt.frame.toggleMaximize()">☐</button>
<button onclick="jolt.frame.close()">✕</button>
</header>data-jolt-dragmarks the draggable area. Buttons, links and form fields inside it keep working; adddata-jolt-no-dragto exclude anything else. (CSSapp-region: dragis not used, because WebKitGTK does not support it.)- The window can be resized from thin invisible handles along its edges and corners, which Jolt adds to the page.
jolt.frame.close()closes the window as the close button would, sosetCloseBehavior(HIDE)applies to it too.- On Windows the window keeps its sizing frame, which lets Windows draw the shadow and snap it (Win+arrows). Linux snaps as your window manager does.
- Frame commands only work on windows created
frameless, and only for pages the SecurityPolicy trusts.