Skip to content
CrossFly is 100% open sourceFollow us on GitHub
CrossFlyCrossFly
Get started

This page was machine-translated from Portuguese and may contain errors. The Portuguese version is canonical.

Runtime errors

Format: symptom → cause → fix.

MainWindow won’t load (reflection error / “class not found”)

Cause: the root class does not extend Window or has no public no-args constructor. Fix:

public class MainWindow extends Window {
   public MainWindow() { }   // no-args constructor (required for reflection)
   @Override public void onShow() throws Exception { super.onShow(); /* … */ }
}

(Project anatomy)

“FrameBuffer not disposed! Must call Image.apply after Image.getGraphics!”

Cause: you drew off-screen on an Image and did not commit it. Fix: draw with Image.getPaint() and finalize with paint.finish() (or image.applyChanges()), all inside Main.runOnPaintThreadAndWait(...):

Main.runOnPaintThreadAndWait(() -> {
   Paint p = img.getPaint();
   // … draw in p …
   p.finish();               // confirms (equivalent to img.applyChanges())
});

⚠️ Discrepancy: the error message cites getGraphics()/apply() (old names); the real methods are getPaint() and finish()/applyChanges(). (Ch. 18)

Component changed on a background thread freezes/corrupts the UI

Cause: all UI manipulation is on the paint thread. Fix: hop back with Component.onUI(r) / Main.runOnPaintThread(r).

new Thread(() -> { var v = calc(); Component.onUI(() -> label.setText(v)); }).start();

(The paint thread)

UI built in the constructor shows up empty / with wrong bounds

Cause: in the constructor, the screen/bounds are not ready yet. Fix: build it in onShow() with super.onShow(). (Ch. 7)

Exception in onAction “vanishes” without crashing the app

Cause: handlers are caught by Debug.handle and swallowed — they don’t bubble up. Fix: don’t rely on propagation; log (Debug.log/Debug.handle) and check DebugConsole.txt. (Errors and logging)

See also

Was this page helpful?