Menu

1 / 6

Native Menus, File Dialogs and 3D Models

DEV Community: java·Shai Almog·6 days ago
#ryjkRP1M
#devtojava#devto#dev#command#menu
Reading 0:00
15s threshold

A desktop app gets judged in the first ten seconds. If the menu bar is wrong, Cmd+Q does nothing or the Save dialog looks like it came from a different decade, people notice, even if they can't say what bothers them. The word processor from last Friday's post needed all of that to hold up next to a native app, so those pieces are now part of Codename One. They work with the code you already write for a phone.

What is Codename One? Codename One is an open-source framework for building native iOS, Android, desktop, and web apps from a single Java or Kotlin codebase. Learn more at codenameone.com .

The real open and save dialogs

openFileChooser() picks one file. Desktop apps need more: several filters, a suggested name, extra options in the dialog and a preview while the user browses. showOpenDialog() and showSaveDialog() cover that:

Display . getInstance (). showOpenDialog ( new OpenFileRequest () . title ( "Import photos" ) . multiSelect ( true ) . addFilter ( new FileTypeFilter ( "Images" ) .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.