@Retention(CLASS) @Target({TYPE})

public @interface DesktopBuild

Desktop build hints, checked by the compiler.

Place this on your application’s main class – the class named by codename1.mainName. An attribute you do not set is not written at all, so the build server’s own default applies. The default clause below each attribute names a constant that says nothing – see HintUnset – and this package deliberately does not record what the server would do instead, because that is the server’s to change.

The platform is stated once on the annotation, not on every attribute. An attribute repeats it only to disagree with it.

Which theme a desktop application gets

themeMode() is resolved against the machine the application starts on, because one desktop binary runs on all three operating systems:

desktop.themeModeWindowsmacOSLinux / GNOME
unset, or legacyunchangedunchangedunchanged
auto, native, modernWindows FluentmacOS AquaGNOME Adwaita
fluentWindows FluentWindows FluentWindows Fluent
aquamacOS AquamacOS AquamacOS Aqua
adwaitaGNOME AdwaitaGNOME AdwaitaGNOME Adwaita
customnonenonenone

unchanged is the default and is deliberate: it is whatever the application was built and tested against before these themes existed, because flipping it would move every screen of every desktop application already shipped. custom differs from it by installing no framework theme at all.

How that relates to the other theme hints

Each platform has its own hint, and each governs only its own platform:

hintgovernssee
desktop.themeModethe JavaSE desktop application, on all three desktopsthemeMode()
ios.themeModeiOSIos.themeMode()
and.themeModeAndroidAndroid.themeMode()
mac.themeModethe native macOS build, a separate target from the JavaSE desktop applicationMac.themeMode()
nativeThemethe default for the three above, where they are unsetBuild.nativeTheme()

The one value in that last row that also reaches the desktop is nativeTheme = ThemeMode.NATIVE, which is the single hint for “look like the platform, everywhere”. ThemeMode.MODERN reaches iOS and Android only: it shipped years before the desktop themes, so an application that set it for its phone builds never asked for its desktop screens to be redrawn. themeMode here outranks both.

Methods

public abstract Toggle adaptToRetina() default Toggle.DEFAULTBoolean true/false defaults to true.
public abstract Toggle fullscreen() default Toggle.DEFAULTStarts the desktop build in full-screen mode.
public abstract int height() default 0Height in pixels for the form in desktop builds, will be doubled for retina grade displays.
public abstract Toggle interactiveScrollbars() default Toggle.DEFAULTEnables grab-able, click-to-page desktop scrollbars.
public abstract Toggle resizable() default Toggle.DEFAULTBoolean true/false defaults to true.
public abstract String themeMode() default ""Which native theme a desktop build installs, and the one hint that decides whether a desktop application looks like the platform it’s running on.
public abstract DesktopTitleBar titleBar() default DesktopTitleBar.DEFAULTHow the desktop window is framed: native for the OS title bar and menu bar, custom for an undecorated window with a Codename One drawn title bar, or toolbar for the legacy in-app Toolbar.
public abstract int width() default 0Width in pixels for the form in desktop builds, will be doubled for retina grade displays.

Method details

adaptToRetina

public abstract Toggle adaptToRetina() default Toggle.DEFAULT
Boolean true/false defaults to true. When set to true some values will ve implicitly doubled to deal with retina displays and icons etc. Will use higher DPI’s

fullscreen

public abstract Toggle fullscreen() default Toggle.DEFAULT
Starts the desktop build in full-screen mode.

height

public abstract int height() default 0
Height in pixels for the form in desktop builds, will be doubled for retina grade displays. Defaults to 600.

interactiveScrollbars

public abstract Toggle interactiveScrollbars() default Toggle.DEFAULT
Enables grab-able, click-to-page desktop scrollbars.

resizable

public abstract Toggle resizable() default Toggle.DEFAULT
Boolean true/false defaults to true. Indicates whether the UI in the desktop build is resizable

themeMode

public abstract String themeMode() default ""

Which native theme a desktop build installs, and the one hint that decides whether a desktop application looks like the platform it’s running on.

One desktop binary runs on Windows, macOS and Linux, so the value is resolved against the machine the application starts on rather than at build time. auto, native and modern are one value under three spellings and select the host’s own look: Fluent, Aqua or Adwaita. Naming a theme outright with fluent, aqua or adwaita pins that one look on every machine instead, which is what an application with a deliberate cross-platform identity wants. legacy, which is also the default, keeps whatever the application was built and tested against before these themes existed, and custom installs no framework theme at all so the application’s own is the only one loaded.

The per-value and per-platform tables, and how this relates to the iOS, Android, macOS and cross-platform theme hints, are on the @DesktopBuild annotation itself.

Read by the JavaSE port at runtime rather than by a builder, so unlike most hints here it changes what the running application does rather than what’s produced for it.

titleBar

public abstract DesktopTitleBar titleBar() default DesktopTitleBar.DEFAULT
How the desktop window is framed: native for the OS title bar and menu bar, custom for an undecorated window with a Codename One drawn title bar, or toolbar for the legacy in-app Toolbar. An unrecognized value falls back to native with a warning.

width

public abstract int width() default 0
Width in pixels for the form in desktop builds, will be doubled for retina grade displays. Defaults to 800.