|JScrollPane problem in the Design view [message #1645845]
||Mon, 02 March 2015 18:28
| Chris Baillie
Registered: March 2015
I'm having a couple of troubles with the JScrollPane in the design view which I'm hoping people can help with since I can't find anything on this anywhere else.|
My problem is how I move the scroll bar in the design view?
I have my JScrollPane and within that I have a JPanel in absolute layout with a set preferred size. This caused the scrolls bars of the JScrollPane to appear in the design view since they would now be needed due to the JPanels preferred size being greater than the size of the JScollPane.
However my issue is that I cannot move the scroll bar to actually scroll down and see all of my JPanel. I cannot find out how to do this, but while testing how the JFrame as a whole would look, I got an error of some sort which I quickly fixed and paid no attention to. However, I then noticed that the scroll bar of the JScrollPane in the design view was no longer set to the top and instead the bar was about 10% of the way down the total bar.
Now when I try and run my JFrame, the scroll bar is automatically starting at this position of being about 10% down and not fully at the top. There is nothing else in my code that is causing this so I can only assuming that the scroll bars position in the design view is what is making the scroll bar act like this when I run it.
I have already tried what solutions I could find online such as scrollPane.getVerticalScrollBar().setValue(0); but this does not work. Through trial and error, I can only assuming the position in the design view is causing it to run with the scroll bar at the same position
Is there any way I can move the bar back to the top? I have not been able to find any key binds or the like which will do this. I can live with not being able to see the whole JPanel since I can just position it roughly and then run it to see how it looks, but the scroll bar not being at the top is quite an annoying issue.
Thanks for any help.
Powered by FUDForum
. Page generated in 0.02108 seconds