• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Displaying generated images greater than 32767 pixels on canvas

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I've been stuck on this for almost a week now so here it goes..

The general gist of the application is to generate one large horizontal bar up to approxiamtely 85,000 pixels to model the amount of seconds in a 24hr period, each pixel represents a second.

This bar is split into multiple sections, these sections can number sometimes anywhere between 1000-2000, each represent a particular 'event' within the 24hr period. So I might have an event A coloured red and that is 300 seconds, another event Z may be 400 seconds with a yellow bar. So they've taken up 700 horizontal pixels so far --> 700 seconds within the 24hr timespan.

These bars and their colours are generated according to a pre-determined 'model' so their never the same.

Inititally I tried it with a ScrolledComposite to display the bar, it worked great up till 32767 pixels (the composite expanded to 32767 pixels) of which after I soon found out I reached the maximum pixel limit for composites in Windows and whatever that should have been drawn beyond this point has been cut off, the scrollbars also worked great displaying the 32767 pixels however and with no lag.

So after having a consultation with the supervisor I've decided to go for the Canvas approach. The thing is my original approach was with a Canvas but I got stuck hence making me switch to a ScrolledComposite. Now I am back to square one. Here are my questions:

1)
Would this be the best approach in your opinion? Does canvas support a pixel width of 85,000 (I tried with 'Image' and it failed)?

My idea was to have a 1000 pixel wide fixed width canvas with scrollbars. Everytime the scrollbars or a 'forward button' is pressed the canvas is repainted to simulate a side "scroll" to show the next lot of pixel graphics. Once the button is clicked on again it shows the next lot of pixel graphics. With this approach I only ever have to deal with 1000 pixels at a time and not the whole 85,000 pixels however I will still be able to view the whole 85,000 pixels without lag or reaching a limit.

How would I 'technically' be able to go around doing this? Some pointers please!

2)
I wrote a "Canvas Test" program to try to test out my idea mentioned above.


The problem with this code is that it's supposed to display 4 different coloured rectangles on the canvas however it only displays the first three, I have to drag the shell window out manually to see the fourth image. So to address this issue I added a Listener to listen for SWT.Resize events. However it does not work as it should - the horizontal scrollbar just disappears when I re-size the window manually. The thumb size on the scrollbar should become smaller if I manually resize the shell smaller so that the scrollbar can be used to view all four images, and the scrollbar width should increase if I manually resize the window outward.

Can someone please tell me what's wrong with my Resize listener code.

Thanks guys

Really appreciate it!


PS: Should mention I am not an expert on SWT however I did read some books and went through tutorials to try to understand the best I can given the timeframe.
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
interesting question. i dont know the answer. my first approach, however, would be a JPanel and a JScrollPane
 
Adam Sheen Smith
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No I can't use any SWING components since the boss wants it to be done in SWT.

Guys if you can't answer the first question please answer the second!! Still trying here...
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SWT gets very little traffic here, and most questions go unanswered (a quick search will confirm).

You're more likely to solve the problem by posting in an Eclipse/SWT forum (if there is one - should be)
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Michael Dunn wrote:
You're more likely to solve the problem by posting in an Eclipse/SWT forum (if there is one - should be)


Indeed. This looks like the real McCoy http://www.eclipse.org/forums/index.php/f/100/
 
First, you drop a couch from the plane, THEN you surf it. Here, take this tiny ad with you:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic