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).]
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
Joined: Feb 05, 2001
Hi, I still have the problem listed above... Could someone please help me out! Thanks in advance! Regards Dominis
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!