Annotation Type 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.themeMode |
Windows | macOS | Linux / GNOME |
|---|---|---|---|
unset, or legacy |
unchanged | unchanged | unchanged |
auto, native, modern |
Windows Fluent | macOS Aqua | GNOME Adwaita |
fluent |
Windows Fluent | Windows Fluent | Windows Fluent |
aqua |
macOS Aqua | macOS Aqua | macOS Aqua |
adwaita |
GNOME Adwaita | GNOME Adwaita | GNOME Adwaita |
custom |
none | none | none |
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:
| hint | governs | see |
|---|---|---|
desktop.themeMode |
the JavaSE desktop application, on all three desktops | themeMode() |
ios.themeMode |
iOS | Ios.themeMode() |
and.themeMode |
Android | Android.themeMode() |
mac.themeMode |
the native macOS build, a separate target from the JavaSE desktop application | Mac.themeMode() |
nativeTheme |
the default for the three above, where they are unset | Build.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.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionBoolean true/false defaults to true.Starts the desktop build in full-screen mode.intHeight in pixels for the form in desktop builds, will be doubled for retina grade displays.Enables grab-able, click-to-page desktop scrollbars.Boolean true/false defaults to true.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.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.intWidth in pixels for the form in desktop builds, will be doubled for retina grade displays.
-
Element Details
-
adaptToRetina
Toggle adaptToRetinaBoolean 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- Default:
DEFAULT
-
fullscreen
-
height
int heightHeight in pixels for the form in desktop builds, will be doubled for retina grade displays. Defaults to 600.- Default:
0
-
interactiveScrollbars
-
resizable
Toggle resizableBoolean true/false defaults to true. Indicates whether the UI in the desktop build is resizable- Default:
DEFAULT
-
themeMode
String themeModeWhich 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,nativeandmodernare one value under three spellings and select the host's own look: Fluent, Aqua or Adwaita. Naming a theme outright withfluent,aquaoradwaitapins 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, andcustominstalls 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
@DesktopBuildannotation 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.
- Default:
""
-
titleBar
DesktopTitleBar titleBarHow 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.- Default:
DEFAULT
-
width
int widthWidth in pixels for the form in desktop builds, will be doubled for retina grade displays. Defaults to 800.- Default:
0
-