Author Topic: Personal Profile and setScrollPosition  (Read 3064 times)

grnewbould

  • Newbie
  • *
  • Posts: 1
    • View Profile
Personal Profile and setScrollPosition
« on: October 07, 2004, 09:01:51 am »
Anyone got any ideas on this.  I have a ScrollPane with an image within it that I want to navigate to certain parts using controls outside of the scroll container e.g buttons etc.

Now heres the problem,

The minute I do any of the following :-

scrollPane.setScrollPosition(p0);
scrollPane.setScrollPosition(p0.x, p0.y);
scrollPane.getHAdjustable().setValue(p0.x);

The Z just goes crazy. scrolling the pane and repainting it constantly. I have put some debug statements in the paint method of the component and am confident it calls it and never returns as the Z seems to be in some endless loop.

The behaviour works correct on PersonalJava on a Sl5xxx, Pocket PC using Jeode and Pocket PC using Tao Intent (as well as J2SE).  Any ideas would be greatly appreciated.

Regards
Gary

Omicron

  • Hero Member
  • *****
  • Posts: 608
    • View Profile
    • http://
Personal Profile and setScrollPosition
« Reply #1 on: October 10, 2004, 09:17:48 am »
Just curious.

Why do you need all three (for the test anyway):

1) scrollPane.setScrollPosition(p0);
2) scrollPane.setScrollPosition(p0.x, p0.y);
3) scrollPane.getHAdjustable().setValue(p0.x);

1 and 2 seem to  be redundant.  First you pass a Pont (I imagine) and then an X and Y (which is still a point).

And line 3) seems to be unrelated as you are just adjusting your Horz scrollbar.

What happens if you:

1) Remove Line 1 or Line 2
2) Remove Line 3
3) Move Line 3 to before lines 1 or 2.

Oftentimes Java needs a little tweaking to find a solution that works on multiple platforms the same.  The Java Spec is definately interpreted subjectly so things can work strangely.

For example, at one point in Java 1.1,  Netscape JVM required a window to be shown prior to adjusting it's size the MS JVM had no such requirement.  You can do If-else for different JVM types, but it is best to just find a common solution that works for all.  Ussually that just means "doing the same thing in a different order".

Hope this helps.
"You Shall Not Pass"    
....Gandalf, Lord Of The Rings
--------------------------------------------------------------
C-860 (Cacko), 3x4gb MD  
DLINK 660W, 1GB SD,  
Upgraded Archos AV320 w/80GB HDD
Pocketop and Targus IR keyboards
Favorite Deal Site: SaveCity.net (pretty cool, good deals daily on one page)