Latest posts from Codename One.
Blog

Questions of the Week 30
30 is probably the perfect time to stop with Roman numerals… We don’t want to give search engines the wrong idea. This has been a really busy week with the new Phoenix demo and quite a few other developments. October is finally over and we are all back home from vacations & travels. We are still in “recovery mode” but looking at the pipeline we have pretty exciting things coming up! ...

Badging Arbitrary Components
Last week a question came up in stackoverflow that came out quite a few times before but this time I had a better answer thanks to the round border. After giving that answer I recalled that I already wrote some code to implement badging in the FloatingActionButton but never exposed it because of some bugs… So I took the time and looked at the bugs in that code, turns out it was pretty trivial to fix so the same sample I gave for stackoverflow can now look like this: ...

Gradient and Image Background on FloatingActionButton
The Phoenix theme had a FloatingActionButton with a gradient on top. This goes against the mostly flat material design spec but after looking at the design with a solid color I came to the conclusion that the designer was totally right to use a gradient in this case. Unfortunately we didn’t build that support into the FloatingActionButton. So as part of that work I added a special mode to the RoundBorder that uses the parent UIID to draw the background. This sounds like a “no brainer” but there is a catch: the round border needs to be “round”. ...

Template – Phoenix UI
The Phoenix UI kit by Adrian Chiran is one of the best looking and most challenging template UI’s I had to adapt in recent history. The breadth of the design is pretty challenging but it also has some elements that are really hard to adapt across platforms in a portable way. In fact, some elements only work on devices and don’t even work properly for the JavaScript port e.g. the floating action button gradient color and the round look of the walkthru UI. ...

TIP: Border Layout can Adapt to Orientation
Some designs don’t work well in landscape/portrait mode and we need to adapt them to fit the orientation of the device e.g. when we have a large graphic element (icon etc.) on top/below and we no longer have room for that element. As an example check out the code below: Form hi = new Form("Swap", new BorderLayout()); hi.add(BorderLayout.NORTH, FlowLayout.encloseCenter( new Label(duke.scaledWidth(Display.getInstance().convertToPixels(40))))); hi.add(BorderLayout.CENTER, ComponentGroup.enclose( new TextField("", "Username"), new TextField("", "Password", 20, TextField.PASSWORD) )); hi.show(); It produces this image in portrait which matches our expectations: ...

Questions of the Week XXIX
This was a busy week with a lot of work going on under the hood especially on the new GUI builder. We are also working on a pretty cool new demo that we’ll ideally launch next week. Our release today only includes the libraries making it smaller, we would probably release a plugin update next Friday as there are many changes that warrant an update. On stack overflow things were as usual: ...

Using the Designers Command Line Options
Codename One’s resource files contain a lot of details but it’s sometimes hard to add elements into the resource file automatically. Recently I wanted to add a better way to add images directly in the new GUI builder. I considered several options and eventually decided to operate the designer tool automatically to do the “heavy lifting”. I’m not the first person to try this though, some Codename One users automate tasks by generating the theme and UI XML’s to automatically scaffold an app. ...

Surface Sales and Java Adware
Both TechCrunch & Engaget report that surface sold well during the last quarter when contrasting it’s sales of 926M to 4.9B iPad sales. But the number is a bit misleading as the surface is really comparable to the iPad pro line in terms of pricing/target market and I would guess the sales are very close and might have exceeded those of the Apple device. This is important since both devices target the very lucrative enterprise/professional user market and both require touch friendly apps. Both are hard to reach for Java developers and as such Codename One is the only solution that can properly natively address both… ...

Faster iOS Builds, GUI Builder Improvements & SQL Updates
I’ve recently noticed that distribution build sizes were identical for appstore and debug builds which wasn’t the case before the xcode 7.x migration we did a while back. This shouldn’t be the case as it indicates that the standard debug builds include both the 64bit and 32bit code which is redundant during debugging. We made some changes that should apply for the next update this Friday that might double build speed for some of you as it will do less work during compiling but also produce a smaller binary. ...

TIP: Don't use File – Save As in Photoshop, only use Export
This isn’t a programming tip, but since we discussed photoshop quite a few times before it’s probably an important subject. Especially because we made this exact mistake in those tutorials and I’ve spent the better part of the day tracking this with no result… I’ve worked on extracting UI’s from PSD files for a while now and I was on my way to build a new UI when suddenly I noticed my theme file was HUGE. Not just “big”, HUGE. ...

Questions of the Week XXVIII
Unlike last week this has mostly been a calm week with the exception of some downtime we had on the certificate wizard (Apple tightened TLS access) there was hardly anything major going on. We are focusing a lot of our efforts on refining our offering on all fronts e.g. better demos, themes, docs, compatibility and tools. Things will probably stay relatively easy until November although I think a big focus will shift into handling some of the bugs we have lined up for 3.6. ...

File and URL for Better Java Mobile Compatibility
I explained why we don’t support the full Java API (and the difficulties involved) not so long ago. The logic behind this is solid. However, the utility of porting existing Java code to Codename One is also with a lot of merit. We try to strike a balance between portability, compatibility to the Java API etc. and that is a very delicate balance. To improve the situation we created two new classes: com.codename1.io.File & com.codename1.io.URL. They are meant to be drop-in replacements for java.io.File & java.net.URL to help you port existing code. ...