• 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

JAVA move vertical scroll bar programatically by moving horizontal scroll bar.

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JAVA move vertical scroll bar programatically by moving horizontal scroll bar. This is just a prototype to achive following.

There are 2 composites each with 1 table.
If i move the horizontal scroll in 1 it should move the horizontal scroll in other simultaniously.
The composites are not scroll composites.

Thanks you
 
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
What have you tried so far and where are you stuck?
 
Prachi Sathe
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was able to get the selection for the horizontal scroll bar for the first composite.
But I have no idea about how to increment the second composites scroll simultaniusly usning the value from the first scroll...

When tried to set the value on Composites using setLocation it moved the Composites instead of the data in the composite.
 
Sheriff
Posts: 22791
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the scrollbars have the same amount of scrolling and should always be in sync, you can set one's model to that of the other. Otherwise you'll need to add a listener to each scrollbar and update the other scrollbar if an event occurs. Be aware to not cause a StackOverflowError: if scrollbar 1 is moved, your code will move scrollbar 2, which triggers an event so scrollbar 1 is moved, which triggers an event so scrollbar 2 is moved, etc.
 
Prachi Sathe
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@ Rob

The value is read from Swing table using
scrollValue = scrollPane.getHorizontalScrollBar().getValue()
and the tried setting the value in other Composite using the
table.getHorizontalBar().setSelection( scrollValue ); this is SWT Table.

This is not working for me

No clue how to proceed...
 
Rob Spoor
Sheriff
Posts: 22791
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you creating one user interface with both Swing and SWT controls?
 
Prachi Sathe
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@ Rob
Yes
Swing component is already there. Th extension is SWT.
 
Rob Spoor
Sheriff
Posts: 22791
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think it's a good idea to mix two different GUI toolkits this way. Either use Swing or SWT, not both.
 
reply
    Bookmark Topic Watch Topic
  • New Topic