posted 19 years ago
I am having a little problem with ScrollBar visibility. Basically, earlier in the day, the scroll bars were working fine, but now they are not appearing. I had been playing with the paintComponent method of the client of the JScrollPane. The JScrollPane was created without specifying the scrollbar policy, so they were defaulting to AS_NEEDED.
I just wanted to confirm something on a theoretical basis. The client is a instance of a class which extends JPanel, overriding the paintComponent method to do custom painting. (although it does call super.paintComponent at the beginning.)
I do a getSize() on the client and its Dimension is (1000,1000).
I do a getSize() on the client's parent, which is the Viewport, and its size is (187,115).
I do a getSize() on the client's grandparent, which is the JScrollPane, and its size is (190, 118).
The client is clearly larger than either the ViewPort or the ScrollPane. So shouldn't the scrollbars automagically appear?
Thanks in advance for any help.