Fork us on GitHub

Scrollbars & Tooltips

Making Codename One more desktop friendly
Post Image

Scrollbars & Tooltips

One of the big decisions we made a while back was to build the new GUI builder on top of Codename One itself, we extended that decision three months ago with the decision to build the Codename One settings in Codename One and then deciding to make it the default preferences UI for all IDE’s…​

Those were great decisions in retrospect, they helped us consolidate code across the different IDE’s. Furthermore using Codename One is far simpler than Swing/SWT or FX. At least for us…​

The look of these new UI’s is far more modern than the Swing alternative. Unlike these other API’s we designed Codename One for mobile and not for desktop so basic desktop staples like scrollbars, tooltips, menubars etc. weren’t available.

We worked around the menu bar functionality using native code and we added scrolling based on the logic here (this isn’t yet in the current shipping version).

We made slight improvements to that code that also recalculate the height and allow for arrows. One of the improvements that did make the current version is support for tooltips which are convenient for desktop applications. We added some initial work around tooltips based on the pointerHover callbacks which now have a mapping in desktop apps but this isn’t turned on by default. We chose to use the glasspane for the tooltips instead of the layered pane which might have an issue when displaying a tooltip on the toolbar.

Since we are pretty late in the 3.5 release cycle we chose not to expose any of this in the API. Our current line of thinking is to create an overarching com.codename1.ui.desktop package that will include tools for desktop API’s such as the ability to define a menu bar, tooltips, scrollbars and other desktop oriented capabilities.

If this is something you find interesting please let us know in the comments, we’d like feedback about the type of features/functionality you would expect in such an API.

Share this Post:

Posted by Shai Almog

Shai is the co-founder of Codename One. He's been a professional programmer for over 25 years. During that time he has worked with dozens of companies including Sun Microsystems.
For more follow Shai on Twitter & github.