File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How align a knob in a JScrollPane ->

 
Dominic Steng�rd
Ranch Hand
Posts: 186
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!
I have put a JPanel inside a JScrollPane. What happens when I open the frame is that the knob(slider) in the scroll pane is set to the middle of the track, which means that instead of seeing the header of my panel the first thing you see is the middle of the panel. The reason for this seams to be that I have used the escape sequence \n inside the panel.
I thought there might be some method called something like setInitialKnobX(int i), but after searching through the JScrollPane API several times I have found nothing what so ever!
Do you understand my problem, if so please help me out!
Regards
------------------
Dominic Steng�rd
Sun Certified Java 2 Programmer
------------------
[This message has been edited by Dominic Steng�rd (edited February 08, 2001).]
 
sakshi
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also facing the similiar problem. I have also taken the instance of scrollbar from the view of scroll pane. there exist methods for setting the nob for a scrollbar such as setValue(int). But in case of JScrollPane these methods are not working.
In your case also there may be chance that when you will take instance of JScrollBar from JViewPort of JScrollPane, then you can set its value.
regards,
sakshi
 
Dominic Steng�rd
Ranch Hand
Posts: 186
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I still have the problem listed above...
Could someone please help me out!
Thanks in advance!
Regards
Dominis
 
Chris Shepherd
Ranch Hand
Posts: 286
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to deal with the viewport. Try
yourScrollPane.getViewPort.reshape(int x,int y,int w,int h)
where x and y =0 should move the view to the upper left corner of your panel
or maybe
yourScrollPane.getViewPort.setViewPosition(new Point(0,0))
the viewport should take care of moving the scrollbars for you.
Good Luck!
 
Ron Lewis
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This didn't work for me with a JScrollPane
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic