Reference

API at a glance

A quick lookup of the main Jolt types and calls for Java and for the page, with links to the page that explains each.

A quick lookup of the main types and calls, with a link to the page that explains each. Everything here is in the package io.github.b077as.jolt unless noted.

Application and options

CallWhat it does
Application.create(AppOptions)Builds the app on the matching backend.
AppOptions.of(id)App id, data folder. withDataDirectory, withQuitWhenLastWindowClosed, withQuietNativeLogs.
app.run(onStart) / app.quit()Run the event loop (blocks) / stop it.
app.createWindow(WindowOptions) / app.windows()Open a window / list open windows.
app.dispatch, app.submit, app.isUiThreadRun on the UI thread; check the thread.
app.openExternal(URI)Open an http, https or mailto address in the user's program.
app.notify(Notification)System notification. Notifications
app.isTraySupported(), app.createTray(icon, tooltip), app.autostart()Tray and autostart
SingleInstance.acquire(...)Allow one copy per user. Tray

WebWindow: showing a page

CallWhat it does
loadHtml(html)Show an HTML string.
loadResources(AppResources, [handler], [ResourceOptions])Show a multi-file page; optional Java request handler. Serving files
AppResources.classpath(base) / directory(path)Files from the jar / from a folder.
loadUrl(url)Show an address (trusted origins only).
ready()Future that completes when the web view has started.

WebWindow: talking to the page

JavaPageNotes
window.onMessage(Consumer<String>)jolt.postMessage(text)Page to Java. Messaging
window.postMessage(text)jolt.onMessage(cb)Java to page.
window.eval(script)Run a script; JSON result as a future.
window.addInitScript(script)Runs before the page's scripts.
window.openChannel(name, [ChannelOptions])jolt.channel(name)Binary pipe. Channels
window.dialogs(), enableSaveAs()jolt.saveAs(...)Dialogs
window.enableNotifications(app)jolt.notify(...)Notifications
window.enableOpenWindow(app, opener)jolt.openWindow, jolt.broadcast, jolt.onBroadcastPop-out windows
(frameless windows)jolt.frame.minimize/toggleMaximize/closeWindow look

WebWindow: controlling the window

CallWhat it does
setTitle, setSize, setIconTitle, size, icon.
setTitleBarScheme, setTitleBarColors, setBackgroundColorColours.
show, hide, focus, minimize, maximize, restore, closeState changes.
isVisible, isFocused, isMinimized, isMaximizedState queries.
setCloseBehavior(CloseBehavior)CLOSE (default) or HIDE.
onClosed(Runnable)Called when the window has closed.
openDevTools()Developer tools (create with withDevTools(true)).
security(), setSecurity(...), onBlocked(...)Security

WindowOptions

Immutable; start from WindowOptions.defaults(). Methods: withTitle, withSize, withMinSize, withIcon, withTitleBarScheme, withBackgroundColor, withMaximized, withCentered, withVisible, withFrameless, withOwner, withDevTools, withSecurity. See Window look and placement.

Handling page requests

TypeMain members
RequestHandlerAppResponse handle(AppRequest); return null to let files answer.
Routerget/post/put/patch/delete(pattern, route), group, before, onError.
AppRequestmethod, path, param, queryParams, form, formValue, bodyText, header, isHtmx, parts, part.
AppResponsehtml, text, status, redirect, withStatus, withHeader.
ResourceOptionswithMaxRequestBytes (default 8 MB, max 1 GB), withStartPath.

Other types

TypeUsed for
SecurityPolicy, BlockedEventWhat pages are trusted. Security
Dialogs, FileDialogOptions, FileFilterNative file dialogs. Dialogs
NotificationToasts with click, buttons and reply.
Tray, TrayMenu, Autostart, CloseBehaviorTray
BinaryChannel, ChannelOptionsChannels
OpenWindowRequest, WindowOpenerPop-out windows
io.github.b077as.jolt.credentials.CredentialStoreOS keystore. Saving passwords