0

I understand, conceptually, scrolling. One has a fixed sized document that a viewport is layered over. One can move the viewport to different areas of the backing document, presumably the document is larger than the viewport. I have a slightly different scenario. The backing document will, in my case, be constantly changing via updates asyncronously received, similar to a ticker tape. What I am used to doing in the 80's Window's environment was to scroll the contents of the document, dropping the highest Ymax row of pixels and invalidating the Ymin row of pixels. When the paint event occurred only that first top row of pixels would need to get added. My understanding of what happens in this scenario is the GPU does the scroll (very fast op), and subsequently paints 1 pixel depth at the new top of viewport.

I don't see a functional equivalent of that in JavaFX.In the examples I've seen, like a rotating marquee, the underlying data is fixed so nothing really is added, merely rotated.

If someone would point me to a document or web page describing that or an example snippet of code, I would greatly appreciate it.

Thanks, Walt

Walt Corey
  • 718
  • 7
  • 12
  • It really depends on your data, but usually the best way to go is to use some sort of `ListView` or similar control which reuses smaller views. For example: https://gist.github.com/varren/aa12f1921922243a5509 – varren Jun 20 '15 at 16:03
  • 1
    What will be your backing document? List, Array, Panel, etc.? Does varren have answered your question? – aw-think Jun 20 '15 at 19:17
  • Are you talking about a drawing (such as a pattern image) where it is generated at runtime? Or some sort of data content (such as a Twitter feed?) – Chris Smith Jun 21 '15 at 01:38
  • Yes, the data is arriving via UDP and will form a colorized image,much like a thermal image. Each image arriving is timestamped and will represent a single pixel depth (height) for some Xmax where X is greater than the viewport window. Where the data to create these colorized images will arrive +/- 50ms apart it will form a waterfall pattern. Rather than adding on to the end of an array or vector I will be adding onto the front. One of the things that concerned me is efficiently adding to the top of the collection of images rather than scrolling 0 - Ymax - 1 down one and simply drawing row 0. – Walt Corey Jun 21 '15 at 15:13
  • The backing array, I believe, needs to be a deque where I can push new images in the top. I am trying to avoid having to redraw the entire 200-400 rows for every addition, especially given the arrival rate of around 50ms. If the user changes display attributes I could redraw all, but absent that I would only need to draw the newest top of list, letting the system scroll 0-Ymax-1 to 1-Ymax. I am sufficiently new to JavaFX I am not sure how to accomplish that. – Walt Corey Jun 21 '15 at 15:32
  • To address my concern about listview, wouldn't that force me to create a new list each time, as I can't add to the front, like a deque, and then, effectively redraw the entire collection of images since, as it was a new backing store, the scroll engine wouldn't know I merely added a pixel height of information to the viewport? While I could do that, I would be redrawing, say, Xmax (1500) * Ymax(400) = 600,000 pixels 20 times/sec. That is what I am trying to prevent. I'd way prefer to draw 1500 pixels 20 times / sec. – Walt Corey Jun 21 '15 at 18:12
  • Quick clarification to Christopher's question. The image will be made at runtime based on digital data received via UDP. Basically I'll be constructing and displaying a moving thermal image. While, perhaps, 300-400 rows will be visible at any one time in the viewport the user may scroll back 'in time' to view something for the prior minute or couple of minutes. This is why I mentioned deque, while I would be adding to the top, After a size of some number I'd be removing the eldest portion so think of it as a rolling 5 min display showing a rolling 20 second window at a time. – Walt Corey Jun 21 '15 at 18:53
  • You could try the `ListView` to display your images. Lists can be added to the end. Here is how to do images in the list view: http://stackoverflow.com/questions/14950341/how-to-display-the-images-in-listview. If this gives you 'lag', you might try just manually drawing to a pane with your images, maybe with multiple `ImageView`s. – Chris Smith Jun 22 '15 at 00:53
  • Actually, it might be possible to create a local image that you append to and just display it in an `ImageView`. – Chris Smith Jun 22 '15 at 00:58
  • The thing of it is each row is one of size (Xmax,1). Each row will arrive via UDP milliseconds apart. New rows are added at the beginning. My understanding is scrolling from (0,0) to (Xmax, Ymax-1) is best done in hardware (gpu) thus freeing up (0,0)->(Xmax, 0) to be drawn. – Walt Corey Jul 05 '15 at 17:17

0 Answers0