[External] : Re: ListView with ImageViews for cells very bugged?

Andy Goryachev andy.goryachev at oracle.com
Wed Jul 12 16:28:41 UTC 2023


... and just by randomly clicking on the scrollbar I got this:

Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 2
      at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
      at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
      at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
      at java.base/java.util.Objects.checkIndex(Objects.java:359)
      at java.base/java.util.ArrayList.get(ArrayList.java:427)
      at javafx.controls/javafx.scene.control.skin.VirtualFlow.updateCellSize(VirtualFlow.java:3099)
      at javafx.controls/javafx.scene.control.skin.VirtualFlow.positionCell(VirtualFlow.java:1975)
      at javafx.controls/javafx.scene.control.skin.VirtualFlow.scrollPixels(VirtualFlow.java:1650)
      at javafx.controls/javafx.scene.control.skin.VirtualFlow.tryScrollOneCell(VirtualFlow.java:1565)
      at javafx.controls/javafx.scene.control.skin.VirtualFlow.scrollTo(VirtualFlow.java:1536)
      at javafx.controls/com.sun.javafx.scene.control.VirtualScrollBar.adjustValue(VirtualScrollBar.java:142)
      at javafx.controls/com.sun.javafx.scene.control.behavior.ScrollBarBehavior.lambda$20(ScrollBarBehavior.java:162)
      at javafx.controls/com.sun.javafx.scene.control.behavior.ScrollBarBehavior.trackPress(ScrollBarBehavior.java:173)
      at javafx.controls/javafx.scene.control.skin.ScrollBarSkin.lambda$7(ScrollBarSkin.java:411)
      at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
      at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
      at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
      at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
      at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
      at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at javafx.controls/javafx.scene.control.skin.VirtualFlow.lambda$2(VirtualFlow.java:369)
      at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
      at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
      at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
      at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3984)
      at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1890)
      at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2708)
      at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411)
      at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:1)
      at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
      at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$2(GlassViewEventHandler.java:450)
      at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
      at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449)
      at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:551)
      at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:937)
      at javafx.graphics/com.sun.glass.ui.mac.MacView.notifyMouse(MacView.java:127)


-andy


From: John Hendrikx <john.hendrikx at gmail.com>
Date: Wednesday, July 12, 2023 at 09:25
To: Ajit Ghaisas <ajit.ghaisas at oracle.com>
Cc: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org>, Andy Goryachev <andy.goryachev at oracle.com>
Subject: [External] : Re: ListView with ImageViews for cells very bugged?

Hi Ajit,

Thanks for checking, that is indeed a bit of a beginner mistake there... sorry for that.

I added the line, and it is much improved (luckily), but I still see issues 2 and 3.

I can narrow down 2 a bit.  When there is only space to show a single row (or less than a single line), the scrollbar won't respond to clicks in the empty area.  When at least a full row is visible, then it starts working normally.

I wonder if it might be possible to warn if that line is missing somehow, or provide a different method to override that doesn't require calling super.

On 12/07/2023 11:26, Ajit Ghaisas wrote:
Hi John,

   This looks like a user code issue and not a JavaFX bug.
   Most of the vertical scrollbar issues that you have mentioned get fixed by adding a call to "super.updateItem(image, empty);" as a first call in the cell factory method "protected void updateItem(Image image, boolean empty)”

I am seeing an exception when I scroll fully down and then scroll up by clicking empty area on the vertical scrollbar. This looks like a separate issue though.

I didn't see any exceptions, just that the scrollbar is unresponsive when clicking in the empty area when less than a full row is visible.

--John

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20230712/e45790cf/attachment-0001.htm>


More information about the openjfx-dev mailing list