Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
5ab5c0f
Add TopLevelContainer, the shared Form/Window contract
shai-almog Aug 16, 2026
81e3614
Resolve the top level from a component, and add the WindowManager SPI
shai-almog Aug 16, 2026
d4d494e
Route core internals through the top level rather than the Form
shai-almog Aug 16, 2026
618ee01
Give each paint surface its own queue and graphics
shai-almog Aug 16, 2026
dc754dd
Share the layered pane bookkeeping between top levels
shai-almog Aug 16, 2026
9d3105a
Add Window, Desktop and Monitor, and route events per window
shai-almog Aug 16, 2026
236a138
JavaSE: resolve screen graphics per canvas, not per port
shai-almog Aug 16, 2026
cf1d20d
JavaSE: implement the window manager
shai-almog Aug 16, 2026
bd81de2
Test the windowing API headlessly
shai-almog Aug 16, 2026
13c83a6
Give Window its own pointer dispatch, and clear the static analysis g…
shai-almog Aug 16, 2026
9c433a4
JavaSE: put peer components and native editing in the right window
shai-almog Aug 16, 2026
aafacfc
Windows: implement the window manager
shai-almog Aug 16, 2026
baa8e22
Linux: implement the window manager
shai-almog Aug 16, 2026
367e12e
macNative: implement the Catalyst window manager
shai-almog Aug 16, 2026
e4694af
Add the windowed screenshot suite
shai-almog Aug 16, 2026
5307d4b
Document desktop windows in the developer guide
shai-almog Aug 16, 2026
a264719
JavaSE: cover the per-canvas graphics resolution
shai-almog Aug 16, 2026
43a7798
macNative: fix three real defects in the Catalyst window layer
shai-almog Aug 16, 2026
28f8e10
Windows/Linux: fix defects found by compiling the native sources
shai-almog Aug 16, 2026
a9d54e0
macNative: implement window capture, and turn multi-window off by def…
shai-almog Aug 16, 2026
aa9bd7b
Correct the Catalyst orientation claim, and probe readiness by capturing
shai-almog Aug 16, 2026
1a2b320
Signal when a window has painted, and wait for it before capturing
shai-almog Aug 16, 2026
aa954cf
Record the Mac Catalyst verification result
shai-almog Aug 16, 2026
a776c4b
macNative: enable multi-window whenever Mac Catalyst is built
shai-almog Aug 17, 2026
5c168e8
Make a window come up at the size it asked for, and painted
shai-almog Aug 17, 2026
0403a60
Move the desktop windows guide snippets into the compiled demo sources
shai-almog Aug 17, 2026
ceca91e
macNative: recycle window scenes instead of destroying them
shai-almog Aug 17, 2026
338ee1a
Add the license header to the new guide snippet fixtures
shai-almog Aug 17, 2026
0ccdb37
Address the review of the desktop window work
shai-almog Aug 17, 2026
c9907fc
Cover the review fixes with tests
shai-almog Aug 17, 2026
13311a9
Document the difference between a close listener and Disposed
shai-almog Aug 17, 2026
1670ca0
macNative: keep the window raster matched to the window
shai-almog Aug 17, 2026
bea352c
Address the second review round
shai-almog Aug 17, 2026
c7832a8
Address the third review round
shai-almog Aug 17, 2026
bc45217
Address the fourth review round
shai-almog Aug 17, 2026
fc3370c
Address the fifth review round
shai-almog Aug 17, 2026
259c862
Address the sixth review round
shai-almog Aug 17, 2026
a128cc7
Address the seventh review round
shai-almog Aug 17, 2026
d20d070
Address the eighth review round
shai-almog Aug 17, 2026
c6b4990
Seed the native Windows window screenshot baselines
shai-almog Aug 17, 2026
aac8cba
Seed the native Linux window screenshot baselines
shai-almog Aug 17, 2026
47e0aa0
Satisfy the PMD gate for the desktop window work
shai-almog Aug 17, 2026
5acc488
Address the ninth review round
shai-almog Aug 17, 2026
f495477
macNative: do not lay a window out at a recycled scene's old size
shai-almog Aug 17, 2026
75ef76f
Keep the JavaSE port compiling at source 1.7
shai-almog Aug 17, 2026
9ac7ddd
Let the framework decide which windows are natively blocked
shai-almog Aug 17, 2026
34e0cb0
Bring the desktop windows guide up to date with the implementation
shai-almog Aug 17, 2026
b35b8bd
Report multi-window as skipped, not passed, where windows do not exist
shai-almog Aug 17, 2026
b7998b5
Paint a window over its whole surface, not the platform's stale size
shai-almog Aug 17, 2026
7383c44
Address the tenth review round
shai-almog Aug 18, 2026
aa3804f
Address the eleventh review round
shai-almog Aug 18, 2026
3636bd2
Address the twelfth review round
shai-almog Aug 18, 2026
047ce9e
Address the thirteenth review round
shai-almog Aug 18, 2026
e3bc655
Address the fourteenth review round
shai-almog Aug 18, 2026
cdd22a6
Address the fifteenth review round
shai-almog Aug 18, 2026
e54ef34
Address the sixteenth review round, and fix the Mac Catalyst build
shai-almog Aug 18, 2026
ba22f3e
Fix the GTK main-window buffer race, and the seventeenth review round
shai-almog Aug 18, 2026
f887d05
Stop a secondary Java SE canvas resizing the main surface
shai-almog Aug 18, 2026
bf6b675
Address the nineteenth review round
shai-almog Aug 18, 2026
da91e38
Address the twentieth review round
shai-almog Aug 18, 2026
11caf5c
Address the twenty-first review round
shai-almog Aug 18, 2026
6d88fca
Address the twenty-second review round
shai-almog Aug 18, 2026
f4f17c3
Add the missing copyright header to LinuxGenericPeer
shai-almog Aug 18, 2026
e287676
Address the twenty-third review round
shai-almog Aug 18, 2026
d60f7ba
Address the twenty-fourth review round
shai-almog Aug 18, 2026
8455642
Set the Linux browser's window slot before it is used
shai-almog Aug 18, 2026
e7c3392
Drop a pointless null guard in the browser create path
shai-almog Aug 18, 2026
0ac9cfc
Address the twenty-fifth review round
shai-almog Aug 18, 2026
5178ab7
Address the twenty-sixth review round
shai-almog Aug 18, 2026
bdded62
Address the twenty-seventh review round
shai-almog Aug 18, 2026
c742375
Address the twenty-eighth review round
shai-almog Aug 18, 2026
952656a
Address the twenty-ninth review round
shai-almog Aug 18, 2026
227e454
Address the thirtieth review round, and close some audited gaps
shai-almog Aug 18, 2026
56966f6
Address the thirty-first review round
shai-almog Aug 18, 2026
e38b87d
Address the thirty-second review round
shai-almog Aug 18, 2026
2dae938
Address the thirty-third review round
shai-almog Aug 18, 2026
a548633
Address the thirty-fourth review round, and fix a PMD violation
shai-almog Aug 18, 2026
1655610
Implement the Window animation-lock contract, and fix Checkstyle
shai-almog Aug 18, 2026
f0bee02
Address the thirty-sixth review round
shai-almog Aug 18, 2026
b2f98c5
Record a pointer press before dispatching it, and close two audited gaps
shai-almog Aug 18, 2026
591a275
Implement the Catalyst window controls it can express, document the rest
shai-almog Aug 18, 2026
eca52f5
Capture Catalyst pointer metadata, and release the Java SE gesture li…
shai-almog Aug 18, 2026
c2d7719
Address the fortieth review round
shai-almog Aug 18, 2026
0bfa9fd
Address the forty-first review round
shai-almog Aug 18, 2026
3ee10ea
Cancel pending input on every path that takes a window out of reach
shai-almog Aug 18, 2026
5707f6d
Cancel held input on focus loss, and reject input queued before a hide
shai-almog Aug 18, 2026
2a56bbf
Make native text editing work in windows on every desktop port
shai-almog Aug 18, 2026
14b81ab
Route the Catalyst native editor to its window, and fix one-shot timers
shai-almog Aug 18, 2026
0a9b553
Scale native peers for their own window's monitor
shai-almog Aug 18, 2026
5150bff
Keep pointer metadata with its packet, and fix two scale conversions
shai-almog Aug 18, 2026
588b2e0
Read Linux desktop windows back for real captures
shai-almog Aug 18, 2026
98f7259
Document what Window.capture() returns per platform
shai-almog Aug 18, 2026
7782fd1
Register animations through the top level, not the form
shai-almog Aug 18, 2026
08241f6
Explain at the call site why the Catalyst present copy stays
shai-almog Aug 18, 2026
f3915b3
Fix the guards around the migrated animation registrations
shai-almog Aug 18, 2026
7633e98
Reuse the coalesced drag's snapshot slot, and fix InfiniteProgress
shai-almog Aug 18, 2026
c04bb2c
Migrate the indirect form lookups the first sweep missed
shai-almog Aug 18, 2026
d059a79
Accept "readback" in the developer guide
shai-almog Aug 18, 2026
23ab118
Finish the getComponentForm sweep, and say where it stops
shai-almog Aug 18, 2026
de19aa6
Finish the local-variable form lookups
shai-almog Aug 18, 2026
c0a407b
Let text editing and peer pollers reach the port from a window
shai-almog Aug 18, 2026
8342617
Size the pointer metadata ring for both stacks, and make window comma…
shai-almog Aug 18, 2026
f3f0fe9
Dispatch window menu commands through the window, and keep MCP off it
shai-almog Aug 18, 2026
2c738b4
Stop double-animating in a window, and fix two more dead paths
shai-almog Aug 19, 2026
d9bb05b
Scope GTK modality to the owner, and check modality on the EDT
shai-almog Aug 19, 2026
965e2bb
Resolve JavaSE hit tests and editor focus from the canvas's own window
shai-almog Aug 19, 2026
e52eef5
Include the work area in the JavaSE monitor fingerprint
shai-almog Aug 19, 2026
47b0a0a
Route window text selection, button commands and emblem geometry corr…
shai-almog Aug 19, 2026
032ac61
Make toolbars, tabs, charts and selection scrolling work in a window
shai-almog Aug 19, 2026
bb63690
Keep secondary canvas resizes off the main surface
shai-almog Aug 19, 2026
c048191
Add the Mac Catalyst window goldens, and release the editor before te…
shai-almog Aug 19, 2026
6b5b66a
Add the missing licence header to UIManagerLargeTextScaleTest
shai-almog Aug 19, 2026
2b7fa9d
Complete the Mac Catalyst window goldens
shai-almog Aug 19, 2026
5068d80
Keep asking Catalyst for a window's geometry until it lands
shai-almog Aug 19, 2026
1582939
Converge Catalyst window geometry, and demand the size that was asked…
shai-almog Aug 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions CodenameOne/src/com/codename1/charts/ChartComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import com.codename1.charts.views.XYChart;
import com.codename1.ui.Component;
import com.codename1.ui.Display;
import com.codename1.ui.Form;
import com.codename1.ui.Graphics;
import com.codename1.ui.Transform;
import com.codename1.ui.animations.Animation;
Expand Down Expand Up @@ -1012,7 +1011,7 @@ private class ZoomTransition implements Animation, IZoomTransition {

@Override
public void start() {
Form f = ChartComponent.this.getComponentForm();
com.codename1.ui.TopLevelContainer f = ChartComponent.this.getTopLevelContainer();
if (f != null) {
f.registerAnimated(this);
this.motion.start();
Expand All @@ -1022,7 +1021,7 @@ public void start() {
}

public void cleanup() {
Form f = ChartComponent.this.getComponentForm();
com.codename1.ui.TopLevelContainer f = ChartComponent.this.getTopLevelContainer();
if (f != null) {
f.deregisterAnimated(this);
}
Expand Down Expand Up @@ -1101,7 +1100,7 @@ private class ZoomTransitionXY implements Animation, IZoomTransition {

@Override
public void start() {
Form f = ChartComponent.this.getComponentForm();
com.codename1.ui.TopLevelContainer f = ChartComponent.this.getTopLevelContainer();
if (f != null) {
f.registerAnimated(this);
this.motion.start();
Expand All @@ -1111,7 +1110,7 @@ public void start() {
}

public void cleanup() {
Form f = ChartComponent.this.getComponentForm();
com.codename1.ui.TopLevelContainer f = ChartComponent.this.getTopLevelContainer();
if (f != null) {
f.deregisterAnimated(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ protected void cleanup() {
public boolean animate() {
if (finished) {
cleanup();
chart.getComponentForm().deregisterAnimated(this);
com.codename1.ui.TopLevelContainer top = chart.getTopLevelContainer();
if (top != null) {
top.deregisterAnimated(this);
}
return false;
} else if (motion.isFinished()) {
finished = true;
Expand Down Expand Up @@ -194,7 +197,12 @@ public void setEasing(int easing) {
/// current animation settings.
public void animateChart() {
initTransition();
chart.getComponentForm().registerAnimated(this);
// The chart's top level rather than its form: getComponentForm() is null by
// design inside a Window, so a chart transition threw there.
com.codename1.ui.TopLevelContainer top = chart.getTopLevelContainer();
if (top != null) {
top.registerAnimated(this);
Comment thread
shai-almog marked this conversation as resolved.
}

}

Expand Down
25 changes: 20 additions & 5 deletions CodenameOne/src/com/codename1/components/Ads.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.codename1.ui.Component;
import com.codename1.ui.Container;
import com.codename1.ui.Display;
import com.codename1.ui.Form;
import com.codename1.ui.Label;
import com.codename1.ui.TextArea;
import com.codename1.ui.TextField;
Expand All @@ -42,6 +41,7 @@
import com.codename1.ui.html.HTMLElement;
import com.codename1.ui.html.IOCallback;
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.ui.TopLevelContainer;

import java.util.Vector;

Expand Down Expand Up @@ -127,7 +127,13 @@ public void actionPerformed(ActionEvent evt) {
});

if (refreshAd) {
getComponentForm().registerAnimated(this);
// The top level rather than the form: getComponentForm() is null
// by design inside a Window, so this both threw and left the
// animation unregistered there.
TopLevelContainer topLevel = getTopLevelContainer();
if (topLevel != null) {
topLevel.registerAnimated(this);
Comment thread
shai-almog marked this conversation as resolved.
}
} else {
requestAd();
}
Expand All @@ -138,7 +144,13 @@ public void actionPerformed(ActionEvent evt) {
@Override
protected void deinitialize() {
if (refreshAd) {
getComponentForm().deregisterAnimated(this);
// The top level rather than the form: getComponentForm() is null
// by design inside a Window, so this both threw and left the
// animation unregistered there.
TopLevelContainer topLevel = getTopLevelContainer();
if (topLevel != null) {
topLevel.deregisterAnimated(this);
}
}
}

Expand All @@ -150,8 +162,11 @@ private void requestAd() {
/// {@inheritDoc}
@Override
public boolean animate() {
Form parent = getComponentForm();
if (parent == null || !parent.isVisible()) {
// The top level's visibility rather than an enclosing Form's: getComponentForm()
// is null by design inside a Window, so this returned immediately there and the
// refresh the registration had just been fixed to enable never actually ran.
TopLevelContainer parent = getTopLevelContainer();
if (parent == null || !parent.asContainer().isVisible()) {
return false;
}
long t = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import com.codename1.ui.layouts.FlowLayout;
import com.codename1.ui.layouts.LayeredLayout;
import com.codename1.ui.util.EventDispatcher;
import com.codename1.ui.TopLevelContainer;

import java.io.IOException;

Expand Down Expand Up @@ -532,12 +533,24 @@ public void actionPerformed(ActionEvent evt) {
@Override
protected void initComponent() {
super.initComponent();
getComponentForm().registerAnimated(this);
// The top level rather than the form: getComponentForm() is null
// by design inside a Window, so this both threw and left the
// animation unregistered there.
TopLevelContainer topLevel = getTopLevelContainer();
if (topLevel != null) {
topLevel.registerAnimated(this);
}
}

@Override
protected void deinitialize() {
getComponentForm().deregisterAnimated(this);
// The top level rather than the form: getComponentForm() is null
// by design inside a Window, so this both threw and left the
// animation unregistered there.
TopLevelContainer topLevel = getTopLevelContainer();
if (topLevel != null) {
topLevel.deregisterAnimated(this);
}
super.deinitialize();
}

Expand Down
42 changes: 35 additions & 7 deletions CodenameOne/src/com/codename1/components/FloatingHint.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import com.codename1.ui.events.FocusListener;
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.ui.layouts.LayeredLayout;
import com.codename1.ui.TopLevelContainer;
import com.codename1.ui.Window;

/// A floating hint is similar to a text field with a hint. However, when the text field has text in it the hint appears
/// above the text field instead including an animation when focus hits the text field see
Expand Down Expand Up @@ -107,17 +109,27 @@ public void focusLost(Component cmp) {
tf.addFocusListener(fl);
}

/// Revalidates the surface a component lives in, whether that is a form or a
/// window.
private static void revalidateTopLevel(Component c) {
TopLevelContainer top = c.getTopLevelContainer();
if (top != null) {
top.asContainer().revalidate();
}
}

private void focusGainedImpl() {
if (isInitializedImpl()) {
hintButton.setFocus(true);
if (!hintButton.isVisible()) {
hintButton.setVisible(true);
if (getComponentForm().grabAnimationLock()) {
TopLevelContainer top = getTopLevelContainer();
if (top != null && top.grabAnimationLock()) {
morphAndWait(hintLabel, hintButton, 150);
getComponentForm().releaseAnimationLock();
top.releaseAnimationLock();
}
hintLabel.setVisible(false);
tf.getComponentForm().revalidate();
revalidateTopLevel(tf);
tf.setEditable(true);
tf.startEditingAsync();
} else {
Expand All @@ -132,21 +144,37 @@ private void focusGainedImpl() {
}
}

/// True when this hint is attached to the surface currently on screen.
///
/// Comparing `Display#getCurrent()` -- which only ever names a `Form` -- against
/// `getComponentForm()`, null inside a `Window`, was false for every floating hint
/// in a window, so the animated hint silently degraded to the plain branch there.
private boolean isInitializedImpl() {
return isInitialized() && getComponentForm() == Display.getInstance().getCurrent(); //NOPMD CompareObjectsWithEquals
if (!isInitialized()) {
return false;
}
TopLevelContainer top = getTopLevelContainer();
if (top == null) {
return false;
}
if (top instanceof Window) {
return ((Window) top).isWindowShowing();
}
return Display.getInstance().getCurrent() == top; //NOPMD CompareObjectsWithEquals
}

private void focusLostImpl() {
if (isInitializedImpl()) {
hintButton.setFocus(false);
if (tf.getText().length() == 0) {
hintLabel.setVisible(true);
if (getComponentForm().grabAnimationLock()) {
TopLevelContainer top = getTopLevelContainer();
if (top != null && top.grabAnimationLock()) {
morphAndWait(hintButton, hintLabel, 150);
getComponentForm().releaseAnimationLock();
top.releaseAnimationLock();
}
hintButton.setVisible(false);
tf.getComponentForm().revalidate();
revalidateTopLevel(tf);
revalidate();
tf.setEditable(false);
}
Expand Down
74 changes: 63 additions & 11 deletions CodenameOne/src/com/codename1/components/ImageViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import com.codename1.ui.Display;
import com.codename1.ui.Font;
import com.codename1.ui.FontImage;
import com.codename1.ui.Form;
import com.codename1.ui.Graphics;
import com.codename1.ui.Image;
import com.codename1.ui.ImageFactory;
Expand All @@ -40,6 +39,7 @@
import com.codename1.ui.list.ListModel;
import com.codename1.ui.plaf.Style;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.TopLevelContainer;

/// ImageViewer allows zooming/panning an image and potentially flicking between multiple images
/// within a list of images.
Expand Down Expand Up @@ -367,7 +367,13 @@ public void initComponent() {
image.lock();
}
if (image.isAnimation()) {
getComponentForm().registerAnimated(this);
// The top level rather than the form: getComponentForm() is null
// by design inside a Window, so this both threw and left the
// animation unregistered there.
TopLevelContainer topLevel = getTopLevelContainer();
if (topLevel != null) {
topLevel.registerAnimated(this);
}
}
eagerLock();
}
Expand Down Expand Up @@ -448,7 +454,12 @@ public void pointerPressed(int x, int y) {
pointerPressedThumbnailIndex = getThumbnailIndexAt(x, y);
currentZoom = zoom;
delegatingDragToParent = false;
getComponentForm().addComponentAwaitingRelease(this);
// Resolved through the top level so this works inside a Window, where
// getComponentForm() is null and this line threw.
TopLevelContainer viewerTop = getTopLevelContainer();
if (viewerTop != null) {
viewerTop.addComponentAwaitingRelease(this);
}
}

private Container findScrollableYAncestor() {
Expand Down Expand Up @@ -807,6 +818,16 @@ protected Dimension calcPreferredSize() {
if (image != null) {
return new Dimension(image.getWidth(), image.getHeight());
}
// The surface this viewer lives on, not the main display: inside a Window,
// getDisplayWidth() is the main window's and an empty viewer asked for the
// whole screen.
TopLevelContainer top = getTopLevelContainer();
if (top != null) {
Container c = top.asContainer();
if (c.getWidth() > 0 && c.getHeight() > 0) {
return new Dimension(c.getWidth(), c.getHeight());
}
}
return new Dimension(Display.getInstance().getDisplayWidth(), Display.getInstance().getDisplayHeight());
}

Expand All @@ -830,7 +851,13 @@ public boolean animate() {
if (motion.isFinished()) {
zooming = false;
if (!result) {
getComponentForm().deregisterAnimated(this);
// The top level rather than the form: getComponentForm() is null
// by design inside a Window, so this both threw and left the
// animation unregistered there.
TopLevelContainer topLevel = getTopLevelContainer();
if (topLevel != null) {
topLevel.deregisterAnimated(this);
}
}
}
repaint();
Expand Down Expand Up @@ -1104,9 +1131,12 @@ public final void setImage(Image image) {
updatePositions();
repaint();
if (image.isAnimation()) {
Form f = getComponentForm();
if (f != null) {
f.registerAnimated(this);
// The top level, matching every other registration here: inside a
// Window getComponentForm() is null, so swapping in an animated image
// silently stopped animating it.
TopLevelContainer swapTop = getTopLevelContainer();
if (swapTop != null) {
swapTop.registerAnimated(this);
}
}
}
Expand Down Expand Up @@ -1269,7 +1299,13 @@ public void setZoom(float zoom) {
float initZoom = this.zoom;
motion = Motion.createEaseInOutMotion((int) (initZoom * 10000), (int) (zoom * 10000), 200);
motion.start();
getComponentForm().registerAnimated(this);
// The top level rather than the form: getComponentForm() is null
// by design inside a Window, so this both threw and left the
// animation unregistered there.
TopLevelContainer topLevel = getTopLevelContainer();
if (topLevel != null) {
topLevel.registerAnimated(this);
Comment thread
shai-almog marked this conversation as resolved.
}
} else {
this.zoom = zoom;
updatePositions();
Expand Down Expand Up @@ -1306,7 +1342,13 @@ public void setZoom(float zoom, float panPositionX, float panPositionY) {
float initZoom = this.zoom;
motion = Motion.createEaseInOutMotion((int) (initZoom * 10000), (int) (zoom * 10000), 200);
motion.start();
getComponentForm().registerAnimated(this);
// The top level rather than the form: getComponentForm() is null
// by design inside a Window, so this both threw and left the
// animation unregistered there.
TopLevelContainer topLevel = getTopLevelContainer();
if (topLevel != null) {
topLevel.registerAnimated(this);
}
} else {
this.zoom = zoom;
updatePositions();
Expand Down Expand Up @@ -1505,7 +1547,14 @@ public AnimatePanX(float destPan, Image replaceImage, int updatePos) {
motion.start();
this.replaceImage = replaceImage;
this.updatePos = updatePos;
Display.getInstance().getCurrent().registerAnimated(this);
// This viewer's own top level, not whatever form happens to be current.
// Display.getCurrent() only ever names a Form: in a window-only application
// it is null and this threw, and with a main form present it registered the
// animation against the wrong surface and later deregistered from it.
TopLevelContainer panTop = getTopLevelContainer();
if (panTop != null) {
panTop.registerAnimated(this);
}
}

@Override
Expand Down Expand Up @@ -1547,7 +1596,10 @@ public boolean animate() {
getImageRight().unlock();
}
}
Display.getInstance().getCurrent().deregisterAnimated(this);
TopLevelContainer panTop = getTopLevelContainer();
if (panTop != null) {
panTop.deregisterAnimated(this);
}
}
repaint();
return false;
Expand Down
Loading
Loading