Latest posts from Codename One.
Blog

Game Builder Tutorial 3: Build a First-Person 3D Dungeon
The final tutorial takes the same data-driven pattern from Tutorial 1 and Tutorial 2 into 3D. Duke’s last adventure sends him underground: Crypt Walk, a first-person dungeon of stone corridors where the tea cups have invaded his coffee break. He hunts them through the maze and fires coffee beans to smash them, while the walls box him in. The headline difference from the 2D tutorial is what happens at runtime — instead of sprites in a Scene, each element becomes a GPU-rendered Model under a perspective camera with lighting. You author the same way; the runtime renders it in 3D. ...

Game Builder Tutorial 2: Build a Blackjack Card Game (Duke Jack)
In Tutorial 1 Duke dashed for coffee with arcade physics. Now he sets the cup down for a calmer contest: Duke Jack, a game of blackjack. A card game has none of that arcade motion — cards sit on the felt and the rules decide who wins. This tutorial shows how the same Game Builder pattern (visual data + an onUpdate companion) handles a card game, where your code reads the cards and runs the table instead of simulating movement. We’ll build a felt table, deal a real hand, and wire up the complete blackjack rules: hit, stand, the dealer’s draw, and the win/lose decision. ...

Game Builder Tutorial 1: Build a 2D Platformer — Duke's Coffee Run
Most game tutorials make you hand-place every sprite in code. The Game Builder flips that around: you draw the level visually, tag objects with the numbers your game needs (lives, value, speed), and the editor saves it as a small data file that the runtime plays. Your code shrinks to the part that’s actually yours — the rules. This is the first of three tutorials. We’ll build Duke’s Coffee Run: a side-scroller where Java’s mascot Duke dashes right across a grassy floor, collects coffee cups for points, dodges roaming exception monsters, and reaches a flag to win. Along the way we’ll do the part most tutorials quietly skip — bringing in real art, including slicing an animated sprite sheet for Duke. By the end you’ll have a running game and understand every moving part: the assets, the level file, the generated companion class, the built-in arcade behavior, and where your own logic goes. Tutorials 2 (board game) and 3 (3D dungeon) continue the story. ...

Print Anywhere, And Put Your Cards In Apple Wallet
The last two items in this week’s release are platform integrations that business apps ask for constantly: printing a document, and getting a payment card into Apple Wallet. Both are the kind of feature where the cross-platform story usually ends and a pile of per-platform native code begins. Both are now core APIs. Printing: one call, five platforms PR #5217 adds com.codename1.printing, a deliberately small API: hand a document to the platform’s printing system, typically through the native print dialog, and hear back once about how it went. ...

Java To A Native Windows EXE: No JVM, 5MB, x64 And Arm
If you were around Java forums in the late nineties you remember the threads. “How do I compile my Java program to an EXE?” was asked constantly, answered badly, and locked periodically. The real answer for most of three decades was: you don’t, you ship a JVM. Wrapper tools bundled a runtime next to your jar; the result was a directory pretending to be a program. ...

Build Games In Java: Sprites, Box2D Physics And Low-Latency Sound
A confession before the feature tour: for years I was very much against adding gaming to Codename One. I used to work in the gaming industry (Jane’s USAF, among others), so this was never about disinterest or not understanding the domain. The opposite: I knew exactly how much a real gaming stack demands, and I felt that tackling it would dilute our focus on being the best cross-platform app framework. But at the rate we have been building up Codename One lately, it has become a manageable and realistic target. ...

3D Graphics Without Writing Shaders: The Portable GPU API
Cross-platform 3D is one of those problems that looks impossible when you list the constraints. iOS wants Metal and Metal Shading Language. Android wants OpenGL ES and GLSL. The web wants WebGL. Windows wants Direct3D and HLSL. Every one of these has its own shader language, its own pipeline model, and its own buffer semantics. Most portable engines solve this by making you write shaders multiple times, or by adopting a giant dependency that becomes your whole application. ...

Native Java Win32, 3D Gaming, Printing and Wallet
This week we’re introducing native Windows support (no JVM!), a 3D graphics API, a gaming API, support for Apple Wallet, printing and more in what is probably our biggest update ever… But that’s not the thing that excites me the most. The thing that excites me the most I won’t tease you about this too much. The thing that excited me the most this week is this new article by Francesco Galgani introducing Codename One, published on Baeldung. Beyond the great writing and form, the excitement is about the community: the way you’re all using Codename One and helping us build it. The issues, the tracking, and the enthusiasm about upcoming features, like this one where a request to consolidate documentation chapters opens with a triple thank-you for the game development API before it even gets to the point. ...

Background Work, Push Topics, And Richer Notifications
The work that happens while your app is not in the foreground has always been the fiddly part of mobile development, and Codename One’s coverage of it had gaps. PR #5142 modernizes local notifications, push, background execution, and shared content across the core, JavaSE, Android, and iOS, and importantly it makes all of it work in the simulator so you can iterate without a device. ...

A New Advertising API, Built From The Ground Up
Advertising support in Codename One had quietly rotted. It was spread across three mechanisms that no longer work: the original com.codename1.ads and FullScreenAdService APIs built on the long-dead InnerActive and V-Serv networks, the decade-old google.adUnitId and mopubId banner build hints (MoPub is gone), and an AdMob cn1lib that was interstitial-only, built on iOS APIs Google has since removed, busy-polled, and had no consent flow. None of them supported rewarded, rewarded-interstitial, app-open, or native formats, GDPR consent, iOS App Tracking Transparency, server-side reward verification, or mediation. ...

WebSockets, gRPC, And GraphQL In The Core
Three connectivity features landed together this week, and they belong in one place because they build on each other. WebSockets moved into the core; the GraphQL client uses that same WebSocket support for subscriptions; and gRPC reuses the exact code-generation pattern GraphQL and OpenAPI already follow. This post is a tutorial for all three. By the end, you will have a live chat, a typed GraphQL client, and a typed gRPC client, and you will see how little code each one takes. ...

Your Codename One App, Now A Native Mac App
Codename One has run on the desktop for a long time through the JavaSE target, which is the same engine that powers the simulator. What it did not have was a real native Mac binary, and the desktop output still carried a lot of phone-shaped habits: a drawn toolbar where the OS menu bar belongs, scrollbars you could not grab, no place in the menu for Preferences or Quit. With version 7.0.250 we finally have an actual native macOS application target that doesn’t bundle a JVM and is as native as our iOS target. ...